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 条
  • [41] A Two-Stage Audio-Visual Fusion Piano Transcription Model Based on the Attention Mechanism
    Li, Yuqing
    Wang, Xianke
    Wu, Ruimin
    Xu, Wei
    Cheng, Wenqing
    IEEE-ACM TRANSACTIONS ON AUDIO SPEECH AND LANGUAGE PROCESSING, 2024, 32 : 3618 - 3630
  • [42] Dehazing Model of Extra-High Voltage Converter Station Based on Two-Stage Attention
    Liu, Rui
    Zhang, Jiaqing
    He, Yang
    IEEE ACCESS, 2023, 11 : 133246 - 133254
  • [43] Fast Attention-based Learning-To-Rank Model for Structured Map Search
    Zhang, Chiqun
    Evans, Michael R.
    Lepikhin, Max
    Yankov, Dragomir
    SIGIR '21 - PROCEEDINGS OF THE 44TH INTERNATIONAL ACM SIGIR CONFERENCE ON RESEARCH AND DEVELOPMENT IN INFORMATION RETRIEVAL, 2021, : 942 - 951
  • [44] Two-Dimensional Electron Model for a Hybrid Code of a Two-Stage Hall Thruster
    Escobar, Diego
    Ahedo, Eduardo
    IEEE TRANSACTIONS ON PLASMA SCIENCE, 2008, 36 (05) : 2043 - 2057
  • [45] A Two-stage Query by Singing/Humming System on GPU
    Kao, Wei-Tsa
    Wang, Chung-Che
    Chang, Kaichun K.
    Jang, Jyh-Shing Roger
    Liou, Wenshan
    2013 ASIA-PACIFIC SIGNAL AND INFORMATION PROCESSING ASSOCIATION ANNUAL SUMMIT AND CONFERENCE (APSIPA), 2013,
  • [46] A Query-Sensitive Graph-Based Sentence Ranking Algorithm for Query-Oriented Multi-Document Summarization .
    Wei, Furu
    He, Yanxiang
    Li, Wenjie
    Lu, Qin
    2008 INTERNATIONAL SYMPOSIUM ON INFORMATION PROCESSING AND 2008 INTERNATIONAL PACIFIC WORKSHOP ON WEB MINING AND WEB-BASED APPLICATION, 2008, : 9 - +
  • [47] CodeGen4Libs: A Two-Stage Approach for Library-Oriented Code Generation
    Liu, Mingwei
    Yang, Tianyong
    Lou, Yiling
    Du, Xueying
    Wang, Ying
    Peng, Xin
    2023 38TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING, ASE, 2023, : 434 - 445
  • [49] A Two-Stage Model for User's Examination Behavior in Mobile Search
    Mao, Jiaxin
    Liu, Yiqun
    Kando, Noriko
    He, Zexue
    Zhang, Min
    Ma, Shaoping
    CHIIR'18: PROCEEDINGS OF THE 2018 CONFERENCE ON HUMAN INFORMATION INTERACTION & RETRIEVAL, 2018, : 273 - 276
  • [50] Attention-Based Two-Phase Model for Video Action Detection
    Chen, Xiongtao
    Wang, Wenmin
    Li, Weimian
    Wang, Jinzhuo
    COMPUTER ANALYSIS OF IMAGES AND PATTERNS: 17TH INTERNATIONAL CONFERENCE, CAIP 2017, PT II, 2017, 10425 : 81 - 93