A Novel Source Code Representation Approach Based on Multi-Head Attention

被引:0
作者
Xiao, Lei [1 ]
Zhong, Hao [1 ]
Liu, Jianjian [1 ]
Zhang, Kaiyu [1 ]
Xu, Qizhen [1 ]
Chang, Le [2 ]
机构
[1] Xiamen Univ Technol, Coll Comp & Informat Engn, Xiamen 361024, Peoples R China
[2] Software Secur Co, Chengdu 610041, Peoples R China
关键词
multi-head attention; code clone; code classification; source code representation; CLONE DETECTION;
D O I
10.3390/electronics13112111
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Code classification and code clone detection are crucial for understanding and maintaining large software systems. Although deep learning surpasses traditional techniques in capturing the features of source code, existing models suffer from low processing power and high complexity. We propose a novel source code representation method based on the multi-head attention mechanism (SCRMHA). SCRMHA captures the vector representation of entire code segments, enabling it to focus on different positions of the input sequence, capture richer semantic information, and simultaneously process different aspects and relationships of the sequence. Moreover, it can calculate multiple attention heads in parallel, speeding up the computational process. We evaluate SCRMHA on both the standard dataset and an actual industrial dataset, and analyze the differences between these two datasets. Experiment results in code classification and clone detection tasks show that SCRMHA consumes less time and reduces complexity by about one-third compared with traditional source code feature representation methods. The results demonstrate that SCRMHA reduces the computational complexity and time consumption of the model while maintaining accuracy.
引用
收藏
页数:22
相关论文
共 50 条
  • [41] A novel unsupervised deep learning approach for vibration-based damage diagnosis using a multi-head self-attention LSTM autoencoder
    Ghazimoghadam, Shayan
    Hosseinzadeh, S. A. A.
    MEASUREMENT, 2024, 229
  • [42] A Multi-scene Webpage Fingerprinting Method Based on Multi-head Attention and Data Enhancement
    Xie, Lixia
    Li, Yange
    Yang, Hongyu
    Wang, Peng
    Hu, Ze
    Cheng, Xiang
    Zhang, Liang
    INFORMATION SECURITY AND CRYPTOLOGY, INSCRYPT 2023, PT I, 2024, 14526 : 418 - 432
  • [43] MULTI-RESOLUTION MULTI-HEAD ATTENTION IN DEEP SPEAKER EMBEDDING
    Wang, Zhiming
    Yao, Kaisheng
    Li, Xiaolong
    Fang, Shuo
    2020 IEEE INTERNATIONAL CONFERENCE ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, 2020, : 6464 - 6468
  • [44] Predicting drug-target binding affinity through molecule representation block based on multi-head attention and skip connection
    Zhang, Li
    Wang, Chun-Chun
    Chen, Xing
    BRIEFINGS IN BIOINFORMATICS, 2022, 23 (06)
  • [45] Leveraging mixed distribution of multi-head attention for sequential recommendation
    Yihao Zhang
    Xiaoyang Liu
    Applied Intelligence, 2023, 53 : 454 - 469
  • [46] Lane Change Intention Prediction of CNN-LSTM Based on Multi-head Attention
    Gao K.
    Li X.
    Hu L.
    Chen B.
    Du R.
    Jixie Gongcheng Xuebao/Journal of Mechanical Engineering, 2022, 58 (22): : 369 - 378
  • [47] Multi-head attention based candidate segment selection in QA over hybrid data
    Chen, Qian
    Gao, Xiaoying
    Guo, Xin
    Wang, Suge
    INTELLIGENT DATA ANALYSIS, 2023, 27 (06) : 1839 - 1852
  • [48] A new interest extraction method based on multi-head attention mechanism for CTR prediction
    Haifeng Yang
    Linjing Yao
    Jianghui Cai
    Yupeng Wang
    Xujun Zhao
    Knowledge and Information Systems, 2023, 65 : 3337 - 3352
  • [49] Multi-head attention-based two-stream EfficientNet for action recognition
    Zhou, Aihua
    Ma, Yujun
    Ji, Wanting
    Zong, Ming
    Yang, Pei
    Wu, Min
    Liu, Mingzhe
    MULTIMEDIA SYSTEMS, 2023, 29 (02) : 487 - 498
  • [50] CephaNN: A Multi-Head Attention Network for Cephalometric Landmark Detection
    Qian, Jiahong
    Luo, Weizhi
    Cheng, Ming
    Tao, Yubo
    Lin, Jun
    Lin, Hai
    IEEE ACCESS, 2020, 8 : 112633 - 112641