paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Tritor: Detecting Semantic Code Clones by Building Social Network-Based Triads Model

Tritor:基于社交网络三元组模型的语义代码克隆检测
FSE Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering2023匹配度 3/10 · 论文属于传统机器学习与程序分析交叉的代码克隆检测,虽涉及程序分析/抽象语法树,但与用户核心方向(Agentic/ML系统静态分析、LLM/Agent改进静态分析或形式化验证、浮点程序分析、贝叶斯程序分析)仅有较弱关联,且未使用LLM/Agent或针对上述特定分析对象。引用 6 inbox
Deqing Zou, Siyue Feng, Yueming Wu, Wenqi Suo, Hai Jin
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出基于语义增强AST与社交网络三元组模型的机器学习代码克隆检测器Tritor

代码克隆检测旨在发现代码片段间的功能相似性,对软件维护和安全至关重要,因为克隆会抬高维护成本并传播漏洞。现有树基方法虽能检测语义克隆,但树结构复杂,难以扩展至大规模检测。本文提出可扩展的语义代码克隆检测器Tritor:在抽象语法树中加入控制流与数据流细节,将增强后的树视为社交网络,并构建基于社交网络的三元组模型,通过分析不同类型三元组来收集两段代码间的相似性特征;随后利用这些特征训练机器学习克隆检测器。对比实验表明,Tritor优于SourcererCC、RtvNN、Deckard、ASTNN、TBCNN、CDLH和SCDetector,与DeepSim和FCCA效果相当;在可扩展性上,Tritor约比当前最先进的树基检测器ASTNN快39倍。

问题
代码克隆会提高维护成本并传播漏洞,而现有树基语义克隆检测方法因树结构复杂,难以应用于大规模克隆检测。
方法
将控制流和数据流信息加入原始抽象语法树,把增强树建模为社交网络,通过分析不同类型三元组提取相似性特征,并训练机器学习代码克隆检测器Tritor。
评估
与SourcererCC、RtvNN、Deckard、ASTNN、TBCNN、CDLH、SCDetector、DeepSim和FCCA进行对比实验,Tritor在检测效果上优于多数基线、与DeepSim和FCCA相当,且约比ASTNN快39倍。
原文摘要(Abstract)

Code clone detection refers to finding the functional similarities between two code fragments, which is becoming increasingly important with the evolution of software engineering. It is reasonable because code cloning can increase maintenance costs and even cause the propagation of vulnerabilities, which can have a negative impact on software security. Numbers of code clone detection methods have been proposed, including tree-based methods that are capable of detecting semantic code clones. However, since tree structure is complex, these methods are difficult to apply to large-scale clone detection. In this paper, we propose a scalable semantic code clone detector based on semantically enhanced abstract syntax tree. Specifically, we add the control flow and data flow details into the original tree and regard the enhanced tree as a social network. Then we build a social network-based triads model to collect the similarity features between the two methods by analyzing different types of triads within the network. After obtaining all features, we use them to train a machine learning-based code clone detector (i.e., Tritor). Our comparative experimental results show that Tritor is superior to SourcererCC, RtvNN, Deckard, ASTNN, TBCNN, CDLH, and SCDetector, are equally good with DeepSim and FCCA. As for scalability, Tritor is about 39 times faster than another current state-of-the-art tree-based code clone detector ASTNN.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{ZouFWS023,
  title = {Tritor: Detecting Semantic Code Clones by Building Social Network-Based Triads Model},
  author = {Deqing Zou and Siyue Feng and Yueming Wu and Wenqi Suo and Hai Jin},
  booktitle = {FSE},
  year = {2023},
  doi = {10.1145/3611643.3616354}
}