paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DSFM: Enhancing Functional Code Clone Detection with Deep Subtree Interactions

DSFM:通过深度子树交互增强功能代码克隆检测
ICSE Proceedings of the IEEE/ACM 46th International Conference on Software Engineering2024匹配度 2/10 · 论文研究基于深度学习的代码克隆检测,虽属机器学习与程序语言交叉,但未涉及用户核心关注的 LLM/Agent 用于静态分析、ML 系统或 Agentic 程序的静态分析、浮点程序分析或贝叶斯程序分析等方向。引用 8 inbox
Zhiwei Xu, Shaohua Qiang, Dinghong Song, Min Zhou, Hai Wan, Xibin Zhao, Ping Luo, Hongyu Zhang
crossref: 2026-09-12

AI 速览

一句话:提出 DSFM,通过比较代码 AST 的深度子树交互引入细粒度语义相似性,提升功能代码克隆检测性能。

功能代码克隆检测对软件维护很重要。现有深度学习方法常把代码片段压缩为单一语义向量,过于依赖特征学习,难以显式比较 token 交集、相似流图或相似子树等结构信息。本文提出 DSFM,在典型深度克隆检测器中引入深度子树交互:从两个代码片段的 AST 中提取子树并两两比较,从而获得更细粒度的语义相似度以判定功能克隆。作者在 GCJ、OJClone 和 BigCloneBench 三个数据集上实验,结果表明 DSFM 优于两种传统方法、两种无监督方法和四种有监督深度学习方法等强基线,展示了深度子树交互在代码克隆检测中的潜力。

问题
现有基于深度学习的函数/功能代码克隆检测器过度关注代码特征学习,倾向于将代码片段投影为单一向量,未充分利用句法克隆检测中显式比较代码结构信息的优势。
方法
DSFM 在深度克隆检测器中加入深度子树交互,对两个代码片段 AST 中提取的每两棵子树进行比较,引入更细粒度的语义相似度用于功能代码克隆检测。
评估
在 GCJ、OJClone 和 BigCloneBench 三个常用数据集上开展实验,并与两种传统方法、两种无监督方法和四种有监督深度学习方法等基线比较。
原文摘要(Abstract)

Functional code clone detection is important for software maintenance. In recent years, deep learning techniques are introduced to improve the performance of functional code clone detectors. By representing each code snippet as a vector containing its program semantics, syntactically dissimilar functional clones are detected. However, existing deep learning-based approaches attach too much importance to code feature learning, hoping to project all recognizable knowledge of a code snippet into a single vector. We argue that these deep learning-based approaches can be enhanced by considering the characteristics of syntactic code clone detection, where we need to compare the contents of the source code (e.g., intersection of tokens, similar flow graphs, and similar subtrees) to obtain code clones. In this paper, we propose a novel deep learning-based approach named DSFM, which incorporates comparisons between code snippets for detecting functional code clones. Specifically, we improve the typical deep clone detectors with deep subtree interactions that compare every two subtrees extracted abstract syntax trees (ASTs) of two code snippets, thereby introducing more fine-grained semantic similarity. By conducting extensive experiments on three widely-used datasets, GCJ, OJClone, and BigCloneBench, we demonstrate the great potential of deep subtree interactions in code clone detection task. The proposed DSFM outperforms the state-of-the-art approaches, including two traditional approaches, two unsupervised and four supervised deep learning-based baselines.

链接与引用

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

BibTeX
@inproceedings{paperbot11343,
  title = {DSFM: Enhancing Functional Code Clone Detection with Deep Subtree Interactions},
  author = {Zhiwei Xu and Shaohua Qiang and Dinghong Song and Min Zhou and Hai Wan and Xibin Zhao and Ping Luo and Hongyu Zhang},
  booktitle = {ICSE},
  year = {2024},
  doi = {10.1145/3597503.3639215}
}