NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectives

Sihao Hu, Tiansheng Huang, Fatih Ilhan, Selim Furkan Tekin, Ling Liu · DOI

Introduction

Smart contracts are immutable once deployed on a blockchain, making them high-stakes targets for exploitation. Traditional vulnerability detection tools, such as Slither, often rely on predefined patterns and expert-crafted rules. While effective for known issues, these tools frequently miss novel or complex logic-based vulnerabilities.

Large Language Models (LLMs) like GPT-4 offer a promising alternative due to their advanced reasoning capabilities. However, they face a significant "Catch-22" dilemma: increasing the model's randomness (temperature) helps discover elusive bugs but simultaneously generates a flood of false positives—hallucinated or non-exploitable issues that require intensive manual verification. This paper introduces GPTLENS, a two-stage adversarial framework designed to maximize vulnerability discovery while effectively filtering out false alarms.

Methodology: The GPTLENS Framework

GPTLENS moves away from conventional one-shot detection, employing a synergistic two-stage process that decouples the generation of potential bugs from their evaluation.

Stage 1: Generation (The Auditor)

In the first stage, multiple LLM "auditor" agents independently review the smart contract code. These agents are prompted to be creative and broad in their analysis. By utilizing higher temperatures and multiple sampling passes, the framework increases the probability that a true vulnerability is included within the candidate list, even if it is buried among incorrect findings.

Stage 2: Discrimination (The Critic)

A separate LLM "critic" agent then scrutinizes the auditor's output. The critic evaluates each identified bug based on three primary factors: correctness (logic verification), severity (impact), and profitability (exploitability). This stage acts as a sophisticated filter, ranking vulnerabilities and discarding factual errors or non-severe issues.

The GPTLENS framework architecture, illustrating the two-stage process from smart contract input to ranked top-k results.

Experimental Evaluation

The framework was evaluated using a dataset of 13 real-world smart contracts from Etherscan, each containing at least one vulnerability documented in the Common Vulnerabilities and Exposures (CVE) database. This ground-truth data allowed researchers to measure the system's ability to identify actual exploits.

Key Results

The experimental results demonstrate that the Auditor-Critic synergy provides a substantial performance boost over standard one-stage detection methods:

  • Hit Ratio Improvement: A single-stage LLM auditor (A) identified the correct CVE in only 38.5% of the contracts. With the addition of the Critic (A+C), the hit ratio increased to 76.9%.
  • Trial-level Accuracy: At the individual trial level, GPTLENS improved accuracy from 33.3% to 59.0%.
  • Comparison to Oracle: The Critic-based filtering performed nearly as well as an "Oracle" (A+O) baseline that used ground-truth knowledge to select the best answer, indicating that the LLM is highly effective at self-correction.
Performance comparison of different detection methods across 13 CVE-labeled smart contracts, highlighting the hit ratio improvements achieved by the Auditor-Critic (A+C) setup.

Discussion and Insights

  • The Randomness Trade-off: The research confirms that generating multiple samples with higher randomness significantly boosts the probability of finding a correct answer, provided a robust discrimination stage is in place to manage the resulting noise.
  • Generality and Interpretability: Unlike pattern-matching tools, LLMs can detect "unknown unknowns" by emulating human-like understanding of code intent. Furthermore, the use of "Chain-of-Thought" reasoning provides developers with clear explanations of why a piece of code is considered a risk.
  • Categorizing False Positives: The paper distinguishes between "Factual Errors" (misunderstanding syntax/logic) and "Potential Vulnerabilities" (real bugs that lack exploitability). The Critic is specifically optimized to differentiate these categories.

Conclusion and Future Work

While GPTLENS represents a significant step forward, challenges remain regarding token constraints for large contracts and the computational cost of multiple LLM passes. Future research may explore integrating external static analysis tools as plugins to combine formal precision with LLM reasoning, as well as more sophisticated prompt engineering to ensure diverse auditor perspectives.

Summary updated

BibTeX
@inproceedings{hu2023large,
  author = {Sihao Hu and Tiansheng Huang and Fatih Ilhan and Selim Furkan Tekin and Ling Liu},
  title = {{Large Language Model-Powered Smart Contract Vulnerability Detection: New Perspectives}},
  booktitle = {TPS-ISA},
  year = {2023},
  doi = {10.1109/tps-isa58951.2023.00044},
}
Figure