Layer-Level Self-Exposure and Patch: Affirmative Token Mitigation for Jailbreak Attack Defense
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
As large language models (LLMs) are increasingly deployed in diverse applications, including chatbot assistants and code generation, aligning their behavior with safety and ethical standards has become paramount. However, jailbreak attacks, which exploit vulnerabilities to elicit unintended or harmful outputs, threaten LLMs' safety significantly. In this paper, we introduce Layer-AdvPatcher, a novel methodology designed to defend against jailbreak attacks by utilizing an unlearning strategy to patch specific layers within LLMs through self-augmented datasets. Our insight is that certain layer(s), tend to produce affirmative tokens when faced with harmful prompts. By identifying these layers and adversarially exposing them to generate more harmful data, one can understand their inherent and diverse vulnerabilities to attacks. With these exposures, we then "unlearn" these issues, reducing the impact of affirmative tokens and hence minimizing jailbreak risks while keeping the model's responses to safe queries intact. We conduct extensive experiments on two models, four benchmark datasets, and multiple state-of-the-art jailbreak attacks to demonstrate the efficacy of our approach. Results indicate that our framework reduces the harmfulness and attack success rate of jailbreak attacks without compromising utility for benign queries compared to recent defense methods. Our code is publicly available at: https://github.com/oyy2000/LayerAdvPatcher
Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 23 of its 37 references that are in the map. First posted on arXiv 5 Jan 2025.
Builds on
23 of 37 references.
Closest ancestors · 11
Same direction, newest first
- 2024Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editing28 May
- 2024SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decoding14 Feb
- 2023Jailbreaking GPT-4V via Self-Adversarial Attacks with System Prompts15 Nov
- 2023Defending Large Language Models Against Jailbreaking Attacks Through Goal Prioritization15 Nov
- 2023DeepInception: Hypnotize Large Language Model to Be Jailbreaker6 Nov
- 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
- 2023Catastrophic Jailbreak of Open-source LLMs via Exploiting Generation10 Oct
- 2023Defending Against Alignment-Breaking Attacks via Robustly Aligned LLM18 Sep
- 2023Certifying LLM Safety against Adversarial Prompting6 Sep
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
- 2023Jailbroken: How Does LLM Safety Training Fail?5 Jul
Other references · 12
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2023Fine-tuning Aligned Language Models Compromises Safety, Even When Users Do Not Intend To!cited by 1,106
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 608
- 2018Fine-Pruning: Defending Against Backdooring Attacks on Deep Neural Networkscited by 550
- 2021Remember What You Want to Forget: Algorithms for Machine Unlearningcited by 360
- 2023The Unlocking Spell on Base LLMs: Rethinking Alignment via In-Context Learningcited by 251
- 2023LLM Self Defense: By Self Examination, LLMs Know They Are Being Trickedcited by 226
- 2023LLM Lies: Hallucinations are not Bugs, but Features as Adversarial Examplescited by 177
- 2023RAIN: Your Language Models Can Align Themselves without Finetuningcited by 149
- 2024Detoxifying Large Language Models via Knowledge Editingcited by 86
- 2023Bergeron: Combating Adversarial Attacks through a Conscience-Based Alignment Frameworkcited by 29
Built on by
Citing papers per year: 2025: 5; 2026: 1.
6 papers.
- 2025Invisible Prompts, Visible Threats: Malicious Font Injection in External Resources for Large Language Modelscited by 9
- 2026Sparse Models, Sparse Safety: Unsafe Routes in Mixture-of-Experts LLMscited by 6
- 2025SafeInt: Shielding Large Language Models from Jailbreak Attacks via Safety-Aware Representation Interventioncited by 4
- 2025SafeLLM: Unlearning Harmful Outputs from Large Language Models against Jailbreak Attackscited by 4
- 2025Beyond the Tip of Efficiency: Uncovering the Submerged Threats of Jailbreak Attacks in Small Language Modelscited by 2
- 2025MirrorShield: Towards Universal Defense Against Jailbreaks via Entropy-Guided Mirror Craftingcited by 1
- 2026Sparse Models, Sparse Safety: Unsafe Routes in Mixture-of-Experts LLMs9 Feb 2026
- 2025SafeLLM: Unlearning Harmful Outputs from Large Language Models against Jailbreak Attacks21 Aug 2025
- 2025Invisible Prompts, Visible Threats: Malicious Font Injection in External Resources for Large Language Models22 May 2025
- 2025MirrorShield: Towards Universal Defense Against Jailbreaks via Entropy-Guided Mirror Crafting17 Mar 2025
- 2025Beyond the Tip of Efficiency: Uncovering the Submerged Threats of Jailbreak Attacks in Small Language Models27 Feb 2025
- 2025SafeInt: Shielding Large Language Models from Jailbreak Attacks via Safety-Aware Representation Intervention21 Feb 2025