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

被引:2
|
作者
Yang, Huanhuan [1 ,2 ]
Xu, Ling [1 ,2 ]
Liu, Chao [1 ,2 ]
Huangfu, Luwen [3 ,4 ]
机构
[1] Chongqing Univ, Key Lab Dependable Serv Comp Cyber Phys Soc, Minist Educ, Chongqing, Peoples R China
[2] Chongqing Univ, Sch Big Data & Software Engn, Chongqing, Peoples R China
[3] San Diego State Univ, Fowler Coll Business, San Diego, CA 92182 USA
[4] San Diego State Univ, Ctr Human Dynam Mobile Age, San Diego, CA 92182 USA
关键词
Code search; Attention mechanism; Query-oriented attention mechanism; Code structural feature;
D O I
10.1016/j.jss.2023.111948
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页数:16
相关论文
共 50 条
  • [31] A cluster-sensitive graph model for query-oriented multi-document summarization
    Wei, Furu
    Li, Wenjie
    Lu, Qin
    He, Yanxiang
    ADVANCES IN INFORMATION RETRIEVAL, 2008, 4956 : 446 - +
  • [32] Air pollutant prediction model based on transfer learning two-stage attention mechanism
    Ma, Zhanfei
    Wang, Bisheng
    Luo, Wenli
    Jiang, Jing
    Liu, Dongxiang
    Wei, Hui
    Luo, Haoye
    SCIENTIFIC REPORTS, 2024, 14 (01)
  • [33] Exploring hypergraph-based semi-supervised ranking for query-oriented summarization
    Wang, Wei
    Li, Sujian
    Li, Jiwei
    Li, Wenjie
    Wei, Furu
    INFORMATION SCIENCES, 2013, 237 : 271 - 286
  • [34] A Two-stage Fuzzy Budget Allocation Model In Search Auctions
    Qin, Rui
    Yuan, Yong
    Li, Juanjuan
    2014 IEEE INTERNATIONAL CONFERENCE ON SERVICE OPERATIONS AND LOGISTICS, AND INFORMATICS (SOLI), 2014, : 144 - 148
  • [35] A novel ensemble system for short-term wind speed forecasting based on Two-stage Attention-Based Recurrent Neural Network
    Zhang, Ziyuan
    Wang, Jianzhou
    Wei, Danxiang
    Luo, Tianrui
    Xia, Yurui
    RENEWABLE ENERGY, 2023, 204 : 11 - 23
  • [36] A Two-stage Conversational Query Rewriting Model with Multi-task Learning
    Song, Shuangyong
    Wang, Chao
    Xie, Qianqian
    Zu, Xinxing
    Chen, Huan
    Chen, Haiqing
    WWW'20: COMPANION PROCEEDINGS OF THE WEB CONFERENCE 2020, 2020, : 6 - 7
  • [37] PRUNING SUBSEQUENCE SEARCH WITH ATTENTION-BASED EMBEDDING
    Raffel, Colin
    Ellis, Daniel P. W.
    2016 IEEE INTERNATIONAL CONFERENCE ON ACOUSTICS, SPEECH AND SIGNAL PROCESSING PROCEEDINGS, 2016, : 554 - 558
  • [38] Search Activities for Innovation: An Attention-Based View
    Tseng, Chuan-Chuan
    Fang, Shih-Chieh
    Chiu, Yen-Ting Helena
    INTERNATIONAL JOURNAL OF BUSINESS, 2011, 16 (01): : 51 - 70
  • [39] WA-Transformer: Window Attention-based Transformer with Two-stage Strategy for Multi-task Audio Source Separation
    Wang, Yang
    Li, Chenxing
    Deng, Feng
    Lu, Shun
    Yao, Peng
    Tan, Jianchao
    Song, Chengru
    Wang, Xiaorui
    INTERSPEECH 2022, 2022, : 5373 - 5377
  • [40] Two-stage model of WTA oriented armored unit combat method
    Chen J.-W.
    Chang T.-Q.
    Zhang L.
    Yang G.-Z.
    Ma D.-Z.
    Xi Tong Gong Cheng Yu Dian Zi Ji Shu/Systems Engineering and Electronics, 2016, 38 (06): : 1326 - 1331