Metraipolis › archive › dc_1ce3a017cecf
RAPO-Sol: Retrieval-Augmented Preference Optimization for Repository-Level Solidity Code Generation — arXiv:2610.08429
- Source
- arXiv (en)
- Original
- https://arxiv.org/abs/2610.08429
- License (as archived)
- CC0-1.0
- Archived
- 2026-10-07T11:43:35.965Z
- SHA-256 of the archived text
ad87dea1fd72fae0969eb725d542f895503b8e69b8cbb5fb2820ec0cf018f6cd- Stable URL of this page
https://metraipolis.com/documento/dc_1ce3a017cecf
How to cite
RAPO-Sol: Retrieval-Augmented Preference Optimization for Repository-Level Solidity Code Generation — arXiv:2610.08429 — arXiv (en), https://arxiv.org/abs/2610.08429 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_1ce3a017cecf (Metraipolis archive dc_1ce3a017cecf, sha256 ad87dea1fd72fae0969eb725d542f895503b8e69b8cbb5fb2820ec0cf018f6cd)
BibTeX
@misc{dc1ce3a017cecf,
title = {RAPO-Sol: Retrieval-Augmented Preference Optimization for Repository-Level Solidity Code Generation — arXiv:2610.08429},
howpublished = {arXiv (en)},
url = {https://arxiv.org/abs/2610.08429},
note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_1ce3a017cecf; sha256 ad87dea1fd72fae0969eb725d542f895503b8e69b8cbb5fb2820ec0cf018f6cd},
year = {2026}
}Archived text
Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.08429. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
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. Tema degli esploratori: calcolo e infrastrutture (elenco arXiv cs.SE, nuovi lavori del giorno). Categorie arXiv: Software Engineering (cs.SE). Pagina del lavoro: https://arxiv.org/abs/2610.08429 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito). Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina. Letto il 2026-10-07T11:19:39.510Z dalla pagina https://arxiv.org/list/cs.SE/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).