Beyond Self-learned Attention: Mitigating Attention Bias in Transformer-based Models Using Attention Guidance
Not on the map. Why?
Abstract (arXiv)
Transformer-based models have demonstrated considerable potential for source code modeling tasks in software engineering. However, they are limited by their dependence solely on automatic self-attention weight learning mechanisms. Previous studies have shown that these models overemphasize delimiters added by tokenizers (e.g., [CLS], [SEP]), which may lead to overlooking essential information in the original input source code. To address this challenge, we introduce SyntaGuid, a novel approach that utilizes the observation that attention weights tend to be biased towards specific source code syntax tokens and abstract syntax tree (AST) elements in fine-tuned language models when they make correct predictions. SyntaGuid facilitates the guidance of attention-weight learning, leading to improved model performance on various software engineering tasks. We evaluate the effectiveness of SyntaGuid on multiple tasks and demonstrate that it outperforms existing state-of-the-art models in overall performance without requiring additional data. Experimental result shows that SyntaGuid can improve overall performance up to 3.25% and fix up to 28.3% wrong predictions. Our work represents the first attempt to guide the attention of Transformer-based models towards critical source code tokens during fine-tuning, highlighting the potential for enhancing Transformer-based models in software engineering.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 37 of its 68 references that are in the map. First posted on arXiv 26 Feb 2024.
Builds on
37 of 68 references.
References · 37
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,266
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,747
- 2020Supervised Contrastive Learningcited by 2,803
- 2019XLNet: Generalized Autoregressive Pretraining for Language Understandingcited by 2,801
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2019Cross-lingual Language Model Pretrainingcited by 1,088
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
25 more
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2018code2seq: Generating Sequences from Structured Representations of Codecited by 177
- 2021CURE: Code-Aware Neural Machine Translation for Automatic Program Repaircited by 85
- 2019A Neural Model for Generating Natural Language Summaries of Program Subroutinescited by 76
- 2020Contrastive Code Representation Learningcited by 76
- 2022Natural Attack for Pre-trained Models of Codecited by 72
- 2021Studying the Usage of Text-To-Text Transfer Transformer to Support Code-Related Taskscited by 70
- 2020Detecting Code Clones with Graph Neural Networkand Flow-Augmented Abstract Syntax Treecited by 68
- 2021SynCoBERT: Syntax-Guided Multi-Modal Contrastive Pre-Training for Code Representationcited by 63
- 2021CoTexT: Multi-task Learning with Code-Text Transformercited by 61
- 2022What Do They Capture? -- A Structural Analysis of Pre-Trained Language Models for Source Codecited by 50
- 2021Multilingual training for Software Engineeringcited by 43
- 2015SourcererCC: Scaling Code Clone Detection to Big Codecited by 40
- 2021What do pre-trained code models know about code?cited by 36
- 2020Improved Automatic Summarization of Subroutines via Attention to File Contextcited by 34
- 2021CodeTrans: Towards Cracking the Language of Silicon's Code Through Self-Supervised Deep Learning and High Performance Computingcited by 28
- 2021Bridging Pre-trained Models and Downstream Tasks for Source Code Understandingcited by 27
- 2023An Empirical Comparison of Pre-Trained Models of Source Codecited by 25
- 2022Diet Code Is Healthy: Simplifying Programs for Pre-trained Models of Codecited by 24
- 2020Guiding Attention for Self-Supervised Learning with Transformerscited by 14
- 2022An Exploratory Study on Code Attention in BERTcited by 12
- 2021VarCLR: Variable Semantic Representation Pre-training via Contrastive Learningcited by 11
- 2022Paying More Attention to Self-attention: Improving Pre-trained Language Models via Attention Guidingcited by 6
Built on by
Citing papers per year: 2026: 1.
1 paper.