Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuning
On the map: Retrieval-augmented generation → Privacy and security of RAG
Abstract (arXiv)
Large Language Models (LLMs) have shown strong capabilities in general-purpose code generation, but their effectiveness in specialized software domains remains underexplored. Solidity smart contracts represent a high-stakes domain where generated code must satisfy strict language-level, security, and software-engineering constraints. Existing benchmarks and metrics remain insufficient for repository-level Solidity generation, where models must synthesize complete contracts from natural language requirements. To address this gap, we introduce SolidityBench, a benchmark of 5,470 repository-level Solidity smart contracts paired with natural language descriptions. We also propose SolidityScore, a Solidity-aware semantic metric that emphasizes domain-critical constructs such as security modifiers, contract declarations, and Solidity-specific keywords. Using this benchmark, we evaluate representative code LLMs, including Qwen2.5-Coder, DeepSeek-Coder, and CodeLlama, across zero-shot prompting, Chain-of-Thought reasoning, in-context learning, retrieval-augmented generation, and supervised fine-tuning. The results show that general-purpose models exhibit systematic structural deficiencies in repository-level Solidity generation. Among non-parametric methods, retrieval-augmented generation performs best, while in-context learning degrades beyond two examples due to context saturation. Supervised fine-tuning achieves the largest improvement by internalizing Solidity-specific constraints into model parameters. Overall, our study provides a comprehensive benchmark for repository-level Solidity code generation and shows that high-quality domain data combined with supervised fine-tuning is the most effective strategy for improving the reliability of LLM-generated smart contracts.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Privacy and security of RAG, one of 15 directions in Retrieval-augmented generation. Builds on 44 of its 77 references that are in the map. First posted on arXiv 18 Jun 2026.
Builds on
44 of 77 references.
References · 44
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2016SGDR: Stochastic Gradient Descent with Warm Restartscited by 5,045
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2024GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projectioncited by 463
32 more
- 2021MetaICL: Learning to Learn In Contextcited by 454
- 2020Fine-Tuning Pretrained Language Models: Weight Initializations, Data Orders, and Early Stoppingcited by 384
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2020On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselinescited by 255
- 2023VeriGen: A Large Language Model for Verilog Code Generationcited by 200
- 2023TACO: Topics in Algorithmic COde generation datasetcited by 160
- 2023CodePlan: Repository-level Coding using LLMs and Planningcited by 140
- 2023Structured Chain-of-Thought Prompting for Code Generationcited by 138
- 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 102
- 2019Slither: A Static Analysis Framework For Smart Contractscited by 89
- 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
- 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generationcited by 44
- 2024Language Models for Code Completion: A Practical Evaluationcited by 39
- 2024A Deep Dive into Large Language Models for Automated Bug Localization and Repaircited by 39
- 2019Empirical Review of Automated Analysis Tools on 47,587 Ethereum Smart Contractscited by 36
- 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Modelscited by 27
- 2023Don't Stop Pretraining? Make Prompt-based Fine-tuning Powerful Learnercited by 23
- 2024InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translationcited by 16
- 2024The Impact of Prompt Programming on Function-Level Code Generationcited by 13
- 2024When Large Language Models Confront Repository-Level Automatic Program Repair: How Well They Done?cited by 12
- 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completioncited by 12
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2020Checking Smart Contracts with Structural Code Embeddingcited by 10
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
- 2025PoCo: Agentic Proof-of-Concept Exploit Generation for Smart Contractscited by 8
- 2019GASOL: Gas Analysis and Optimization for Ethereum Smart Contractscited by 5
- 2025SolEval: Benchmarking Large Language Models for Repository-level Solidity Code Generationcited by 5
- 2024TaskEval: Assessing Difficulty of Code Generation Tasks for Large Language Modelscited by 3
- 2024Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Modelscited by 2
- 2025Retrieval-Augmented Fine-Tuning With Preference Optimization For Visual Program Generationcited by 2
- 2022An Empirical Study on Real Bug Fixes from Solidity Smart Contract Projectscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Beyond Code Similarity: Benchmarking the Plausibility, Efficiency, and Complexity of LLM-Generated Smart Contracts
- 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repair
- 2024PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation
- 2025Securing Smart Contract Languages with a Unified Agentic Framework for Vulnerability Repair in Solidity and Move
- 2026SolAgent: A Specialized Multi-Agent Framework for Solidity Code Generation
- 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimization
- 2026An end-to-end agentic pipeline for smart contract translation and quality evaluation
- 2025ParaVul: A Parallel Large Language Model and Retrieval-Augmented Framework for Smart Contract Vulnerability Detection