mlsanityData to 14 Oct 2026

CodeBC: A More Secure Large Language Model for Smart Contract Code Generation in Blockchain

arXiv 2504.21043 ↗First posted 28 Apr 2025cs.CR cs.AIcited by 2

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

  1. 2017Attention Is All You Needcited by 60,361
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  3. 2020Language Models are Few-Shot Learnerscited by 32,419
  4. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  5. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  6. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  7. 2022Competition-Level Code Generation with AlphaCodecited by 1,462
  8. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  9. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
  10. 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
  11. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  12. 2022A Systematic Evaluation of Large Language Models of Codecited by 363
20 more
  1. 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
  2. 2022Efficient Training of Language Models to Fill in the Middlecited by 255
  3. 2022Quark: Controllable Text Generation with Reinforced Unlearningcited by 237
  4. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 155
  5. 2022Large Language Models Meet NL2Code: A Surveycited by 138
  6. 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 125
  7. 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 119
  8. 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 111
  9. 2019Slither: A Static Analysis Framework For Smart Contractscited by 89
  10. 2022Natural Language to Code Generation in Interactive Data Science Notebookscited by 87
  11. 2022Compilable Neural Code Generation with Compiler Feedbackcited by 47
  12. 2019Empirical Review of Automated Analysis Tools on 47,587 Ethereum Smart Contractscited by 36
  13. 2018ContractFuzzer: Fuzzing Smart Contracts for Vulnerability Detectioncited by 32
  14. 2018Vandal: A Scalable Security Analysis Framework for Smart Contractscited by 18
  15. 2018Sereum: Protecting Existing Smart Contracts Against Re-Entrancy Attackscited by 17
  16. 2018A Semantic Framework for the Security Analysis of Ethereum smart contractscited by 16
  17. 2020A Survey of Smart Contract Formal Specification and Verificationcited by 14
  18. 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
  19. 2022Summarize and Generate to Back-translate: Unsupervised Translation of Programming Languagescited by 12
  20. 2020Checking Smart Contracts with Structural Code Embeddingcited by 10

Built on by

Cited by year

Citing papers per year: 2025: 2.

2 papers.