Retrieval Augmented Generation Integrated Large Language Models in Smart Contract Vulnerability Detection
On the map: Retrieval-augmented generation → Privacy and security of RAG
Abstract (arXiv)
The rapid growth of Decentralized Finance (DeFi) has been accompanied by substantial financial losses due to smart contract vulnerabilities, underscoring the critical need for effective security auditing. With attacks becoming more frequent, the necessity and demand for auditing services has escalated. This especially creates a financial burden for independent developers and small businesses, who often have limited available funding for these services. Our study builds upon existing frameworks by integrating Retrieval-Augmented Generation (RAG) with large language models (LLMs), specifically employing GPT-4-1106 for its 128k token context window. We construct a vector store of 830 known vulnerable contracts, leveraging Pinecone for vector storage, OpenAI's text-embedding-ada-002 for embeddings, and LangChain to construct the RAG-LLM pipeline. Prompts were designed to provide a binary answer for vulnerability detection. We first test 52 smart contracts 40 times each against a provided vulnerability type, verifying the replicability and consistency of the RAG-LLM. Encouraging results were observed, with a 62.7% success rate in guided detection of vulnerabilities. Second, we challenge the model under a "blind" audit setup, without the vulnerability type provided in the prompt, wherein 219 contracts undergo 40 tests each. This setup evaluates the general vulnerability detection capabilities without hinted context assistance. Under these conditions, a 60.71% success rate was observed. While the results are promising, we still emphasize the need for human auditing at this time. We provide this study as a proof of concept for a cost-effective smart contract auditing process, moving towards democratic access to security.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Placed in Privacy and security of RAG, one of 15 directions in Retrieval-augmented generation. Builds on 5 of its 19 references that are in the map. First posted on arXiv 20 Jul 2024.
Builds on
5 of 19 references.
References · 5
- 2019Slither: A Static Analysis Framework For Smart Contractscited by 88
- 2023Do you still need a manual smart contract audit?cited by 34
- 2022SoK: Decentralized Finance (DeFi) Attackscited by 28
- 2019A Survey on Ethereum Systems Security: Vulnerabilities, Attacks and Defensescited by 25
- 2017Consensus in the Age of Blockchainscited by 10
Built on by
Citing papers per year: 2025: 3; 2026: 1.
4 papers.
- 2025SmartLLM: Smart Contract Auditing using Custom Generative AIcited by 3
- 2025A Knowledge Graph and a Tripartite Evaluation Framework Make Retrieval-Augmented Generation Scalable and Transparentcited by 1
- 2025ParaVul: A Parallel Large Language Model and Retrieval-Augmented Framework for Smart Contract Vulnerability Detectioncited by 1
- 2026Three Heads Are Better Than One: A Multi-perspective Reasoning Framework for Enhanced Vulnerability Detectioncited by 1
- 2026Three Heads Are Better Than One: A Multi-perspective Reasoning Framework for Enhanced Vulnerability Detection18 May 2026
- 2025ParaVul: A Parallel Large Language Model and Retrieval-Augmented Framework for Smart Contract Vulnerability Detection20 Oct 2025
- 2025A Knowledge Graph and a Tripartite Evaluation Framework Make Retrieval-Augmented Generation Scalable and Transparent23 Sep 2025
- 2025SmartLLM: Smart Contract Auditing using Custom Generative AI17 Feb 2025
Similar, not cited
Close in wording, no citation either way
- 2025SAEL: Leveraging Large Language Models with Adaptive Mixture-of-Experts for Smart Contract Vulnerability Detection
- 2024LLM-SmartAudit: Advanced Smart Contract Vulnerability Detection
- 2026On the Shoulders of Giants: Empowering Automated Smart Contract Auditing via the GiAnt Corpus ↗
- 2025Large Language Model based Smart Contract Auditing with LLMBugScanner
- 2025LLM-BSCVM: An LLM-Based Blockchain Smart Contract Vulnerability Management Framework
- 2025Smart-LLaMA-DPO: Reinforced Large Language Model for Explainable Smart Contract Vulnerability Detection
- 2025Automated Vulnerability Validation and Verification: A Large Language Model Approach
- 2025LLMs as verification oracles for Solidity