Towards Compositional Generalization in LLMs for Smart Contract Security: A Case Study on Reentrancy Vulnerabilities
Ying Zhou, Jiacheng Wei, Yu Qi, Faguo Wu, Xiao Zhang

TL;DR
This paper introduces a novel post-training algorithm that decomposes complex smart contract vulnerability detection tasks into atomic components, significantly improving LLM accuracy and recall in identifying reentrancy vulnerabilities.
Contribution
It presents a new atomic task decomposition and fusion method for LLMs, enhancing their ability to generalize in smart contract security analysis beyond traditional static tools.
Findings
Achieved 98.2% accuracy in reentrancy detection
Surpassed state-of-the-art methods in experimental results
20% higher recall on real-world contracts
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdversarial Robustness in Machine Learning · Blockchain Technology Applications and Security · Artificial Intelligence in Law
