arXiv:2601.06914cs.CRcs.AI2026-01

通过拆解任务提升大模型对智能合约重入漏洞的检测能力。

Towards Compositional Generalization in LLMs for Smart Contract Security: A Case Study on Reentrancy Vulnerabilities

  • 将复杂漏洞检测拆分为四个独立原子任务
  • 合成数据训练后准确率达98.2%,真实合约召回率高20%
  • 适合安全分析与大模型应用研究者参考

大型语言模型(LLMs)在自然语言理解与生成方面表现出色,但在智能合约漏洞检测等专业领域仍不及传统静态分析工具。为此,本文提出一种基于原子任务分解与融合的后训练算法,旨在有限数据下实现组合泛化。具体地,将重入漏洞检测任务分解为四类线性无关的原子任务:识别外部调用、识别状态更新、识别外部调用与状态更新间的数据依赖、确定其数据流顺序。基于此构建核心框架,利用合成数据生成三个经编译器验证的数据集,并通过Slither工具提取控制流图与数据流图结构信息,用于微调LLM适配器。实验表明,采用低秩归一化融合与LoRA适配器后,模型在重入漏洞检测上的准确率达到98.2%,优于现有方法;在31个真实合约上,召回率比传统工具高出20%。

原文摘要 · Abstract (English)

Large language models (LLMs) demonstrate remarkable capabilities in natural language understanding and generation. Despite being trained on large-scale, high-quality data, LLMs still fail to outperform traditional static analysis tools in specialized domains like smart contract vulnerability detection. To address this issue, this paper proposes a post-training algorithm based on atomic task decomposition and fusion. This algorithm aims to achieve combinatorial generalization under limited data by decomposing complex reasoning tasks. Specifically, we decompose the reentrancy vulnerability detection task into four linearly independent atomic tasks: identifying external calls, identifying state updates, identifying data dependencies between external calls and state updates, and determining their data flow order. These tasks form the core components of our approach. By training on synthetic datasets, we generate three compiler-verified datasets. We then employ the Slither tool to extract structural information from the control flow graph and data flow graph, which is used to fine-tune the LLM's adapter. Experimental results demonstrate that low-rank normalization fusion with the LoRA adapter improves the LLM's reentrancy vulnerability detection accuracy to 98.2%, surpassing state-of-the-art methods. On 31 real-world contracts, the algorithm achieves a 20% higher recall than traditional analysis tools.

智能合约漏洞检测大模型组合泛化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。