AttentionSwitch: Jailbreak Defense for LLMs via Joint Learning of Sparse Attention-Head Selection and Scaling
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
Large language models have achieved remarkable performance across a wide range of tasks, yet they remain susceptible to jailbreak attacks that circumvent safety mechanisms and elicit harmful or unintended outputs. Although safety can be improved through model fine-tuning, such approaches can be computationally expensive and may degrade previously acquired capabilities through catastrophic forgetting. Recent jailbreak defenses have therefore explored targeted interventions on specific model components associated with unsafe behavior. However, existing approaches typically decouple two inherently related decisions: where to intervene and how to modify the selected components. Such sequential optimization may be suboptimal because the optimal intervention location can depend on the intervention applied there, and vice versa. In this work, we introduce AttentionSwitch, the first jailbreak defense to jointly optimize intervention sites and strengths within a frozen LLM. Specifically, AttentionSwitch learns a sparse set of attention heads together with query-conditioned multiplicative scaling factors, allowing the outputs of the selected heads to be either attenuated or amplified without altering the directions of their representations. Across popular language models and jailbreak attacks, AttentionSwitch outperforms existing defenses, with particularly strong results when training data is scarce.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 40 of its 45 references that are in the map. Submitted 5 Nov 2026.
Builds on
40 of 45 references.
Closest ancestors · 16
Same direction, newest first
- 2026Dynamic Deep Prompt Optimization for Defending Against Jailbreak Attacks on LLMs10 Aug
- 2025ASGuard: Activation-Scaling Guard to Mitigate Targeted Jailbreaking Attack30 Sep
- 2025LLMs Caught in the Crossfire: Malware Requests and Jailbreak Challenges9 Jun
- 2025DETAM: Defending LLMs Against Jailbreak Attacks via Targeted Attention Modification18 Apr
- 2025AdaSteer: Your Aligned LLM is Inherently an Adaptive Jailbreak Defender13 Apr
- 2024Jailbreak Antidote: Runtime Safety-Utility Balance via Sparse Representation Adjustment in Large Language Models3 Oct
- 2024WildTeaming at Scale: From In-the-Wild Jailbreaks to (Adversarially) Safer Language Models26 Jun
- 2024JailbreakBench: An Open Robustness Benchmark for Jailbreaking Large Language Models28 Mar
- 2024A Comprehensive Study of Jailbreak Attack versus Defense for Large Language Models21 Feb
- 2024JailbreakRadar: Comprehensive Assessment of Jailbreak Attacks Against LLMs8 Feb
- 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
- 2023Multilingual Jailbreak Challenges in Large Language Models10 Oct
4 more
- 2023SmoothLLM: Defending Large Language Models Against Jailbreaking Attacks5 Oct
- 2023GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher12 Aug
- 2023"Do Anything Now": Characterizing and Evaluating In-The-Wild Jailbreak Prompts on Large Language Models7 Aug
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
Other references · 24
- 2017Attention Is All You Needcited by 62,125
- 2022Training language models to follow instructions with human feedbackcited by 16,493
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 15,591
- 2023Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injectioncited by 1,638
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,584
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 899
- 2019Are Sixteen Heads Really Better than One?cited by 855
- 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 734
- 2023An Empirical Study of Catastrophic Forgetting in Large Language Models During Continual Fine-tuningcited by 709
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 693
- 2024InjecAgent: Benchmarking Indirect Prompt Injections in Tool-Integrated Large Language Model Agentscited by 634
- 2023XSTest: A Test Suite for Identifying Exaggerated Safety Behaviours in Large Language Modelscited by 579
12 more
- 2024WildGuard: Open One-Stop Moderation Tools for Safety Risks, Jailbreaks, and Refusals of LLMscited by 566
- 2024AgentHarm: A Benchmark for Measuring Harmfulness of LLM Agentscited by 513
- 2023Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discoverycited by 343
- 2021Gradient-based Adversarial Attacks against Text Transformerscited by 242
- 2023Instructions as Backdoors: Backdoor Vulnerabilities of Instruction Tuning for Large Language Modelscited by 126
- 2025AlphaSteer: Learning Refusal Steering with Principled Null-Space Constraintcited by 59
- 2021Differentiable Subset Pruning of Transformer Headscited by 48
- 2023LMSanitator: Defending Prompt-Tuning Against Task-Agnostic Backdoorscited by 11
- 2026Genotypic Triggers: Exposing Pharmacogenomic Blind Spots via Host-Specific Backdoors in Generative Antimicrobial Peptide Modelscited by 2
- 2026Safety-Utility Conflicts Are Not Global: Surgical Alignment via Head-Level Diagnosiscited by 1
- 2026LoRAScan: Detecting Backdoor Prompts in Low-Rank Adapters for Large Language Models via Down-Projection Activation Spikescited by 1
- 2026StepTrigger: Contact-State-Triggered Backdoor Attacks on VLM-Powered Legged Robotscited by 1
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Attention Slipping: A Mechanistic Understanding of Jailbreak Attacks and Defenses in LLMs
- 2024AttnGCG: Enhancing Jailbreaking Attacks on LLMs with Attention Manipulation
- 2025AttentionDefense: Leveraging System Prompt Attention for Explainable Defense Against Novel Jailbreaks
- 2024Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editing
- 2026TERM: Target-Free Jailbreak Defense via Entropy-Guided Residual Modulation
- 2023Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritization
- 2024Jailbreaking and Mitigation of Vulnerabilities in Large Language Models
- 2024Jailbreak Instruction-Tuned LLMs via end-of-sentence MLP Re-weighting