mlsanityData to 14 Oct 2026

Smart-LLaMA-DPO: Reinforced Large Language Model for Explainable Smart Contract Vulnerability Detection

arXiv 2506.18245 ↗First posted 23 Jun 2025cs.CR cs.AI cs.SEcited by 7

On the map: LLM alignment / RLHF / preference optimisation → Safety alignment and jailbreak attacks

Abstract (arXiv)

Smart contract vulnerability detection remains a major challenge in blockchain security. Existing vulnerability detection methods face two main issues: (1) Existing datasets lack comprehensive coverage and high-quality explanations for preference learning. (2) Large language models (LLMs) often struggle with accurately interpreting specific concepts in smart contract security. Empirical analysis shows that even after continual pre-training (CPT) and supervised fine-tuning (SFT), LLMs may misinterpret the execution order of state changes, resulting in incorrect explanations despite making correct detection decisions. To address these challenges, we propose Smart-LLaMA-DPO based on LLaMA-3.1-8B. We construct a comprehensive dataset covering four major vulnerability types and machine-unauditable vulnerabilities, including precise labels, explanations, and locations for SFT, as well as high-quality and low-quality output pairs for Direct Preference Optimization (DPO). Second, we perform CPT using large-scale smart contract to enhance the LLM's understanding of specific security practices in smart contracts. Futhermore, we conduct SFT with our comprehensive dataset. Finally, we apply DPO, leveraging human feedback and a specially designed loss function that increases the probability of preferred explanations while reducing the likelihood of non-preferred outputs. We evaluate Smart-LLaMA-DPO on four major vulnerability types: reentrancy, timestamp dependence, integer overflow/underflow, and delegatecall, as well as machine-unauditable vulnerabilities. Our method significantly outperforms state-of-the-art baselines, with average improvements of 10.43% in F1 score and 7.87% in accuracy. Moreover, both LLM evaluation and human evaluation confirm that our method generates more correct, thorough, and clear explanations.

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Placed in Safety alignment and jailbreak attacks, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 34 of its 78 references that are in the map. First posted on arXiv 23 Jun 2025.

Builds on

34 of 78 references.

References · 34

  1. 2024The Llama 3 Herd of Modelscited by 14,715
  2. 2016Semi-Supervised Classification with Graph Convolutional Networkscited by 11,361
  3. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
  4. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
  5. 2024Qwen2 Technical Reportcited by 2,120
  6. 2024LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Modelscited by 1,464
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  8. 2018The Adverse Effects of Code Duplication in Machine Learning Models of Codecited by 126
  9. 2019Slither: A Static Analysis Framework For Smart Contractscited by 89
  10. 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
  11. 2018Securify: Practical Security Analysis of Smart Contractscited by 61
  12. 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 59
22 more
  1. 2023When ChatGPT Meets Smart Contract Vulnerability Detection: How Far Are We?cited by 42
  2. 2024Combining Fine-Tuning and LLM-based Agents for Intuitive Smart Contract Auditing with Justificationscited by 41
  3. 2023Do you still need a manual smart contract audit?cited by 35
  4. 2019A Survey on Ethereum Systems Security: Vulnerabilities, Attacks and Defensescited by 25
  5. 2021Smart Contract Vulnerability Detection: From Pure Neural Network to Interpretable Graph Feature and Expert Pattern Fusioncited by 24
  6. 2020sFuzz: An Efficient Adaptive Fuzzer for Solidity Smart Contractscited by 19
  7. 2020SmartBugs: A Framework to Analyze Solidity Smart Contractscited by 18
  8. 2021Faults in Deep Reinforcement Learning Programs: A Taxonomy and A Detection Approachcited by 18
  9. 2023Efficient Avoidance of Vulnerabilities in Auto-completed Smart Contract Code Using Vulnerability-constrained Decodingcited by 14
  10. 2024IRCoCo: Immediate Rewards-Guided Deep Reinforcement Learning for Code Completioncited by 13
  11. 2021Deep Reinforcement Learning for Black-Box Testing of Android Appscited by 10
  12. 2021SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in Secondscited by 10
  13. 2023Rethinking Smart Contract Fuzzing: Fuzzing With Invocation Ordering and Important Branch Revisitingcited by 10
  14. 2024DeepREST: Automated Test Case Generation for REST APIs Exploiting Deep Reinforcement Learningcited by 8
  15. 2024Smart-LLaMA: Two-Stage Post-Training of Large Language Models for Smart Contract Vulnerability Detection and Explanationcited by 8
  16. 2019Security Analysis Methods on Ethereum Smart Contract Vulnerabilities: A Surveycited by 7
  17. 2023RLocator: Reinforcement Learning for Bug Localizationcited by 7
  18. 2023Adaptive REST API Testing with Reinforcement Learningcited by 7
  19. 2017Blockchain-based Smart Contracts: A Systematic Mapping Studycited by 5
  20. 2019SmartEmbed: A Tool for Clone and Bug Detection in Smart Contracts through Structural Code Embeddingcited by 4
  21. 2018EASYFLOW: Keep Ethereum Away From Overflowcited by 3
  22. 2023Language Models are Better Bug Detector Through Code-Pair Classificationcited by 3

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 6.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025ParaVul: A Parallel Large Language Model and Retrieval-Augmented Framework for Smart Contract Vulnerability Detection
  2. 2025LLM-BSCVM: An LLM-Based Blockchain Smart Contract Vulnerability Management Framework
  3. 2024LLM-SmartAudit: Advanced Smart Contract Vulnerability Detection
  4. 2025Large Language Model based Smart Contract Auditing with LLMBugScanner
  5. 2025ETrace:Event-Driven Vulnerability Detection in Smart Contracts via LLM-Based Trace Analysis
  6. 2026Benchmarking Zero-Shot Reasoning Approaches for Error Detection in Solidity Smart Contracts
  7. 2024Detection Made Easy: Potentials of Large Language Models for Solidity Vulnerabilities
  8. 2024Retrieval Augmented Generation Integrated Large Language Models in Smart Contract Vulnerability Detection