LLMs Can Defend Themselves Against Jailbreaking in a Practical Manner: A Vision Paper
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
Jailbreaking is an emerging adversarial attack that bypasses the safety alignment deployed in off-the-shelf large language models (LLMs). A considerable amount of research exists proposing more effective jailbreak attacks, including the recent Greedy Coordinate Gradient (GCG) attack, jailbreak template-based attacks such as using "Do-Anything-Now" (DAN), and multilingual jailbreak. In contrast, the defensive side has been relatively less explored. This paper proposes a lightweight yet practical defense called SELFDEFEND, which can defend against all existing jailbreak attacks with minimal delay for jailbreak prompts and negligible delay for normal user prompts. Our key insight is that regardless of the kind of jailbreak strategies employed, they eventually need to include a harmful prompt (e.g., "how to make a bomb") in the prompt sent to LLMs, and we found that existing LLMs can effectively recognize such harmful prompts that violate their safety policies. Based on this insight, we design a shadow stack that concurrently checks whether a harmful prompt exists in the user prompt and triggers a checkpoint in the normal stack once a token of "No" or a harmful prompt is output. The latter could also generate an explainable LLM response to adversarial prompts. We demonstrate our idea of SELFDEFEND works in various jailbreak scenarios through manual analysis in GPT-3.5/4. We also list three future directions to further enhance SELFDEFEND.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 44 of its 54 references that are in the map. First posted on arXiv 24 Feb 2024.
Builds on
44 of 54 references.
Closest ancestors · 14
Same direction, newest first
- 2024SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decoding14 Feb
- 2024Fight Back Against Jailbreaking via Prompt Adversarial Tuning9 Feb
- 2024JailbreakRadar: Comprehensive Assessment of Jailbreak Attacks Against LLMs8 Feb
- 2024A Cross-Language Investigation into Jailbreak Attacks in Large Language Models30 Jan
- 2023Jailbreaking GPT-4V via Self-Adversarial Attacks with System Prompts15 Nov
- 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
- 2023Multilingual Jailbreak Challenges in Large Language Models10 Oct
- 2023SmoothLLM: Defending Large Language Models Against Jailbreaking Attacks5 Oct
- 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models3 Oct
- 2023Defending Against Alignment-Breaking Attacks via Robustly Aligned LLM18 Sep
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
- 2023MasterKey: Automated Jailbreak Across Multiple Large Language Model Chatbots16 Jul
2 more
Other references · 30
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2023A Survey of Large Language Modelscited by 2,537
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
- 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
- 2022Red Teaming Language Models with Language Modelscited by 983
- 2021Recent Advances in Natural Language Processing via Large Pre-Trained Language Models: A Surveycited by 457
- 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
- 2023Large Language Models for Information Retrieval: A Surveycited by 331
- 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 328
- 2023Visual Adversarial Examples Jailbreak Aligned Large Language Modelscited by 307
- 2023LLM Self Defense: By Self Examination, LLMs Know They Are Being Trickedcited by 226
18 more
- 2024SALAD-Bench: A Hierarchical and Comprehensive Safety Benchmark for Large Language Modelscited by 225
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2023RAIN: Your Language Models Can Align Themselves without Finetuningcited by 149
- 2024Jailbreaking Attack against Multimodal Large Language Modelcited by 128
- 2023Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMscited by 117
- 2024The Language Barrier: Dissecting Safety Challenges of LLMs in Multilingual Contextscited by 92
- 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
- 2023Split and Merge: Aligning Position Biases in LLM-based Evaluatorscited by 71
- 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
- 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 57
- 2024PAL: Proxy-Guided Black-Box Attack on Large Language Modelscited by 46
- 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
- 2022State-specific protein-ligand complex structure prediction with a multi-scale deep generative modelcited by 35
- 2024An Empirical Evaluation of LLMs for Solving Offensive Security Challengescited by 33
- 2023On Extracting Specialized Code Abilities from Large Language Models: A Feasibility Studycited by 13
- 2023VRPTEST: Evaluating Visual Referring Prompting in Large Multimodal Modelscited by 6
- 2018SCLib: A Practical and Lightweight Defense against Component Hijacking in Android Applicationscited by 3
- 2018Shining Light On Shadow Stackscited by 3
Built on by
Citing papers per year: 2024: 5; 2025: 2; 2026: 2.
9 papers.
- 2024SelfDefend: LLMs Can Defend Themselves against Jailbreaking in a Practical Mannercited by 57
- 2024Jailbreaking and Mitigation of Vulnerabilities in Large Language Modelscited by 33
- 2024Decoupled Alignment for Robust Plug-and-Play Adaptationcited by 9
- 2025Active Attacks: Red-teaming LLMs via Adaptive Environmentscited by 5
- 2024Logicbreaks: A Framework for Understanding Subversion of Rule-based Inferencecited by 3
- 2024Bridging Today and the Future of Humanity: AI Safety in 2024 and Beyondcited by 1
- 2025ReGA: Model-Based Safeguard for LLMs via Representation-Guided Abstractioncited by 1
- 2026SFCoT: Safer Chain-of-Thought via Active Safety Evaluation and Calibrationcited by 0
- 2026When LLM Defenses Backfire: Characterizing Safety, Performance, and Cost Trade-offscited by 0
- 2026When LLM Defenses Backfire: Characterizing Safety, Performance, and Cost Trade-offs27 Jul 2026
- 2026SFCoT: Safer Chain-of-Thought via Active Safety Evaluation and Calibration16 Mar 2026
- 2025Active Attacks: Red-teaming LLMs via Adaptive Environments26 Sep 2025
- 2025ReGA: Model-Based Safeguard for LLMs via Representation-Guided Abstraction2 Jun 2025
- 2024Jailbreaking and Mitigation of Vulnerabilities in Large Language Models20 Oct 2024
- 2024Bridging Today and the Future of Humanity: AI Safety in 2024 and Beyond9 Oct 2024
- 2024Logicbreaks: A Framework for Understanding Subversion of Rule-based Inference21 Jun 2024
- 2024SelfDefend: LLMs Can Defend Themselves against Jailbreaking in a Practical Manner8 Jun 2024
- 2024Decoupled Alignment for Robust Plug-and-Play Adaptation3 Jun 2024
Similar, not cited
Close in wording, no citation either way
- 2024Defensive Prompt Patch: A Robust and Interpretable Defense of LLMs against Jailbreak Attacks
- 2025Proactive defense against LLM Jailbreak
- 2025SecurityLingua: Efficient Defense of LLM Jailbreak Attacks via Security-Aware Prompt Compression
- 2025Involuntary Jailbreak: On Self-Prompting Attacks
- 2025Do Methods to Jailbreak and Defend LLMs Generalize Across Languages?
- 2025Scalable Defense against In-the-wild Jailbreaking Attacks with Safety Context Retrieval
- 2024Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks
- 2024Jailbreak Attacks and Defenses Against Large Language Models: A Survey