arrow
Return

Query-oriented two-stage attention-based model for code search

delete2024-04-01
delete2
PRE
AI
H
Huanhuan Yang
徐玲 cover
徐玲 (Ling Xu) *
C
Chao Liu
L
Luwen Huangfu
DOI:10.1016/j.jss.2023.111948delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Applying code search models to search through a large-scale codebase can significantly contribute to developers finding and reusing existing code. Researchers have applied deep learning (DL) techniques to code search models, which first compute deeper semantics representation for query and candidate code snippets, and then rank code snippets. However, these models do not well deeply analyze the semantics gap (i.e., the difference and correlation between queries written in natural language and code in programming languages), or suitably apply the correlation to the code search task. Moreover, most DL -based models use complex networks, slowing down code search tasks. To build the correlation of two languages, and apply the correlation well to code search task, we propose a query-oriented code search model named QobCS. QobCS leverage two attention-based stages, which are simple and quick, and the cooperation of the two stages bridges the semantic gap between code and query. Stage1 learns deeper semantics representation for code and query. Stage2 applies their deeper semantic correlation and query's intention to learn better code representation. We evaluated QobCS on two datasets. On dataset1/dataset2 with 485k/542k code snippets, QobCS achieves the MRRs of 0.701/0.595, outperforming DL -based code search models DeepCS, CARLCS-CNN, UNIF, and our prior study TabCS. For efficiency, our model shows desirable performances on both datasets compared to DL -based models.
Keywords:
Code search
Attention mechanism
Query-oriented attention mechanism
Code structural feature

Journal

Journal of Systems and Software cover
Journal of Systems and Software
IF:
4.1
Papers:
5.5K
Citations:
8.4K

Organization

California State University System cover
California State University System
Scholars:
2.8W
Papers: 2.4W
Citations: 457
C
Chongqing University
Scholars:
5.1W
Papers: 4.1W
Citations: 6.0W
Cited Papers

Cited Papers

Thermodynamics study on the generation of electricity via CO2-mineralization cell
err2015-08-23
err0
errOAAI
errHeping Xie; Wen Jiang; Yufei Wang; Tao Liu; Ruilin Wang; Bin Liang; Yang He; Jinlong Wang; Liang Tang; Jinwei Chen
errShare
errSave
errShare
errSave
Enriching query semantics for code search with reinforcement learning
err2022-01-01
err21
errOAAI
errWang, Chaozheng; Nong, Zhenhao; Gao, Cuiyun; Li, Zongjie; Zeng, Jichuan; Xing, Zhenchang; Liu, Yang
errShare
errSave
errShare
errSave
errShare
errSave
Deep Graph Matching and Searching for Semantic Code Retrieval
err2021-05-10
err65
errOAAI
errLing, Xiang; Wu, Lingfei; Wang, Saizhuo; Pan, Gaoning; Ma, Tengfei; Xu, Fangli; Liu, Alex X.; Wu, Chunming; Ji, Shouling
errShare
errSave
Electron Transmission through Coordinating Atoms Embedded in Metal-Organic Nanoporous Networks
err2019-12-31
err0
errOAAI
errIgnacio Piquero-Zulaica; Ali Sadeghi; Mohammad Kherelden; Muqing Hua; Jing Liu; Guowen Kuang; Linghao Yan; J. Enrique Ortega; Zakaria M. Abd El-Fattah; Behnam Azizi; Nian Lin; Jorge Lobo-Checa
errShare
errSave
errShare
errSave
Genome Sequence of Serratia marcescens MSU97, a Plant-Associated Bacterium That Makes Multiple Antibiotics
err2017-03-02
err0
errOAAI
errMiguel A. Matilla; Zulema Udaondo; Tino Krell; George P. C. Salmond
errShare
errSave
researcher View more