Improving the Robustness of Transformer-based Large Language Models with Dynamic Attention
Not on the map. Why?
Abstract (arXiv)
Transformer-based models, such as BERT and GPT, have been widely adopted in natural language processing (NLP) due to their exceptional performance. However, recent studies show their vulnerability to textual adversarial attacks where the model's output can be misled by intentionally manipulating the text inputs. Despite various methods that have been proposed to enhance the model's robustness and mitigate this vulnerability, many require heavy consumption resources (e.g., adversarial training) or only provide limited protection (e.g., defensive dropout). In this paper, we propose a novel method called dynamic attention, tailored for the transformer architecture, to enhance the inherent robustness of the model itself against various adversarial attacks. Our method requires no downstream task knowledge and does not incur additional costs. The proposed dynamic attention consists of two modules: (I) attention rectification, which masks or weakens the attention value of the chosen tokens, and (ii) dynamic modeling, which dynamically builds the set of candidate tokens. Extensive experiments demonstrate that dynamic attention significantly mitigates the impact of adversarial attacks, improving up to 33% better performance than previous methods against widely-used adversarial attacks. The model-level design of dynamic attention enables it to be easily combined with other defense methods (e.g., adversarial training) to further enhance the model's robustness. Furthermore, we demonstrate that dynamic attention preserves the state-of-the-art robustness space of the original model compared to other dynamic modeling methods.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Builds on 49 of its 84 references that are in the map. First posted on arXiv 29 Nov 2023.
Builds on
49 of 84 references.
References · 49
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,491
- 2014Explaining and Harnessing Adversarial Examplescited by 7,287
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2020Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecastingcited by 2,141
- 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
- 2019Certified Adversarial Robustness via Randomized Smoothingcited by 1,324
37 more
- 2018Obfuscated Gradients Give a False Sense of Security: Circumventing Defenses to Adversarial Examplescited by 1,259
- 2019Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailmentcited by 663
- 2021Dynamic Neural Networks: A Surveycited by 405
- 2021A Survey of Transformerscited by 399
- 2018TextBugger: Generating Adversarial Text Against Real-world Applicationscited by 376
- 2018Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifierscited by 341
- 2021Recent Advances in Adversarial Training for Adversarial Robustnesscited by 276
- 2019FreeLB: Enhanced Adversarial Training for Natural Language Understandingcited by 261
- 2021Adversarial Graph Augmentation to Improve Graph Contrastive Learningcited by 200
- 2018Stochastic Activation Pruning for Robust Adversarial Defensecited by 171
- 2019Adversarial Training Can Hurt Generalizationcited by 131
- 2020Adversarial Training for Large Neural Language Modelscited by 109
- 2016Crafting Adversarial Input Sequences for Recurrent Neural Networkscited by 102
- 2020SoK: Certified Robustness for Deep Neural Networkscited by 100
- 2019Achieving Verified Robustness to Symbol Substitutions via Interval Bound Propagationcited by 87
- 2021Towards Improving Adversarial Training of NLP Modelscited by 79
- 2021Backdoor Pre-trained Models Can Transfer to Allcited by 79
- 2020Robustness Verification for Transformerscited by 76
- 2019Learning to Discriminate Perturbations for Blocking Adversarial Attacks in Text Classificationcited by 55
- 2018A Statistical Approach to Assessing Neural Network Robustnesscited by 54
- 2020Frequency-Guided Word Substitutions for Detecting Textual Adversarial Examplescited by 54
- 2021Random Noise Defense Against Query-Based Black-Box Attackscited by 46
- 2021Fast Certified Robust Training with Short Warmupcited by 45
- 2022Gradient Obfuscation Gives a False Sense of Security in Federated Learningcited by 37
- 2020Blacklight: Scalable Defense for Neural Networks against Query-Based Black-Box Attackscited by 34
- 2021Detecting Adversarial Examples from Sensitivity Inconsistency of Spatial-Transform Domaincited by 29
- 2019A Research Agenda: Dynamic Models to Defend Against Correlated Attackscited by 18
- 2020Lipschitz Bounds and Provably Robust Training by Laplacian Smoothingcited by 17
- 2020ALONE: A Dataset for Toxic Behavior among Adolescents on Twittercited by 17
- 2021On the Effectiveness of Small Input Noise for Defending Against Query-based Black-Box Attackscited by 17
- 2022Improving the Adversarial Robustness of NLP Models by Information Bottleneckcited by 17
- 2021Adversarial Examples can be Effective Data Augmentation for Unsupervised Machine Learningcited by 16
- 2018Defensive Dropout for Hardening Deep Neural Networks under Adversarial Attackscited by 13
- 2022Why adversarial training can hurt robust accuracycited by 12
- 2020Defense of Word-level Adversarial Attacks via Random Substitution Encodingcited by 9
- 2021Detecting Textual Adversarial Examples through Randomized Substitution and Votecited by 8
- 2021Dynamic Defense Approach for Adversarial Robustness in Deep Neural Networks via Stochastic Ensemble Smoothed Modelcited by 4
Built on by
Citing papers per year: 2024: 4; 2025: 2; 2026: 4.
10 papers.
- 2024Navigating the Risks: A Survey of Security, Privacy, and Ethics Threats in LLM-Based Agentscited by 63
- 2024Large Model Based Agents: State-of-the-Art, Cooperation Paradigms, Security and Privacy, and Future Trendscited by 26
- 2024Transformers Learn Low Sensitivity Functions: Investigations and Implicationscited by 13
- 2026Beyond OAuth: Task-Scoped Authorization for AI Agents via Natural Language Slicescited by 4
- 2025GuardNet: Graph-Attention Filtering for Jailbreak Defense in Large Language Modelscited by 3
- 2025Flip-Flop Consistency: Unsupervised Training for Robustness to Prompt Perturbations in LLMscited by 3
- 2024DYNASHIELD: A Black-Box Moving Target Defense for LLMs via Dynamic Decoding Customizationcited by 2
- 2026Attention-Enhanced Graph Filtering for False Data Injection Attack Detection and Localizationcited by 0
- 2026SeaAlert: Robust Severity Classification and LLM-Based Information Extraction for Noisy Maritime Distress Communicationscited by 0
- 2026Adversarial Robustness of Phishing Email Detection: A Comparative Study of TF-IDF + Logistic Regression and Fine-Tuned DistilBERTcited by 0
- 2026Adversarial Robustness of Phishing Email Detection: A Comparative Study of TF-IDF + Logistic Regression and Fine-Tuned DistilBERT20 Jul 2026
- 2026SeaAlert: Robust Severity Classification and LLM-Based Information Extraction for Noisy Maritime Distress Communications23 Mar 2026
- 2026Beyond OAuth: Task-Scoped Authorization for AI Agents via Natural Language Slices17 Mar 2026
- 2026Attention-Enhanced Graph Filtering for False Data Injection Attack Detection and Localization26 Jan 2026
- 2025Flip-Flop Consistency: Unsupervised Training for Robustness to Prompt Perturbations in LLMs16 Oct 2025
- 2025GuardNet: Graph-Attention Filtering for Jailbreak Defense in Large Language Models27 Sep 2025
- 2024DYNASHIELD: A Black-Box Moving Target Defense for LLMs via Dynamic Decoding Customization10 Dec 2024
- 2024Navigating the Risks: A Survey of Security, Privacy, and Ethics Threats in LLM-Based Agents14 Nov 2024
- 2024Large Model Based Agents: State-of-the-Art, Cooperation Paradigms, Security and Privacy, and Future Trends22 Sep 2024
- 2024Transformers Learn Low Sensitivity Functions: Investigations and Implications11 Mar 2024