arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2010.12908cs.AIcs.IRcs.SE
收藏

语义代码检索中的深度图匹配与搜索

Deep Graph Matching and Searching for Semantic Code Retrieval

Zhejiang University(浙江大学);IBM T. J. Watson Research Center(IBM托马斯·J·沃森研究中心);Squirrel AI Learning(松鼠AI学习);Ant Group(蚂蚁集团);Zhejiang Lab(之江实验室)

Xiang Ling, Lingfei Wu, Saizhuo Wang, Gaoning Pan, Tengfei Ma, Fangli Xu, Alex X. Liu, Chunming Wu, Shouling Ji

摘要:

代码检索是从大量的源代码库中找到与查询的自然语言描述高度匹配的代码片段。最近的工作主要使用自然语言处理技术来处理查询文本(即,人类自然语言)和代码片段(即,机器程序设计语言),然而忽略了查询文本和源代码的深层结构化特征,这两者都包含丰富的语义信息。本文提出了一种基于图神经网络的端到端深度图匹配与搜索(DGMS)模型,用于语义代码检索任务。为此,我们首先表示自然语言查询文本和程序设计语言代码片段与统一的图结构的数据,然后使用所提出的图匹配和搜索模型检索最佳匹配的代码片段。特别是,DGMS不仅捕捉更多的结构信息,为个人的查询文本或代码片段,但也学习它们之间的细粒度的相似性,基于交叉注意的语义匹配操作。我们在两个公共代码检索数据集上使用两种代表性的程序设计语言(即,Java和Python)。实验结果表明,DGMS显着优于国家的最先进的基线模型在两个数据集上的大幅度提高。此外,我们广泛的消融研究系统地调查和说明DGMS的每个部分的影响。

英文摘要:

Code retrieval is to find the code snippet from a large corpus of source code repositories that highly matches the query of natural language description. Recent work mainly uses natural language processing techniques to process both query texts (i.e., human natural language) and code snippets (i.e., machine programming language), however neglecting the deep structured features of query texts and source codes, both of which contain rich semantic information. In this paper, we propose an end-to-end deep graph matching and searching (DGMS) model based on graph neural networks for the task of semantic code retrieval. To this end, we first represent both natural language query texts and programming language code snippets with the unified graph-structured data, and then use the proposed graph matching and searching model to retrieve the best matching code snippet. In particular, DGMS not only captures more structural information for individual query texts or code snippets but also learns the fine-grained similarity between them by cross-attention based semantic matching operations. We evaluate the proposed DGMS model on two public code retrieval datasets with two representative programming languages (i.e., Java and Python). Experiment results demonstrate that DGMS significantly outperforms state-of-the-art baseline models by a large margin on both datasets. Moreover, our extensive ablation studies systematically investigate and illustrate the impact of each part of DGMS.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑