DOI: 10.3390/computers15070413 ISSN: 2073-431X

NAPO-SCVD: Noise-Aware Preference Reinforcement Large Language Model for Smart Contract Vulnerability Detection

Dianjun Xie, Wenai Song, Biaokai Zhu, Ruize Guo, Yiran Li

As the core automated execution components of blockchain technology, smart contracts enable programmatic control over digital assets; however, their immutable characteristics and inherent logical vulnerabilities give rise to substantial security risks. Although smart contract vulnerability detection methods based on large language models (LLMs) have exhibited certain potential in vulnerability detection and explanation, the coarse-grained modeling of traditional binary preference optimization paradigms hinders the model ability to learn the priority of domain-specific requirements, frequently leading to extreme optimization at the cost of detection accuracy. Furthermore, existing approaches fail to consider non-ideal factors in real-world application scenarios and overlook noise interference induced by missing prompts, which results in inadequate detection stability and reliability, making them challenging to adapt to complex practical scenarios. To address these critical issues, this study proposes a Noise-Aware Preference Reinforcement Large Language Model for Smart Contract Vulnerability Detection (NAPO-SCVD). This method adopts a four-stage framework consisting of data construction, continuous pre-training, supervised fine-tuning, and noise-aware preference optimization. Specifically, it enhances the model’s comprehension of contract syntax and semantics through domain-specific pre-training, improves its detection and explanation capabilities using high-quality datasets, constructs deliberately guided biased explanations to simulate noisy samples, refines preference gradients, and strengthens the model’s anti-interference ability. Consequently, this approach achieves high-precision and high-reliability smart contract vulnerability detection, along with fine-grained explanations.

More from our Archive