AI & ML
RAPO-Sol: Retrieval-Augmented Preference Optimization for Repository-Level Solidity Code Generation
arXiv cs.SE0 views
arXiv:2610.08429v1 Announce Type: new Abstract: Smart contracts written in Solidity manage assets, permissions, and irreversible state changes, making code generation both useful and security-critical. Repository-level Solidity generation is challenging because models must synthesize complete contracts or libraries while preserving consistency across state variables, modifiers, events, inheritance, external calls, and access-control logic. We present RAPO-Sol, a two-stage training framework for repository-level Solidity code generation. First, Retrieval-Augmented Fine-Tuning (RAFT) augments each training input with similar Solidity examples, helping the model learn recurring contract-level patterns while remaining retrieval-free at inference time. Second, Direct Preference Optimization (DPO) trains the model to prefer reference contracts over close but semantically flawed alternatives. We construct rejected samples using Solidity Semantic-Anchor Perturbation (SAP), which perturbs validation statements, visibility modifiers, data-location keywords, context variables, payment operations, and low-level calls. Experiments on SolidityBench with CodeLlama-7B-Instruct, DeepSeek-Coder-6.7B-Instruct, and Qwen2.5-Coder-7B-Instruct show that RAFT consistently improves over supervised fine-tuning, while SAP-based DPO provides further gains in BLEU and SolidityScore. The full RAFT+DPO pipeline achieves the best performance across all three models, demonstrating complementary benefits from retrieval during training and Solidity-aware preference optimization without adding retrieval cost at inference.
Source:https://arxiv.org/abs/2610.08429PreviousLearning from Failures: A Failure-Driven Prompt Refinement for LLM-Based Vulnerability AnalysisNextA Case Study in Assuring AI-Written Software
Related posts
Cloudflare DNS Zone Builder cuts peak memory 85% and halves build delay
0dev.to News
O dia em que a cliente pediu desconto num bolo de pistache (e pagou R$ 30 num cafe)
0dev.to Design
O telefone tocou as 19h: Por que cancelam seu contrato primeiro na crise?
0dev.to Design
Which Cursor model is best for everyday work?
0dev.to Productivity
Is AI going to get cheaper or more expensive?
0dev.to Machine Learning
Điểm tin Trí tuệ Nhân tạo & Mô hình Ngôn ngữ lớn (LLMs) tại Việt Nam (03/11/2026)
0dev.to Machine Learning