当前位置: X-MOL 学术J. Syst. Softw. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Neural joint attention code search over structure embeddings for software Q&A sites
Journal of Systems and Software ( IF 3.7 ) Pub Date : 2020-12-01 , DOI: 10.1016/j.jss.2020.110773
Gang Hu , Min Peng , Yihan Zhang , Qianqian Xie , Mengting Yuan

Abstract Code search is frequently needed in software Q&A sites for software development. Over the years, various code search engines and techniques have been explored to support user query. Early approaches often utilize text retrieval models to match textual code fragments for natural query, but fail to build sufficient semantic correlations. Some recent advanced neural methods focus on restructuring bi-modal networks to measure the semantic similarity. However, they ignore potential structure information of source codes and the joint attention information from natural queries. In addition, they mostly focus on specific code structures, rather than general code fragments in software Q&A sites. In this paper, we propose NJACS, a novel two-way attention-based neural network for retrieving code fragments in software Q&A sites, which aligns and focuses the more structure informative parts of source codes to natural query. Instead of directly learning bi-modal unified vector representations, NJACS first embeds the queries and codes using a bidirectional LSTM with pre-trained structure embeddings separately, then learns an aligned joint attention matrix for query-code mappings, and finally derives the pooling-based projection vectors in different directions to guide the attention-based representations. On different benchmark search codebase collected from StackOverflow, NJACS outperforms state-of-art baselines with 7.5% to 6% higher Recall@1 and MRR, respectively. Moreover, our designed structure embeddings can be leveraged for other deep-learning-based software tasks.

中文翻译:

软件问答网站结构嵌入的神经联合注意代码搜索

摘要 软件开发的软件问答网站经常需要代码搜索。多年来,已经探索了各种代码搜索引擎和技术来支持用户查询。早期的方法通常利用文本检索模型来匹配自然查询的文本代码片段,但未能建立足够的语义相关性。最近的一些高级神经方法侧重于重构双模态网络以测量语义相似性。然而,他们忽略了源代码的潜在结构信息和来自自然查询的联合注意信息。此外,他们主要关注特定的代码结构,而不是软件问答站点中的通用代码片段。在本文中,我们提出了 NJACS,一种新颖的基于双向注意力的神经网络,用于在软件问答站点中检索代码片段,它将源代码的更多结构信息部分对齐并集中到自然查询中。NJACS 不是直接学习双模态统一向量表示,而是首先使用具有预训练结构嵌入的双向 LSTM 分别嵌入查询和代码,然后学习对齐的联合注意矩阵进行查询代码映射,最后推导出基于池化的不同方向的投影向量来指导基于注意力的表示。在从 StackOverflow 收集的不同基准搜索代码库中,NJACS 分别以 7.5% 到 6% 的 Recall@1 和 MRR 优于最先进的基线。此外,我们设计的结构嵌入可用于其他基于深度学习的软件任务。NJACS 不是直接学习双模态统一向量表示,而是首先使用具有预训练结构嵌入的双向 LSTM 分别嵌入查询和代码,然后学习对齐的联合注意矩阵进行查询代码映射,最后推导出基于池化的不同方向的投影向量来指导基于注意力的表示。在从 StackOverflow 收集的不同基准搜索代码库中,NJACS 分别以 7.5% 到 6% 的 Recall@1 和 MRR 优于最先进的基线。此外,我们设计的结构嵌入可用于其他基于深度学习的软件任务。NJACS 不是直接学习双模态统一向量表示,而是首先使用具有预训练结构嵌入的双向 LSTM 分别嵌入查询和代码,然后学习对齐的联合注意矩阵进行查询代码映射,最后推导出基于池化的不同方向的投影向量来指导基于注意力的表示。在从 StackOverflow 收集的不同基准搜索代码库中,NJACS 分别以 7.5% 到 6% 的 Recall@1 和 MRR 优于最先进的基线。此外,我们设计的结构嵌入可用于其他基于深度学习的软件任务。然后学习一个对齐的联合注意力矩阵用于查询代码映射,最后导出不同方向的基于池化的投影向量来指导基于注意力的表示。在从 StackOverflow 收集的不同基准搜索代码库中,NJACS 分别以 7.5% 到 6% 的 Recall@1 和 MRR 优于最先进的基线。此外,我们设计的结构嵌入可用于其他基于深度学习的软件任务。然后学习一个对齐的联合注意力矩阵用于查询代码映射,最后导出不同方向的基于池化的投影向量来指导基于注意力的表示。在从 StackOverflow 收集的不同基准搜索代码库中,NJACS 分别以 7.5% 到 6% 的 Recall@1 和 MRR 优于最先进的基线。此外,我们设计的结构嵌入可用于其他基于深度学习的软件任务。
更新日期:2020-12-01
down
wechat
bug