CodeBC: A More Secure Large Language Model for Smart Contract Code Generation in Blockchain
Not on the map. Why?
Abstract (arXiv)
Large language models (LLMs) excel at generating code from natural language instructions, yet they often lack an understanding of security vulnerabilities. This limitation makes it difficult for LLMs to avoid security risks in generated code, particularly in high-security programming tasks such as smart contract development for blockchain. Researchers have attempted to enhance the vulnerability awareness of these models by training them to differentiate between vulnerable and fixed code snippets. However, this approach relies heavily on manually labeled vulnerability data, which is only available for popular languages like Python and C++. For low-resource languages like Solidity, used in smart contracts, large-scale annotated datasets are scarce and difficult to obtain. To address this challenge, we introduce CodeBC, a code generation model specifically designed for generating secure smart contracts in blockchain. CodeBC employs a three-stage fine-tuning approach based on CodeLlama, distinguishing itself from previous methods by not relying on pairwise vulnerability location annotations. Instead, it leverages vulnerability and security tags to teach the model the differences between vulnerable and secure code. During the inference phase, the model leverages security tags to generate secure and robust code. Experimental results demonstrate that CodeBC outperforms baseline models in terms of BLEU, CodeBLEU, and compilation pass rates, while significantly reducing vulnerability rates. These findings validate the effectiveness and cost-efficiency of our three-stage fine-tuning strategy, making CodeBC a promising solution for generating secure smart contract code.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 32 of its 47 references that are in the map. First posted on arXiv 28 Apr 2025.
Builds on
32 of 47 references.
References · 32
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Competition-Level Code Generation with AlphaCodecited by 1,462
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
- 2022A Systematic Evaluation of Large Language Models of Codecited by 363
20 more
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
- 2022Efficient Training of Language Models to Fill in the Middlecited by 255
- 2022Quark: Controllable Text Generation with Reinforced Unlearningcited by 237
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
- 2022Large Language Models Meet NL2Code: A Surveycited by 138
- 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 125
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 111
- 2019Slither: A Static Analysis Framework For Smart Contractscited by 89
- 2022Natural Language to Code Generation in Interactive Data Science Notebookscited by 87
- 2022Compilable Neural Code Generation with Compiler Feedbackcited by 47
- 2019Empirical Review of Automated Analysis Tools on 47,587 Ethereum Smart Contractscited by 36
- 2018ContractFuzzer: Fuzzing Smart Contracts for Vulnerability Detectioncited by 32
- 2018Vandal: A Scalable Security Analysis Framework for Smart Contractscited by 18
- 2018Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attackscited by 17
- 2018A Semantic Framework for the Security Analysis of Ethereum smart contractscited by 16
- 2020A Survey of Smart Contract Formal Specification and Verificationcited by 14
- 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
- 2022Summarize and Generate to Back-translate: Unsupervised Translation of Programming Languagescited by 12
- 2020Checking Smart Contracts with Structural Code Embeddingcited by 10
Built on by
Citing papers per year: 2025: 2.
2 papers.