arXiv:2603.27734cs.LGcs.AI2026-03被引 1

用对比学习提升智能合约漏洞检测的抗噪能力

Robust Smart Contract Vulnerability Detection via Contrastive Learning-Enhanced Granular-ball Training

  • 通过粒度球聚类修正标签噪声,生成更鲁棒的合约表示
  • 结合对比学习与对称交叉熵,显著提升在噪声标签下的检测准确率
  • 适合研究智能合约安全或训练数据质量受限的场景

深度神经网络已成为检测智能合约漏洞的主流方法,依赖于大规模标注数据集。然而,实际标注常依赖开源工具,其准确性不可靠,导致标签噪声严重影响模型精度与鲁棒性,该问题在文献中较少被探讨。为此,我们提出对比学习增强的粒度球训练方法(CGBC),以提升检测鲁棒性。CGBC在编码器与分类器间引入粒度球计算层,将相似合约聚类为粒度球(GBs),生成中心点和标签,基于多数正确样本修正噪声标签;结合球间紧凑性损失与球内松散性损失,强化聚类效果。为提升聚类精度,采用新型语义一致的合约增强方法,通过无监督对比学习拉近同类合约表示,辅助聚类。随后使用对称交叉熵损失评估模型质量,缓解梯度计算中的标签噪声影响。大量实验表明,相较于基线方法,CGBC在噪声标签下显著提升了智能合约漏洞检测的鲁棒性与有效性。

原文摘要 · Abstract (English)

Deep neural networks (DNNs) have emerged as a prominent approach for detecting smart contract vulnerabilities, driven by the growing contract datasets and advanced deep learning techniques. However, DNNs typically require large-scale labeled datasets to model the relationships between contract features and vulnerability labels. In practice, the labeling process often depends on existing open-sourced tools, whose accuracy cannot be guaranteed. Consequently, label noise poses a significant challenge for the accuracy and robustness of the smart contract, which is rarely explored in the literature. To this end, we propose Contrastive learning-enhanced Granular-Ball smart Contracts training, CGBC, to enhance the robustness of contract vulnerability detection. Specifically, CGBC first introduces a Granular-ball computing layer between the encoder layer and the classifier layer, to group similar contracts into Granular-Balls (GBs) and generate new coarse-grained representations (i.e., the center and the label of GBs) for them, which can correct noisy labels based on the most correct samples. An inter-GB compactness loss and an intra-GB looseness loss are combined to enhance the effectiveness of clustering. Then, to improve the accuracy of GBs, we pretrain the model through unsupervised contrastive learning supported by our novel semantic-consistent smart contract augmentation method. This procedure can discriminate contracts with different labels by dragging the representation of similar contracts closer, assisting CGBC in clustering. Subsequently, we leverage the symmetric cross-entropy loss function to measure the model quality, which can combat the label noise in gradient computations. Finally, extensive experiments show that the proposed CGBC can significantly improve the robustness and effectiveness of the smart contract vulnerability detection when contrasted with baselines.

智能合约漏洞检测对比学习抗噪

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