Improving code completion efficiency through grouped attention
Abstract Although the code completion model based on the Transformer architecture has achieved remarkable results, the computational complexity of its multi-head self-attention grows quadratically with the increase of sequence length, resulting in low efficiency. To this end, we propose a code completion model based on grouped attention, referred to as GACC. This method groups the attention heads of a representation in the query, key, or value so that the attention heads in the same group share the single attention head of other representations, thereby reducing the number of parameters and computational complexity. We conducted experiments on public datasets of Python and JavaScript, and the experimental results show that compared to models based on multi-head self-attention, GACC effectively reduces the time taken for the model to suggest the next code token while achieving comparable performance on Top-k and MRR metrics.
Authors
- Deng Jia (ORCID: https://orcid.org/0009-0004-6870-284X)
- Jianxun Liu (ORCID: https://orcid.org/0000-0003-0722-152X)
- Yi Liu (ORCID: https://orcid.org/0009-0008-2227-0024)
- Yiming Yin (ORCID: https://orcid.org/0009-0003-6874-3302)
Institutions
- Hunan University of Science and Technology (CN)
- Liuyang City Maternal and Child Health Hospital (CN)
Publication Details
- Journal
- The Computer Journal
- Published
- 2025-09-24
- DOI
- https://doi.org/10.1093/comjnl/bxaf117
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00