paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Hunting bugs with accelerated optimal graph vertex matching

用加速的最优图顶点匹配搜寻缺陷
ISSTA Proceedings of the 31st ACM SIGSOFT International Symposium on Software Testing and Analysis2022匹配度 3/10 · 论文属于机器学习辅助代码缺陷检测/代码图相似性方向,与“PL+ML”有弱交叉;但未涉及用户核心关注的 Agentic/ML 系统静态分析、LLM 改进静态分析/形式化验证、浮点程序分析或贝叶斯程序分析。其 GCN+顶点匹配加速偏工程启发式,理论形式化较弱,因此匹配度较低。引用 6 inbox
Xiaohui Zhang, Yuanjun Gong, Bin Liang, Jianjun Huang, Wei You, Wenchang Shi, Jian Zhang
crossref: 2026-09-12

AI 速览

一句话:用嵌入模型预筛候选、GCN 求近似最优顶点匹配的两阶段加速方法,缓解噪声干扰并高效检测代码缺陷。

基于代码相似度的缺陷检测常将代码片段视为图并比较相似度,但缺陷逻辑常只涉及少量语句,其余语句成为噪声,严重干扰相似度度量。最优顶点匹配理论上可解决,但该任务 NP 完全,难以扩展至大规模代码库。为此,本文提出两阶段加速策略:第一阶段训练顶点匹配嵌入模型,从目标代码库快速筛选出与已知缺陷种子匹配度较高的少量候选代码图;第二阶段基于图卷积神经网络构建高阶相似度嵌入模型,高效求得近似最优的顶点匹配并计算图相似度以识别潜在缺陷代码。在五个开源项目上共发现 31 个未知缺陷并获开发者确认,检测效率提升数十倍。

问题
基于代码图的相似度比较来检测缺陷时,缺陷相关语句往往只占少数,其余无关语句构成噪声,严重干扰相似度度量;理论上的最优顶点匹配虽能缓解该问题,但是 NP 完全,无法直接应用于大规模代码库。
方法
提出两阶段加速的顶点匹配策略:先用顶点匹配嵌入模型从目标代码库预筛出与已知缺陷种子可能高度匹配的少量候选代码图,再用基于图卷积神经网络的高阶相似度嵌入模型高效求解种子与候选间的近似最优顶点匹配,并据此计算图相似度判定潜在缺陷代码。
评估
在五个开源项目上应用该方法,共检测到 31 个此前未知的缺陷并获得开发者确认;对比实验表明该方法能有效缓解噪声干扰,两阶段策略使检测效率提升数十倍。
原文摘要(Abstract)

Various techniques based on code similarity measurement have been proposed to detect bugs. Essentially, the code fragment can be regarded as a kind of graph. Performing code graph similarity comparison to identify the potential bugs is a natural choice. However, the logic of a bug often involves only a few statements in the code fragment, while others are bug-irrelevant. They can be considered as a kind of noise, and can heavily interfere with the code similarity measurement. In theory, performing optimal vertex matching can address the problem well, but the task is NP-complete and cannot be applied to a large-scale code base. In this paper, we propose a two-phase strategy to accelerate code graph vertex matching for detecting bugs. In the first phase, a vertex matching embedding model is trained and used to rapidly filter a limited number of candidate code graphs from the target code base, which are likely to have a high vertex matching degree with the seed, i.e., the known buggy code. As a result, the number of code graphs needed to be further analyzed is dramatically reduced. In the second phase, a high-order similarity embedding model based on graph convolutional neural network is built to efficiently get the approximately optimal vertex matching between the seed and candidates. On this basis, the code graph similarity is calculated to identify the potential buggy code. The proposed method is applied to five open source projects. In total, 31 unknown bugs were successfully detected and confirmed by developers. Comparative experiments demonstrate that our method can effectively mitigate the noise problem, and the detection efficiency can be improved dozens of times with the two-phase strategy.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot7388,
  title = {Hunting bugs with accelerated optimal graph vertex matching},
  author = {Xiaohui Zhang and Yuanjun Gong and Bin Liang and Jianjun Huang and Wei You and Wenchang Shi and Jian Zhang},
  booktitle = {ISSTA},
  year = {2022},
  doi = {10.1145/3533767.3534393}
}