paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Detecting Semantic Code Clones by Building AST-based Markov Chains Model

通过构建基于AST的马尔可夫链模型检测语义代码克隆
ASE Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering2022匹配度 3/10 · 该论文属于程序分析(AST)与机器学习交叉的代码克隆检测,和“机器学习与程序语言”有弱关联;但它不涉及LLM/Agent、ML系统或Agentic程序的静态分析、浮点程序分析、贝叶斯程序分析等核心方向。引用 23 inbox
Yueming Wu, Siyue Feng, Deqing Zou, Hai Jin
crossref: 2026-09-12

AI 速览

一句话:提出 Amain,将复杂 AST 转化为马尔可夫链并度量状态距离,实现可扩展的语义代码克隆检测。

代码克隆检测旨在发现功能相似的代码片段,在软件工程中日益重要。基于树的方法虽能处理语义克隆,但树结构复杂,难以扩展到大规模型代码。本文提出 Amain,一种可扩展的基于树的语义克隆检测器:将原始复杂树转化为简单的马尔可夫链,度量链中所有状态之间的距离,再以这些距离值作为特征训练机器学习分类器,从而构建克隆检测器。作者在 Google Code Jam 与 BigCloneBench 两个常用数据集上评估 Amain,实验表明其优于九种最先进工具(SourcererCC、RtvNN、Deckard、ASTNN、TBCNN、CDLH、FCCA、DeepSim、SCDetector)。

问题
基于树的代码克隆检测方法能够处理语义克隆,但复杂树结构导致其难以扩展到大规模型代码。
方法
提出 Amain:将原始复杂树转化为简单马尔可夫链,度量链中所有状态的距离,并将距离值输入机器学习分类器训练克隆检测器。
评估
在 Google Code Jam 和 BigCloneBench 两个数据集上评估,与九种现有最先进克隆检测工具对比,Amain 表现更优。
原文摘要(Abstract)

Code clone detection aims to find functionally similar code fragments, which is becoming more and more important in the field of software engineering. Many code clone detection methods have been proposed, among which tree-based methods are able to handle semantic code clones. However, these methods are difficult to scale to big code due to the complexity of tree structures. In this paper, we design Amain, a scalable tree-based semantic code clone detector by building Markov chains models. Specifically, we propose a novel method to transform the original complex tree into simple Markov chains and measure the distance of all states in these chains. After obtaining all distance values, we feed them into a machine learning classifier to train a code clone detector. To examine the effectiveness of Amain, we evaluate it on two widely used datasets namely Google Code Jam and BigCloneBench. Experimental results show that Amain is superior to nine state-of-the-art code clone detection tools (i.e., SourcererCC, RtvNN, Deckard, ASTNN, TBCNN, CDLH, FCCA, DeepSim, and SCDetector).

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot7343,
  title = {Detecting Semantic Code Clones by Building AST-based Markov Chains Model},
  author = {Yueming Wu and Siyue Feng and Deqing Zou and Hai Jin},
  booktitle = {ASE},
  year = {2022},
  doi = {10.1145/3551349.3560426}
}