MRR-VD: Multi-stage Retrieval-Augmented Reasoning for Smart Contract Vulnerability Detection
Abstract
The rapid advancement of Web 3.0 and blockchain technologies has made smart contract security a fundamental requirement for the reliable operation of blockchain systems. Recently, methods based on large language models (LLMs) combined with Retrieval-Augmented Generation (RAG) have been applied to smart contract vulnerability analysis. However, existing single-stage RAG methods rely on single-round retrieval and lack progressive reasoning capability for vulnerability judgment, making them prone to knowledge interference and semantic confusion. To address this problem, we propose MRR-VD, a multi-stage retrieval-augmented reasoning framework for smart contract vulnerability detection. To the best of our knowledge, MRR-VD is the first work that constructs a hierarchical knowledge base consisting of four layers, namely risk awareness, misjudgment correction, defense reasoning, and judgment cases, and further designs a four-stage RAG reasoning chain. The proposed design enables stepwise vulnerability verification and multi-stage consistency analysis, thereby improving detection accuracy while reducing false positives. Extensive experimental results demonstrate the effectiveness of MRR-VD, which achieves F1 scores of 0.9404 and 0.8457 for reentrancy and access control vulnerability detection, respectively.