Siambert:基于Siamese bert的代码搜索

Francisco J. Pena, Angel Luis Gonzalez, Sepideh Pashami, A. Al-Shishtawy, A. H. Payberah
{"title":"Siambert:基于Siamese bert的代码搜索","authors":"Francisco J. Pena, Angel Luis Gonzalez, Sepideh Pashami, A. Al-Shishtawy, A. H. Payberah","doi":"10.1109/sais55783.2022.9833051","DOIUrl":null,"url":null,"abstract":"Code Search is a practical tool that helps developers navigate growing source code repositories by connecting natural language queries with code snippets. Platforms such as StackOverflow resolve coding questions and answers; however, they cannot perform a semantic search through the code. Moreover, poorly documented code adds more complexity to search for code snippets in repositories. To tackle this challenge, this paper presents Siambert, a BERT-based model that gets the question in natural language and returns relevant code snippets. The Siambert architecture consists of two stages, where the first stage, inspired by Siamese Neural Network, returns the top K relevant code snippets to the input questions, and the second stage ranks the given snippets by the first stage. The experiments show that Siambert outperforms non-BERT-based models having improvements that range from 12% to 39% on the Recall@1 metric and improves the inference time performance, making it 15x faster than standard BERT models.","PeriodicalId":228143,"journal":{"name":"2022 Swedish Artificial Intelligence Society Workshop (SAIS)","volume":"32 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-06-13","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Siambert: Siamese Bert-based Code Search\",\"authors\":\"Francisco J. Pena, Angel Luis Gonzalez, Sepideh Pashami, A. Al-Shishtawy, A. H. Payberah\",\"doi\":\"10.1109/sais55783.2022.9833051\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"Code Search is a practical tool that helps developers navigate growing source code repositories by connecting natural language queries with code snippets. Platforms such as StackOverflow resolve coding questions and answers; however, they cannot perform a semantic search through the code. Moreover, poorly documented code adds more complexity to search for code snippets in repositories. To tackle this challenge, this paper presents Siambert, a BERT-based model that gets the question in natural language and returns relevant code snippets. The Siambert architecture consists of two stages, where the first stage, inspired by Siamese Neural Network, returns the top K relevant code snippets to the input questions, and the second stage ranks the given snippets by the first stage. The experiments show that Siambert outperforms non-BERT-based models having improvements that range from 12% to 39% on the Recall@1 metric and improves the inference time performance, making it 15x faster than standard BERT models.\",\"PeriodicalId\":228143,\"journal\":{\"name\":\"2022 Swedish Artificial Intelligence Society Workshop (SAIS)\",\"volume\":\"32 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2022-06-13\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2022 Swedish Artificial Intelligence Society Workshop (SAIS)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/sais55783.2022.9833051\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2022 Swedish Artificial Intelligence Society Workshop (SAIS)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/sais55783.2022.9833051","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

代码搜索是一种实用的工具,它通过将自然语言查询与代码片段连接起来,帮助开发人员浏览不断增长的源代码存储库。像StackOverflow这样的平台可以解决编码问题和答案;但是,它们不能通过代码执行语义搜索。此外,缺乏文档的代码增加了在存储库中搜索代码片段的复杂性。为了解决这一挑战,本文提出了Siambert,一个基于bert的模型,它以自然语言获取问题并返回相关的代码片段。Siambert架构由两个阶段组成,其中第一阶段受Siamese Neural Network的启发,将前K个相关代码片段返回给输入问题,第二阶段根据第一阶段对给定的代码片段进行排名。实验表明,Siambert在Recall@1指标上的改进幅度从12%到39%不等,优于非基于BERT的模型,并提高了推理时间性能,使其比标准BERT模型快15倍。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Siambert: Siamese Bert-based Code Search
Code Search is a practical tool that helps developers navigate growing source code repositories by connecting natural language queries with code snippets. Platforms such as StackOverflow resolve coding questions and answers; however, they cannot perform a semantic search through the code. Moreover, poorly documented code adds more complexity to search for code snippets in repositories. To tackle this challenge, this paper presents Siambert, a BERT-based model that gets the question in natural language and returns relevant code snippets. The Siambert architecture consists of two stages, where the first stage, inspired by Siamese Neural Network, returns the top K relevant code snippets to the input questions, and the second stage ranks the given snippets by the first stage. The experiments show that Siambert outperforms non-BERT-based models having improvements that range from 12% to 39% on the Recall@1 metric and improves the inference time performance, making it 15x faster than standard BERT models.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信