Smart-LLaMA: Two-Stage Post-Training of Large Language Models for Smart Contract Vulnerability Detection and Explanation
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
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2016Semi-Supervised Classification with Graph Convolutional Networkscited by 11,282
- 2024Qwen2 Technical Reportcited by 2,076
- 2024LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Modelscited by 1,442
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2023A Comprehensive Overview of Large Language Modelscited by 639
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 123
- 2019Slither: A Static Analysis Framework For Smart Contractscited by 88
- 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
- 2018Securify: Practical Security Analysis of Smart Contractscited by 61
14 more
- 2023Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectivescited by 48
- 2023When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?cited by 42
- 2019Manticore: A User-Friendly Symbolic Execution Framework for Binaries and Smart Contractscited by 36
- 2023Do you still need a manual smart contract audit?cited by 34
- 2019A Survey on Ethereum Systems Security: Vulnerabilities, Attacks and Defensescited by 25
- 2021Smart Contract Vulnerability Detection: From Pure Neural Network to Interpretable Graph Feature and Expert Pattern Fusioncited by 24
- 2020SmartBugs: A Framework to Analyze Solidity Smart Contractscited by 18
- 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
- 2023Rethinking Smart Contract Fuzzing: Fuzzing With Invocation Ordering and Important Branch Revisitingcited by 9
- 2019Security Analysis Methods on Ethereum Smart Contract Vulnerabilities: A Surveycited by 7
- 2024Improving Smart Contract Security with Contrastive Learning-based Vulnerability Detectioncited by 7
- 2017Blockchain-based Smart Contracts: A Systematic Mapping Studycited by 5
- 2019SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embeddingcited by 4
- 2018EASYFLOW: Keep Ethereum Away From Overflowcited by 3
Built on by
Citing papers per year: 2025: 5; 2026: 3.
8 papers.
- 2025Smart-LLaMA-DPO: Reinforced Large Language Model for Explainable Smart Contract Vulnerability Detectioncited by 7
- 2025Towards Practical Defect-Focused Automated Code Reviewcited by 3
- 2025SAEL: Leveraging Large Language Models with Adaptive Mixture-of-Experts for Smart Contract Vulnerability Detectioncited by 2
- 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimizationcited by 1
- 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repaircited by 0
- 2026Benchmarking Zero-Shot Reasoning Approaches for Error Detection in Solidity Smart Contractscited by 0
- 2026Decoupled Smart Contract Audits: Lightweight LLM Framework via Distillation and Aggregationcited by 0
- 2026Towards Secure Cloud-Native Computing: Unveiling Kubernetes Misconfigurations with Large Language Modelscited by 0
- 2026Towards Secure Cloud-Native Computing: Unveiling Kubernetes Misconfigurations with Large Language Models25 Jul 2026
- 2026Decoupled Smart Contract Audits: Lightweight LLM Framework via Distillation and Aggregation2 Jun 2026
- 2026Benchmarking Zero-Shot Reasoning Approaches for Error Detection in Solidity Smart Contracts17 Feb 2026
- 2025Towards Secure and Explainable Smart Contract Generation with Security-Aware Group Relative Policy Optimization12 Sep 2025
- 2025SAEL: Leveraging Large Language Models with Adaptive Mixture-of-Experts for Smart Contract Vulnerability Detection30 Jul 2025
- 2025Smart-LLaMA-DPO: Reinforced Large Language Model for Explainable Smart Contract Vulnerability Detection23 Jun 2025
- 2025Towards Practical Defect-Focused Automated Code Review23 May 2025
- 2025Towards Automated Smart Contract Generation: Evaluation, Benchmarking, and Retrieval-Augmented Repair3 Mar 2025