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

GenDetect: Generative Large Language Model Usage in Smart Contract Vulnerability Detection

Peter Ince, Jiangshan Yu, Joseph K. Liu, Xiaoning Du, Xiapu LuoProvSec 2025

Introduction

Smart contracts are the backbone of decentralized finance, operating under the principle of "code is law." Once deployed to a blockchain, they are immutable and often manage millions of dollars in assets. Consequently, security vulnerabilities can lead to catastrophic, irreversible losses. Traditional security tools generally fall into two categories: Static Analysis, which is fast but prone to false positives, and Dynamic Analysis/Symbolic Execution, which is accurate but computationally expensive and slow.

Both traditional approaches struggle with "nuanced logic vulnerabilities"—bugs that are not simple syntax errors but flaws in the intended business logic. With the rise of Generative Large Language Models (LLMs), researchers have explored their potential to bridge this gap. This paper provides a systematic review and rigorous benchmarking of LLM-based tools against industry standards like Slither and Mythril to determine if AI is ready to take the lead in blockchain security.

Landscape of LLM-based Auditing

The researchers surveyed 22 recent papers and selected 9 LLM-based tools for deep evaluation. These tools utilize a variety of specialization techniques to adapt general-purpose models to the specific domain of Solidity programming and smart contract security.

Overview of LLM-based tools for smart contract vulnerability detection, including base models and specialization techniques.

The techniques identified include:

  • Prompt-tuning: Utilizing Chain-of-Thought (CoT) and In-Context Learning (ICL) to guide the model's reasoning process.
  • Supervised Fine-tuning (SFT): Training models like Llama or CodeLlama on curated, labeled datasets of audited contracts.
  • Multi-Agent Analysis: Deploying multiple LLM "personas"—such as a "Hacker" agent to find exploits and an "Auditor" agent to verify them—to reduce hallucinations through internal debate.
  • Hybrid Approaches: Using LLMs to guide traditional tools, such as prioritizing code paths for fuzzers.
  • Domain-Specific Pre-training: Training smaller models from scratch on Solidity-specific data, which often yields better results than using larger, general-purpose models.

Benchmarking Performance

To evaluate these tools, the authors used a dataset of 609 vulnerable contracts containing 1,117 vulnerabilities across ten distinct types, such as Reentrancy (RE), Integer Overflow (IO), and DelegateCall (DC). Crucially, this dataset was selected to minimize "data contamination," ensuring the models were not simply recalling bugs they had seen during training.

Performance comparison (F1 Score highlighted) across various vulnerability types for LLM tools and traditional scanners.

The results reveal that LLMs and traditional tools have complementary strengths. LLMs excelled at detecting Transaction Order Dependency (TOD) and Integer Overflows, where traditional tools often failed. For instance, in the DelegateCall (DC) category, the LLM-based GPTLens achieved an F1 score of 0.83, significantly outperforming Slither (0.54) and Mythril (0.38). Conversely, traditional static analysis (Slither) remained superior at catching Frozen Ether (FE) and Unchecked Calls (UC), where most LLMs struggled.

Speed, Cost, and Practicality

In terms of operational efficiency, LLMs occupy a middle ground. They are significantly faster than symbolic execution tools like Mythril (which averaged 430 seconds per contract) but remain much slower than static analysis tools like Slither (0.57 seconds).

Cost-effectiveness is a growing advantage for LLMs. By utilizing optimized models like GPT-4o-mini for token-intensive tasks, tools like LLMSmartAudit were able to analyze the entire benchmark dataset for under $10. However, this efficiency is balanced against the "hallucination tax"—multi-agent systems reduce errors but increase token usage and runtime.

Limitations and Future Directions

Despite their promise, LLMs face several hurdles before they can replace human auditors or traditional tools:

  1. Context Window Constraints: Large DeFi protocols often exceed the token limits of current models, requiring researchers to truncate code and potentially miss cross-contract vulnerabilities.
  2. Inconsistency: Unlike the deterministic nature of Slither or Mythril, LLM outputs can vary between runs, which is a significant drawback for formal security audits.
  3. Hybrid Future: The most effective path forward appears to be hybrid analysis. Rather than standalone detectors, LLMs are best used to provide guidance to traditional dynamic tools, helping them navigate complex logic paths that were previously unreachable.

The authors conclude that while LLMs are not yet ready to be the sole line of defense, they are becoming an indispensable part of a multi-layered security stack.

Summary updated

BibTeX
@inproceedings{ince2025gendetect,
  author = {Peter Ince and Jiangshan Yu and Joseph K. Liu and Xiaoning Du and Xiapu Luo},
  title = {{GenDetect: Generative Large Language Model Usage in Smart Contract Vulnerability Detection}},
  booktitle = {ProvSec},
  year = {2025},
  doi = {10.1007/978-981-95-2961-2\_22},
}

Loading related content...

Figure