mlsanityData to 7 Oct 2026

Smart-LLaMA: Two-Stage Post-Training of Large Language Models for Smart Contract Vulnerability Detection and Explanation

arXiv 2411.06221 ↗First posted 9 Nov 2024cs.CR cs.AI cs.SEcited by 8

Not on the map. Why?

Abstract (arXiv)

With the rapid development of blockchain technology, smart contract security has become a critical challenge. Existing smart contract vulnerability detection methods face three main issues: (1) Insufficient quality of datasets, lacking detailed explanations and precise vulnerability locations. (2) Limited adaptability of large language models (LLMs) to the smart contract domain, as most LLMs are pre-trained on general text data but minimal smart contract-specific data. (3) Lack of high-quality explanations for detected vulnerabilities, as existing methods focus solely on detection without clear explanations. These limitations hinder detection performance and make it harder for developers to understand and fix vulnerabilities quickly, potentially leading to severe financial losses. To address these problems, we propose Smart-LLaMA, an advanced detection method based on the LLaMA language model. First, we construct a comprehensive dataset covering four vulnerability types with labels, detailed explanations, and precise vulnerability locations. Second, we introduce Smart Contract-Specific Continual Pre-Training, using raw smart contract data to enable the LLM to learn smart contract syntax and semantics, enhancing their domain adaptability. Furthermore, we propose Explanation-Guided Fine-Tuning, which fine-tunes the LLM using paired vulnerable code and explanations, enabling both vulnerability detection and reasoned explanations. We evaluate explanation quality through LLM and human evaluation, focusing on Correctness, Completeness, and Conciseness. Experimental results show that Smart-LLaMA outperforms state-of-the-art baselines, with average improvements of 6.49% in F1 score and 3.78% in accuracy, while providing reliable explanations.

Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). Builds on 26 of its 50 references that are in the map. First posted on arXiv 9 Nov 2024.

Builds on

26 of 50 references.

References · 26

  1. 2024The Llama 3 Herd of Modelscited by 14,192
  2. 2016Semi-Supervised Classification with Graph Convolutional Networkscited by 11,282
  3. 2024Qwen2 Technical Reportcited by 2,076
  4. 2024LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Modelscited by 1,442
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  6. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  7. 2023A Comprehensive Overview of Large Language Modelscited by 639
  8. 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
  9. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 123
  10. 2019Slither: A Static Analysis Framework For Smart Contractscited by 88
  11. 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
  12. 2018Securify: Practical Security Analysis of Smart Contractscited by 61
14 more
  1. 2023Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectivescited by 48
  2. 2023When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?cited by 42
  3. 2019Manticore: A User-Friendly Symbolic Execution Framework for Binaries and Smart Contractscited by 36
  4. 2023Do you still need a manual smart contract audit?cited by 34
  5. 2019A Survey on Ethereum Systems Security: Vulnerabilities, Attacks and Defensescited by 25
  6. 2021Smart Contract Vulnerability Detection: From Pure Neural Network to Interpretable Graph Feature and Expert Pattern Fusioncited by 24
  7. 2020SmartBugs: A Framework to Analyze Solidity Smart Contractscited by 18
  8. 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
  9. 2023Rethinking Smart Contract Fuzzing: Fuzzing With Invocation Ordering and Important Branch Revisitingcited by 9
  10. 2019Security Analysis Methods on Ethereum Smart Contract Vulnerabilities: A Surveycited by 7
  11. 2024Improving Smart Contract Security with Contrastive Learning-based Vulnerability Detectioncited by 7
  12. 2017Blockchain-based Smart Contracts: A Systematic Mapping Studycited by 5
  13. 2019SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embeddingcited by 4
  14. 2018EASYFLOW: Keep Ethereum Away From Overflowcited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 5; 2026: 3.

8 papers.