mlsanityData to 14 Oct 2026

Repository-Level Solidity Code Generation with Large Language Models: From Prompting to Fine-Tuning

arXiv 2606.19988 ↗First posted 18 Jun 2026cs.SEcited by 0

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

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2016SGDR: Stochastic Gradient Descent with Warm Restartscited by 5,045
  5. 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  7. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  8. 2024A Survey on Large Language Models for Code Generationcited by 658
  9. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 654
  10. 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
  11. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  12. 2024GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projectioncited by 463
32 more
  1. 2021MetaICL: Learning to Learn In Contextcited by 454
  2. 2020Fine-Tuning Pretrained Language Models: Weight Initializations, Data Orders, and Early Stoppingcited by 384
  3. 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
  4. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  5. 2020On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselinescited by 255
  6. 2023VeriGen: A Large Language Model for Verilog Code Generationcited by 200
  7. 2023TACO: Topics in Algorithmic COde generation datasetcited by 160
  8. 2023CodePlan: Repository-level Coding using LLMs and Planningcited by 140
  9. 2023Structured Chain-of-Thought Prompting for Code Generationcited by 138
  10. 2023CodeBERTScore: Evaluating Code Generation with Pretrained Models of Codecited by 102
  11. 2019Slither: A Static Analysis Framework For Smart Contractscited by 89
  12. 2023Grammar Prompting for Domain-Specific Language Generation with Large Language Modelscited by 58
  13. 2023On the Effectiveness of Large Language Models in Domain-Specific Code Generationcited by 44
  14. 2024Language Models for Code Completion: A Practical Evaluationcited by 39
  15. 2024A Deep Dive into Large Language Models for Automated Bug Localization and Repaircited by 39
  16. 2019Empirical Review of Automated Analysis Tools on 47,587 Ethereum Smart Contractscited by 36
  17. 2023Chain-of-Thought in Neural Code Generation: From and For Lightweight Language Modelscited by 27
  18. 2023Don't Stop Pretraining? Make Prompt-based Fine-tuning Powerful Learnercited by 23
  19. 2024InterTrans: Leveraging Transitive Intermediate Translations to Enhance LLM-based Code Translationcited by 16
  20. 2024The Impact of Prompt Programming on Function-Level Code Generationcited by 13
  21. 2024When Large Language Models Confront Repository-Level Automatic Program Repair: How Well They Done?cited by 12
  22. 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completioncited by 12
  23. 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
  24. 2020Checking Smart Contracts with Structural Code Embeddingcited by 10
  25. 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
  26. 2025PoCo: Agentic Proof-of-Concept Exploit Generation for Smart Contractscited by 8
  27. 2019GASOL: Gas Analysis and Optimization for Ethereum Smart Contractscited by 5
  28. 2025SolEval: Benchmarking Large Language Models for Repository-level Solidity Code Generationcited by 5
  29. 2024TaskEval: Assessing Difficulty of Code Generation Tasks for Large Language Modelscited by 3
  30. 2024Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Modelscited by 2
  31. 2025Retrieval-Augmented Fine-Tuning With Preference Optimization For Visual Program Generationcited by 2
  32. 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

  1. 2025Beyond Code Similarity: Benchmarking the Plausibility, Efficiency, and Complexity of LLM-Generated Smart Contracts
  2. 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repair
  3. 2024PropertyGPT: LLM-driven Formal Verification of Smart Contracts through Retrieval-Augmented Property Generation
  4. 2025Securing Smart Contract Languages with a Unified Agentic Framework for Vulnerability Repair in Solidity and Move
  5. 2026SolAgent: A Specialized Multi-Agent Framework for Solidity Code Generation
  6. 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimization
  7. 2026An end-to-end agentic pipeline for smart contract translation and quality evaluation
  8. 2025ParaVul: A Parallel Large Language Model and Retrieval-Augmented Framework for Smart Contract Vulnerability Detection