paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Learning Graph-based Code Representations for Source-level Functional Similarity Detection

学习基于图的代码表示用于源码级功能相似性检测
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 3/10 · 该论文属于PL与机器学习交叉的代码表示学习,使用CPG和GNN做功能相似性检测,与代码分析/程序表示有一定关联;但它不涉及LLM/Agent、静态分析在ML系统/Agentic程序中的应用、浮点程序分析或贝叶斯程序分析,与用户当前核心研究方向匹配度较低。引用 49 inbox
Jiahao Liu, Jun Zeng, Xiang Wang, Zhenkai Liang
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出 Tailor,用 CPG 与定制 GNN 学习深度图结构代码表示,提升源码功能相似性检测。

功能相似的代码片段可能语法不同,导致检测困难。已有工作将程序依赖作为语义线索,但多关注局部邻域(如一跳依赖),限制了功能语义的表达能力。本文提出 Tailor,将源码程序表示为结合抽象语法树、控制流图和数据流图的代码属性图(CPG),并设计面向 CPG 结构的图神经网络 CPGNN,在图上迭代传播信息以学习深度图结构特征;相较直接套用现成 GNN,该方法更贴合 CPG 结构。作者在 C 和 Java 程序上使用两个公开基准进行系统评估。结果表明,Tailor 优于现有最佳方法,在代码克隆检测中 F-score 分别达到 99.8% 和 99.9%,在源码分类中准确率达到 98.3%。

问题
如何检测语法不同但功能相似的源码,并克服现有依赖表示仅关注局部邻域、语义表达有限的问题。
方法
将源码程序转化为结合 AST、控制流图和数据流图的 CPG,并用定制的 CPGNN 在图结构上迭代传播信息以学习代码表示。
评估
在 C 和 Java 程序的两个公开基准上,针对代码克隆检测和源码分类任务,与现有最佳方法进行对比评估。
原文摘要(Abstract)

Detecting code functional similarity forms the basis of various software engineering tasks. However, the detection is challenging as functionally similar code fragments can be implemented differently, e.g., with irrelevant syntax. Recent studies incorporate program dependencies as semantics to identify syntactically different yet semantically similar programs, but they often focus only on local neighborhoods (e.g., one-hop dependencies), limiting the expressiveness of program semantics in modeling functionalities. In this paper, we present Tailor that explicitly exploits deep graph-structured code features for functional similarity detection. Given source-level programs, Tailor first represents them into code property graphs (CPGs) - which combine abstract syntax trees, control flow graphs, and data flow graphs - to collectively reason about program syntax and semantics. Then, Tailor learns representations of CPGs by applying a CPG-based neural network (CPGNN) to iteratively propagate information on them. It improves over prior work on code representation learning through a new graph neural network (GNN) tailored to CPG structures instead of the off-the-shelf GNNs used previously. We systematically evaluate Tailor on C and Java programs using two public benchmarks. Experimental results show that Tailor outperforms the state-of-the-art approaches, achieving 99.8% and 99.9% F-scores in code clone detection and 98.3% accuracy in source code classification.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{LiuZWL23,
  title = {Learning Graph-based Code Representations for Source-level Functional Similarity Detection},
  author = {Jiahao Liu and Jun Zeng and Xiang Wang and Zhenkai Liang},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00040}
}