FORGE: An LLM-driven Framework for Large-Scale Smart Contract Vulnerability Dataset Construction

Jiachi Chen, Yiming Shen, Jiashuo Zhang, Zihao Li, John Grundy, Zhenzhe Shao, Yanlin Wang, Jiashui Wang, Ting Chen, Zibin ZhengarXiv 2025 · DOI

Abstract

FORGE is an automated, LLM-driven framework designed to construct large-scale, high-quality datasets of smart contract vulnerabilities by mining real-world audit reports. By integrating a MapReduce-style extraction pipeline with a "Tree-of-Thoughts" hierarchical classifier, FORGE produced a dataset containing over 27,000 vulnerabilities. This large-scale analysis reveals a significant gap between academic security tools and the actual high-severity threats encountered in the wild.

Introduction

The development of robust security tools for smart contracts is currently hindered by two primary bottlenecks in dataset construction. First, the "Manual Labor Trap" makes dataset creation a grueling, slow process; for instance, the DAppSCAN dataset required 44 person-months to compile just 1,618 vulnerabilities. Second, the "Tower of Babel Problem" refers to the lack of standardized naming conventions among auditors, which complicates benchmarking and machine learning training. FORGE addresses these challenges by automating the extraction and standardization of vulnerabilities using Large Language Models (LLMs).

Methodology: The FORGE Pipeline

FORGE employs a four-phase pipeline to transform unstructured PDF audit reports into a structured, code-linked dataset.

Overview of the FORGE pipeline, illustrating the four main phases: Semantic Chunker, MapReduce Extractor, Hierarchical Classifier, and Code Fetcher.
  1. Semantic Chunker: To handle long reports that exceed LLM context windows, FORGE splits documents based on semantic boundaries like headings and paragraph breaks.
  2. MapReduce Extractor: Utilizing a distributed computing paradigm, the "Map" phase extracts metadata from chunks, while the "Reduce" phase deduplicates and merges them into a single JSON structure.
  3. Hierarchical Classifier (Tree-of-Thoughts): FORGE navigates the Common Weakness Enumeration (CWE) hierarchy step-by-step. This "Tree-of-Thoughts" (ToT) approach, combined with a fallback strategy, ensures accurate classification across over 900 categories.
  4. Code Fetcher: The system automatically retrieves associated Solidity source code by identifying GitHub URLs or on-chain addresses within the reports.

The FORGE Dataset

The resulting FORGE dataset is significantly larger and more modern than existing benchmarks. It encompasses 27,497 vulnerability findings derived from 6,454 real-world audit reports.

Summary statistics of the FORGE dataset, highlighting the scale and compiler version distribution.

Key characteristics include:

  • Scale: 27,497 findings across 81,390 Solidity files.
  • Diversity: Coverage of 296 distinct CWE categories.
  • Modernity: 59% of projects utilize Solidity v0.8+, reflecting current industry standards.

Key Insights and Results

The analysis performed using FORGE highlights a "Research vs. Reality" gap. While academic tools focus on "classic" bugs like Reentrancy, real-world audits are dominated by complex logic errors that these tools often miss. Furthermore, smart contract vulnerabilities differ significantly from traditional web security landscapes (e.g., OWASP Top 10).

In terms of performance, FORGE achieved a precision of 95.6% and a Macro-F1 score of 86.1% in extraction. When benchmarking 13 widely used security tools on this dataset, the results were sobering: the highest F1-score was only 18.59%, with an average of 5.06%. Remarkably, FORGE constructed this massive dataset in just 229.5 hours, a task that would take human experts years.

Limitations and Future Work

Current limitations include modality constraints, as the text-based system may miss information in images or icons. Additionally, the dataset is subject to audit bias, reflecting only what professional auditors identify. Future work may involve developing a specific "CWE for Smart Contracts" sub-taxonomy to further improve classification precision.

Summary updated

BibTeX
@misc{chen2025forge,
  author = {Jiachi Chen and Yiming Shen and Jiashuo Zhang and Zihao Li and John Grundy and Zhenzhe Shao and Yanlin Wang and Jiashui Wang and Ting Chen and Zibin Zheng},
  title = {{FORGE: An LLM-driven Framework for Large-Scale Smart Contract Vulnerability Dataset Construction}},
  year = {2025},
  eprint = {2506.18795},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.18795},
}
Figure