Multilayer self‐attention residual network for code search

Author:

Hu Haize12ORCID,Liu Jianxun12,Zhang Xiangping12

Affiliation:

1. School of Computer Science and Technology Hunan University of Science and Technology Xiangtan China

2. Hunan Provincial Key Lab for Services Computing and Novel Software Technology, Hunan University of Science and Technology Xiangtan China

Abstract

SummarySoftware developers usually search existing code snippets in open source code repositories to modify and reuse them. Therefore, how to get the right code snippet from the open‐source code repository quickly and accurately is the focus of current software development research. Nowadays, code search is one of the solutions. To improve the accuracy of source code feature information representation and the accuracy of code search. A multilayer self‐ attention residual network‐based code search model (MSARN‐CS) is proposed in this paper. In the MSARN‐CS model, not only the weight of each word in the code sequence unit is considered but also the effect of embedding between code sequence units is calculated. In addition, an optimization model of residuals is introduced to compensate for the loss of information in the code sequences during the model training. To verify the search effectiveness of the MSARN‐CS model, three other baseline models are compared on the basis of extensive source code data. The experimental results show that the MSARN‐CS model has better search results compared with the baseline model. For parameter Recall@1, the experimental result of MSARN‐CS model was 9.547, which as 100.90%, 73.87%, 60.37%, and 2.55% better compared to CODEnn, CRLCS, SAN‐CS‐ and SAN‐CS, respectively. For the parameter Recall@5, the results improved by 26.67%, 36.23%, 36.21%, and 1.63%, respectively, and for the parameter Recall@10, the results improved by 13.92%, 25.70%, 20.78%, and 2.23%, respectively. For the parameter mean reciprocal rank, the results improved by 52.89%, 76.17%, 63.38%, and 3.88%, respectively. For the parameter normalized discounted cumulative gain, the results improved by 54.22%, 60.55%, 50.28%, and 3.30%, respectively. The MSARN‐CS model proposed in the paper can effectively improve the accuracy of code search and enhance the programming efficiency of developers.

Funder

National Natural Science Foundation of China

Publisher

Wiley

Subject

Computational Theory and Mathematics,Computer Networks and Communications,Computer Science Applications,Theoretical Computer Science,Software

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3