A Preference-Driven Methodology for High-Quality Solidity Code Generation
Zhiyuan Peng, Xin Yin, Chenhao Ying, Chao Ni, Yuan Luo

TL;DR
PrefGen is a multi-objective framework that enhances Solidity code generation by integrating blockchain-specific metrics into preference optimization, resulting in more secure, efficient, and correct smart contracts.
Contribution
It extends DPO with blockchain metrics for holistic optimization and introduces a comprehensive evaluation methodology for smart contract quality.
Findings
Achieves 66.7% Pass@5 for correctness
Attains 58.9% Gas@5 for efficiency
Reaches 62.5% Secure@5 for security
Abstract
While Large Language Models (LLMs) have demonstrated remarkable progress in generating functionally correct Solidity code, they continue to face critical challenges in producing gas-efficient and secure code, which are critical requirements for real-world smart contract deployment. Although recent advances leverage Supervised Fine-Tuning (SFT) and Direct Preference Optimization (DPO) for code preference alignment, existing approaches treat functional correctness, gas optimization, and security as independent objectives, resulting in contracts that may achieve operational soundness but suffer from prohibitive execution costs or dangerous vulnerabilities. To address these limitations, we propose PrefGen, a novel framework that extends standard DPO beyond human preferences to incorporate quantifiable blockchain-specific metrics, enabling holistic multi-objective optimization specifically…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
