Pruning Attention Heads Based on Semantic and Code Structure for Smart Contract Vulnerability Detection

Along with the sustained occurrence of black swan events in the decentralized application ecosystem, smart contract security is a growing concern. Traditional solutions mainly rely on predefined rules, while highly accurate, require intensive manual code analysis. Machine learning methods (mainly based on BERT) leverage semantic and contextual information, but overlook crucial code structure features, which are critical for identifying vulnerability. Furthermore, the presence of useless or harmful attention heads in the BERT model leads to less robust predictions and slows down processing speeds. We propose a novel method named Pruning attention Heads based on Semantic and Code Structure (PHSCS) for Smart Contract Vulnerability Detection. Specifically, we introduce a new structure-aware pre-training programming language task, Variable Edge Prediction, which bypasses the use of data flow nodes as input and directly predicts data flow edges between variables, aiming to efficiently learn code structure while ensuring the ability to process extensive code. Additionally, we present a pruning strategy to optimize BERT, tailored to the semantic and structural peculiarities of code. By employing Taylor Expansion for evaluating attention heads' significance and guiding their pruning, iteratively refined the BERT model. Experiment results on 8 vulnerability types illustrate that the PHSCS method surpasses state-of-the-art methods.

Authors

Institutions

Publication Details

Journal
IEEE Transactions on Dependable and Secure Computing
Published
2025-09-09
DOI
https://doi.org/10.1109/tdsc.2025.3607471
Primary Topic
Cybercrime and Law Enforcement Studies
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Pruning Attention Heads Based on Semantic and Code Structure for Smart Contract Vulnerability Detection

Teng Ouyang, Shen Su, Siyu Jiang, Yuwen Chen et al.
IEEE Transactions on Dependable and Secure Computing
Cybercrime and Law Enforcement Studies
article

Pruning Attention Heads Based on Semantic and Code Structure for Smart Contract Vulnerability Detection

Teng Ouyang, Shen Su, Siyu Jiang, Yuwen Chen, Xue Zhang
article en

Abstract

Along with the sustained occurrence of black swan events in the decentralized application ecosystem, smart contract security is a growing concern. Traditional solutions mainly rely on predefined rules, while highly accurate, require intensive manual code analysis. Machine learning methods (mainly based on BERT) leverage semantic and contextual information, but overlook crucial code structure features, which are critical for identifying vulnerability. Furthermore, the presence of useless or harmful attention heads in the BERT model leads to less robust predictions and slows down processing speeds. We propose a novel method named Pruning attention Heads based on Semantic and Code Structure (PHSCS) for Smart Contract Vulnerability Detection. Specifically, we introduce a new structure-aware pre-training programming language task, Variable Edge Prediction, which bypasses the use of data flow nodes as input and directly predicts data flow edges between variables, aiming to efficiently learn code structure while ensuring the ability to process extensive code. Additionally, we present a pruning strategy to optimize BERT, tailored to the semantic and structural peculiarities of code. By employing Taylor Expansion for evaluating attention heads' significance and guiding their pruning, iteratively refined the BERT model. Experiment results on 8 vulnerability types illustrate that the PHSCS method surpasses state-of-the-art methods.

IEEE Transactions on Dependable and Secure ComputingVol. 23(1)
Guangdong University of Foreign Studies (CN), Guangzhou University (CN)
Openalex Percentile: Top 64%
Cybercrime and Law Enforcement Studies
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Pruning Attention Heads Based on Semantic and Code Structure for Smart Contract Vulnerability Detection — Teng Ouyang, Shen Su, et al. · IEEE Transactions on Dependable and Secure Computing (2025) | TGRS Research Map | TGRS