Few-shot smart contract vulnerability detection based on Longformer pre-training
The Computer Journal · 09.11.2026
DOI: 10.1093/comjnl/bxag115 ↗Kurz gefasst
Fachartikel in der Zeitschrift The Computer Journal, online erschienen am 09.11.2026. Verfasst von Haikuo Li und 6 weiteren Autor:innen. Die Arbeit nennt 51 Literaturangaben. Gefördert von: National Key Research and Development Program.
Abstract (Originalsprache)
Smart contracts are widely deployed on blockchains, managing substantial assets and sensitive information. However, potential vulnerabilities pose significant threats to fund security and data privacy. Traditional detection methods heavily rely on expert-crafted rules, resulting in limited performance and scalability. Deep learning-based approaches, though promising, struggle with poor transferability, difficulties in modeling long-range dependencies, and a strong reliance on large-scale labeled vulnerability datasets. To mitigate these challenges, we propose LPSCV, a bytecode-level vulnerability detection framework based on Longformer pre-training. The framework learns generalizable contract representations and can adapt to various vulnerability detection tasks with only a limited number of vulnerable contracts. Specifically, by analyzing the structural characteristics of extensive contracts, we design a sequence enhancement method that incorporates topological information. Then, we adopt the RoBERTa model using the Longformer architecture to handle long contract sequences. A tailored pre-training task is employed to capture long-distance dependencies and learn transferable global representations. Furthermore, we present a fine-tuning strategy for few-shot vulnerability detection tasks to achieve efficient and accurate detection. LPSCV is evaluated on a real-world contract dataset covering seven types of vulnerability under 5-shot, 10-shot, and 20-shot settings and compared with 11 state-of-the-art approaches. The results show that LPSCV outperforms all baselines.
Förderung
- National Key Research and Development Program
Zitieren
APA
Li, H., Xiong, G., Yang, C., Chen, Z., Wu, Y., Gou, G., & Li, Z. (2026). Few-shot smart contract vulnerability detection based on Longformer pre-training. The Computer Journal. https://doi.org/10.1093/comjnl/bxag115
Vancouver
Li H, Xiong G, Yang C, Chen Z, Wu Y, Gou G, et al. Few-shot smart contract vulnerability detection based on Longformer pre-training. The Computer Journal. 2026. doi:10.1093/comjnl/bxag115
BibTeX
@article{Li2026,
author = {Li, Haikuo and Xiong, Gang and Yang, Chen and Chen, Ziqian and Wu, Yanbo and Gou, Gaopeng and Li, Zhen},
title = {Few-shot smart contract vulnerability detection based on Longformer pre-training},
journal = {The Computer Journal},
year = {2026},
doi = {10.1093/comjnl/bxag115}
}
EUVIMED