paperbot · PL 论文追踪

全部论文 待读 收藏

P2 A Mocktail of Source Code Representations

源代码表示的 Mocktail:融合 AST、CFG 与 PDG 的路径表示
ASE 2021 36th IEEE/ACM International Conference on Automated Software Engineering (ASE)2021匹配度 2/10 · 该论文研究基于 AST/CFG/PDG 路径的源码表示学习,用于方法命名等传统 ML4Code 任务,未涉及 LLM/Agent、ML 系统或 Agentic 程序的静态分析、浮点程序分析或贝叶斯程序分析,与用户核心研究方向交叉较弱。引用 0 inbox
Dheeraj Vagavolu, Karthik Chandra Swarna, Sridhar Chimalakonda
crossref: 2026-09-12

AI 速览

一句话:将 code2vec 的 AST 路径扩展为融合 AST、CFG 与 PDG 路径的源码表示,在方法命名任务上显著提升 F1。

源代码表示对代码分类、克隆检测等任务至关重要,但现有方法多仅用 AST,未充分利用 CFG、PDG 等语义图。本文提出将基于路径的 code2vec 扩展到融合 AST、CFG 与 PDG 路径的“Mocktail”表示,用注意力神经网络学习代码嵌入。作者在从 GitHub 收集的 730K C 方法数据集上评估 METHODNAMING:相比只使用 AST 的 code2vec,完整数据集 F1 提升 11%,单个项目最高提升 100%。结果表明 CFG/PDG 语义路径能大幅改善软件工程任务,并倡导重新审视源码表示组合。

问题
现有源码表示多依赖 AST,未充分利用 CFG、PDG 等语义图;即使有 Code Property Graph,也主要用于安全领域且未利用各图路径。
方法
扩展 code2vec,从 AST、CFG、PDG 分别抽取路径并融合,用注意力神经网络学习代码嵌入,用于下游任务。
评估
在 GitHub 收集的 730K C 方法数据集上评估方法命名,与 code2vec 比较,F1 提升 11%,单项目最高提升 100%。
原文摘要(Abstract)

Efficient representation of source code is essential for various software engineering tasks such as code classification and code clone detection. Most recent approaches for representing source code still use AST and do not leverage semantic graphs such as CFG and PDG. One effective technique for representing source code involves extracting paths from the AST and using a learning model to capture program properties. Code2vec is one such path-based approach that uses an attention-based neural network to learn code embeddings which can then be used for various downstream tasks. However, this approach uses only AST and does not leverage CFG and PDG. Even though an integrated graph approach (Code Property Graph) exists for representing source code, it has only been explored in the domain of software security. Moreover, it does not leverage the paths from the individual graphs. Our idea is to extend the path-based approach code2vec to include the semantic graphs CFG and PDG with AST, which is largely unexplored in software engineering. We evaluate our approach on the task of METHODNAMING using a C dataset of 730K methods collected from GitHub. In comparison to code2vec, our approach improves the F1 score by 11% on the full dataset and up to 100% with individual projects. We show that semantic features from the CFG and PDG paths drastically improve the performance of the software engineering tasks. We envision that looking at a mocktail of source code representations for various software engineering tasks can lay the foundation for a new line of research and a re-haul of existing research.

链接与引用

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

BibTeX
@inproceedings{paperbot6485,
  title = {A Mocktail of Source Code Representations},
  author = {Dheeraj Vagavolu and Karthik Chandra Swarna and Sridhar Chimalakonda},
  booktitle = {ASE},
  year = {2021},
  doi = {10.1109/ase51524.2021.9678551}
}