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 条
  • [1] Two-Stage Attention-Based Model for Code Search with Textual and Structural Features
    Xu, Ling
    Yang, Huanhuan
    Liu, Chao
    Shuai, Jianhang
    Yan, Meng
    Lei, Yan
    Xu, Zhou
    2021 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER 2021), 2021, : 342 - 353
  • [2] Query-Oriented Data Augmentation for Session Search
    Chen, Haonan
    Dou, Zhicheng
    Zhu, Yutao
    Wen, Ji-Rong
    IEEE TRANSACTIONS ON KNOWLEDGE AND DATA ENGINEERING, 2024, 36 (11) : 6877 - 6888
  • [3] Query-Oriented Summarization Based on Neighborhood Graph Model
    Wei, Furu
    He, Yanxiang
    Li, Wenjie
    Huang, Lei
    COMPUTER PROCESSING OF ORIENTAL LANGUAGES: LANGUAGE TECHNOLOGY FOR THE KNOWLEDGE-BASED ECONOMY, 2009, 5459 : 156 - +
  • [4] Query-Oriented Temporal Active Intimate Community Search
    Anwar, Md Musfique
    DATABASES THEORY AND APPLICATIONS, ADC 2020, 2020, 12008 : 206 - 215
  • [5] Attention-Based Two-Stage U-Net Horizon Tracking
    Luo, Yiliang
    Zhang, Gulan
    Li, Lei
    Zhang, Xudong
    Duan, Jing
    Li, Xiangwen
    Li, Yong
    IEEE GEOSCIENCE AND REMOTE SENSING LETTERS, 2022, 19
  • [6] R-Pred: Two-Stage Motion Prediction Via Tube-Query Attention-Based Trajectory Refinement
    Choi, Sehwan
    Kim, Jungho
    Yun, Junyong
    Choi, Jun Won
    2023 IEEE/CVF INTERNATIONAL CONFERENCE ON COMPUTER VISION (ICCV 2023), 2023, : 8491 - 8501
  • [7] Query-oriented text summarization based on hypergraph transversals
    Van Lierde, H.
    Chow, Tommy W. S.
    INFORMATION PROCESSING & MANAGEMENT, 2019, 56 (04) : 1317 - 1338
  • [8] Query-oriented citation recommendation based on network correlation
    Yang, Libin
    Zheng, Yu
    Cai, Xiaoyan
    Pan, Shirui
    Dai, Tao
    JOURNAL OF INTELLIGENT & FUZZY SYSTEMS, 2018, 35 (04) : 4621 - 4628
  • [9] DialCSP: A Two-Stage Attention-Based Model for Customer Satisfaction Prediction in E-commerce Customer Service
    Wu, Zhenhe
    Wu, Liangqing
    Song, Shuangyong
    Ji, Jiahao
    Zou, Bo
    Li, Zhoujun
    He, Xiaodong
    MACHINE LEARNING AND KNOWLEDGE DISCOVERY IN DATABASES, ECML PKDD 2022, PT III, 2023, 13715 : 3 - 18
  • [10] TAFFNet: Two-Stage Attention-Based Feature Fusion Network for Surface Defect Detection
    Cao, Jingang
    Yang, Guotian
    Yang, Xiyun
    JOURNAL OF SIGNAL PROCESSING SYSTEMS FOR SIGNAL IMAGE AND VIDEO TECHNOLOGY, 2022, 94 (12): : 1531 - 1544