Transformer-based code search for software Q&A sites

被引:0
|
作者
Peng, Yaohui [1 ]
Xie, Jing [1 ]
Hu, Gang [1 ]
Yuan, Mengting [1 ]
机构
[1] Wuhan Univ, Sch Comp Sci, Bayi 299, Wuhan, Hubei, Peoples R China
基金
中国国家自然科学基金;
关键词
aligned attention; code search; neural network; structural code information; transformer;
D O I
10.1002/smr.2517
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
In software Q&A sites, there are many code-solving examples of individual program problems, and these codes with explanatory natural language descriptions are easy to understand and reuse. Code search in software Q&A sites increases the productivity of developers. However, previous approaches to code search fail to capture structural code information and the interactivity between source codes and natural queries. In other words, most of them focus on specific code structures only. This paper proposes TCS (Transformer-based code search), a novel neural network, to catch structural information for searching valid source codes from the query, which is vital for code search. The multi-head attention mechanism in Transformer helps TCS learn enough information about the underlying semantic vector representation of codes and queries. An aligned attention matrix is also employed to catch relationships between codes and queries. Experimental results show that the proposed TCS can learn more structural information and has better performance than existing models.
引用
收藏
页数:13
相关论文
共 50 条
  • [1] Hierarchical Embedding for Code Search in Software Q&A Sites
    Li, Ruitong
    Hu, Gang
    Peng, Min
    2020 INTERNATIONAL JOINT CONFERENCE ON NEURAL NETWORKS (IJCNN), 2020,
  • [2] Neural joint attention code search over structure embeddings for software Q&A sites
    Hu, Gang
    Peng, Min
    Zhang, Yihan
    Xie, Qianqian
    Yuan, Mengting
    JOURNAL OF SYSTEMS AND SOFTWARE, 2020, 170
  • [3] A Transformer-based Neural Architecture Search Method
    Wang, Shang
    Tang, Huanrong
    Ouyang, Jianquan
    PROCEEDINGS OF THE 2023 GENETIC AND EVOLUTIONARY COMPUTATION CONFERENCE COMPANION, GECCO 2023 COMPANION, 2023, : 691 - 694
  • [4] Q&A: Time transformer
    Jascha Hoffman
    Nature, 2015, 526 : 322 - 322
  • [5] Q&A: Time transformer
    Hoffman, Jascha
    Galison, Peter
    NATURE, 2015, 526 (7573) : 322 - 322
  • [6] An Empirical Study of Code Smells in Transformer-based Code Generation Techniques
    Siddiq, Mohammed Latif
    Majumder, Shafayat H.
    Mim, Maisha R.
    Jajodia, Sourov
    Santos, Joanna C. S.
    2022 IEEE 22ND INTERNATIONAL WORKING CONFERENCE ON SOURCE CODE ANALYSIS AND MANIPULATION (SCAM 2022), 2022, : 71 - 82
  • [7] SeTransformer: A Transformer-Based Code Semantic Parser for Code Comment Generation
    Li, Zheng
    Wu, Yonghao
    Peng, Bin
    Chen, Xiang
    Sun, Zeyu
    Liu, Yong
    Paul, Doyle
    IEEE TRANSACTIONS ON RELIABILITY, 2023, 72 (01) : 258 - 273
  • [8] TBCUP: A Transformer-based Code Comments Updating Approach
    Liu, Shifan
    Cui, Zhanqi
    Chen, Xiang
    Yang, Jun
    Li, Li
    Zheng, Liwei
    2023 IEEE 47TH ANNUAL COMPUTERS, SOFTWARE, AND APPLICATIONS CONFERENCE, COMPSAC, 2023, : 892 - 897
  • [9] Transformer-based code model with compressed hierarchy representation
    Kechi Zhang
    Jia Li
    Zhuo Li
    Zhi Jin
    Ge Li
    Empirical Software Engineering, 2025, 30 (2)
  • [10] Transformer-Based Language Models for Software Vulnerability Detection
    Thapa, Chandra
    Jang, Seung Ick
    Ahmed, Muhammad Ejaz
    Camtepe, Seyit
    Pieprzyk, Josef
    Nepal, Surya
    PROCEEDINGS OF THE 38TH ANNUAL COMPUTER SECURITY APPLICATIONS CONFERENCE, ACSAC 2022, 2022, : 481 - 496