Unmasking Backdoors: An Explainable Defense via Gradient-Attention Anomaly Scoring for Pre-trained Language Models
On the map: LLM safety and security → Backdoor and data poisoning attacks
Abstract (arXiv)
Pre-trained language models have achieved remarkable success across a wide range of natural language processing (NLP) tasks, particularly when fine-tuned on large, domain-relevant datasets. However, they remain vulnerable to backdoor attacks, where adversaries embed malicious behaviors using trigger patterns in the training data. These triggers remain dormant during normal usage, but, when activated, can cause targeted misclassifications. In this work, we investigate the internal behavior of backdoored pre-trained encoder-based language models, focusing on the consistent shift in attention and gradient attribution when processing poisoned inputs; where the trigger token dominates both attention and gradient signals, overriding the surrounding context. We propose an inference-time defense that constructs anomaly scores by combining token-level attention and gradient information. Extensive experiments on text classification tasks across diverse backdoor attack scenarios demonstrate that our method significantly reduces attack success rates compared to existing baselines. Furthermore, we provide an interpretability-driven analysis of the scoring mechanism, shedding light on trigger localization and the robustness of the proposed defense.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Placed in Backdoor and data poisoning attacks, one of 12 directions in LLM safety and security. Builds on 29 of its 37 references that are in the map. First posted on arXiv 5 Oct 2025.
Builds on
29 of 37 references.
Closest ancestors · 14
Same direction, newest first
- 2023TextGuard: Provable Defense against Backdoor Attacks on Text Classification19 Nov
- 2023Diffusion Theory as a Scalpel: Detecting and Purifying Poisonous Dimensions in Pre-trained Language Models Caused by Backdoor or Bias8 May
- 2022Fine-mixing: Mitigating Backdoors in Fine-tuned Language Models18 Oct
- 2022A Unified Evaluation of Textual Backdoor Learning: Frameworks and Benchmarks17 Jun
- 2022BITE: Textual Backdoor Attacks with Iterative Trigger Injection25 May
- 2022Constrained Optimization with Dynamic Bound-scaling for Effective NLPBackdoor Defense11 Feb
- 2021Triggerless Backdoor Attack for NLP Tasks with Clean Labels15 Nov
- 2021RAP: Robustness-Aware Perturbations for Defending against Backdoor Attacks on NLP Models15 Oct
- 2021Mind the Style of Text! Adversarial and Backdoor Attacks Based on Text Style Transfer14 Oct
- 2021BadPre: Task-agnostic Backdoor Attacks to Pre-trained NLP Foundation Models6 Oct
- 2021BFClass: A Backdoor-free Text Classification Framework22 Sep
- 2021Turn the Combination Lock: Learnable Textual Backdoor Attacks via Word Substitution11 Jun
2 more
Other references · 15
- 2017Attention Is All You Needcited by 59,932
- 2014Explaining and Harnessing Adversarial Examplescited by 7,287
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
- 2017BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chaincited by 1,052
- 2017Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoningcited by 1,012
- 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 709
- 2019STRIP: A Defence Against Trojan Attacks on Deep Neural Networkscited by 437
- 2020Weight Poisoning Attacks on Pre-trained Modelscited by 318
- 2020ONION: A Simple and Effective Defense Against Textual Backdoor Attackscited by 231
- 2019A backdoor attack against LSTM-based text classification systemscited by 214
- 2020BadNL: Backdoor Attacks against NLP Models with Semantic-preserving Improvementscited by 191
- 2021Backdoor Attacks on Pre-trained Models by Layerwise Weight Poisoningcited by 103
3 more
Built on by
Citing papers per year: 2026: 3.
3 papers.
- 2026Delayed Backdoor Attacks: Exploring the Temporal Dimension as a New Attack Surface in Pre-Trained Modelscited by 0
- 2026Defusing the Trigger: Tail-Risk-Informed Attention Rebalancing for LLM Backdoor Mitigationcited by 0
- 2026CSO-LLM: Class Subspace Orthogonalization for Post-Training Backdoor Detection and Trigger Inversion in LLMscited by 0
- 2026CSO-LLM: Class Subspace Orthogonalization for Post-Training Backdoor Detection and Trigger Inversion in LLMs30 Jun 2026
- 2026Defusing the Trigger: Tail-Risk-Informed Attention Rebalancing for LLM Backdoor Mitigation27 Apr 2026
- 2026Delayed Backdoor Attacks: Exploring the Temporal Dimension as a New Attack Surface in Pre-Trained Models12 Mar 2026