paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Multi-modal Attention Network Learning for Semantic Source Code Retrieval

面向语义源代码检索的多模态注意力网络学习
ASE 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE)2019匹配度 3/10 · 该论文属于基于深度学习的代码检索与程序表示学习,虽使用AST/CFG等程序结构,但不涉及静态分析、Agentic程序、LLM与程序分析交叉、浮点程序分析或贝叶斯程序分析等核心方向,也非问题驱动或工业落地研究。引用 8 inbox
Yao Wan, Jingdong Shu, Yulei Sui, Guandong Xu, Zhou Zhao, Jian Wu, Philip Yu
crossref: 2026-09-12

AI 速览

一句话:提出MMAN,用LSTM、Tree-LSTM和GGNN编码代码token、AST与CFG,并通过多模态注意力融合提升代码检索准确率。

代码检索旨在根据自然语言查询从大规模开源仓库中返回可用代码片段。现有方法多依赖方法名、代码token等浅层特征,忽略AST、CFG等富含语义的结构化特征,且深度学习表示缺乏可解释性。本文提出MMAN多模态注意力网络:用LSTM编码顺序token,用Tree-LSTM编码AST,用GGNN编码CFG;再通过多模态注意力融合层为各模态的不同部分分配权重,整合为统一混合表示。在大型真实数据集上的实验表明,MMAN能准确检索代码片段并优于现有最优方法,注意力权重也有助于理解不同模态对检索结果的贡献。

问题
面向自然语言查询从大规模代码库中准确检索代码片段,现有方法忽略AST、CFG等结构化语义特征,且深度表示缺乏可解释性。
方法
提出MMAN,分别用LSTM、Tree-LSTM和GGNN建模代码token序列、AST和CFG,并通过多模态注意力融合层赋权整合为统一表示。
评估
在大型真实世界数据集上进行实验与分析,与现有最优方法比较,验证代码检索准确率及各模态贡献。
原文摘要(Abstract)

Code retrieval techniques and tools have been playing a key role in facilitating software developers to retrieve existing code fragments from available open-source repositories given a user query (e.g., a short natural language text describing the functionality for retrieving a particular code snippet). Despite the existing efforts in improving the effectiveness of code retrieval, there are still two main issues hindering them from being used to accurately retrieve satisfiable code fragments from large-scale repositories when answering complicated queries. First, the existing approaches only consider shallow features of source code such as method names and code tokens, but ignoring structured features such as abstract syntax trees (ASTs) and control-flow graphs (CFGs) of source code, which contains rich and well-defined semantics of source code. Second, although the deep learning-based approach performs well on the representation of source code, it lacks the explainability, making it hard to interpret the retrieval results and almost impossible to understand which features of source code contribute more to the final results. To tackle the two aforementioned issues, this paper proposes MMAN, a novel Multi-Modal Attention Network for semantic source code retrieval. A comprehensive multi-modal representation is developed for representing unstructured and structured features of source code, with one LSTM for the sequential tokens of code, a Tree-LSTM for the AST of code and a GGNN (Gated Graph Neural Network) for the CFG of code. Furthermore, a multi-modal attention fusion layer is applied to assign weights to different parts of each modality of source code and then integrate them into a single hybrid representation. Comprehensive experiments and analysis on a large-scale real-world dataset show that our proposed model can accurately retrieve code snippets and outperforms the state-of-the-art methods.

链接与引用

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

BibTeX
@inproceedings{paperbot5207,
  title = {Multi-modal Attention Network Learning for Semantic Source Code Retrieval},
  author = {Yao Wan and Jingdong Shu and Yulei Sui and Guandong Xu and Zhou Zhao and Jian Wu and Philip Yu},
  booktitle = {ASE},
  year = {2019},
  doi = {10.1109/ase.2019.00012}
}