mlsanityData to 7 Oct 2026

LLMs Can Defend Themselves Against Jailbreaking in a Practical Manner: A Vision Paper

arXiv 2402.15727 ↗First posted 24 Feb 2024cs.CR cs.AIcited by 9

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

  1. 2024SafeDecoding: Defending against Jailbreak Attacks via Safety-Aware Decoding14 Feb
  2. 2024Fight Back Against Jailbreaking via Prompt Adversarial Tuning9 Feb
  3. 2024JailbreakRadar: Comprehensive Assessment of Jailbreak Attacks Against LLMs8 Feb
  4. 2024A Cross-Language Investigation into Jailbreak Attacks in Large Language Models30 Jan
  5. 2023Jailbreaking GPT-4V via Self-Adversarial Attacks with System Prompts15 Nov
  6. 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
  7. 2023Multilingual Jailbreak Challenges in Large Language Models10 Oct
  8. 2023SmoothLLM: Defending Large Language Models Against Jailbreaking Attacks5 Oct
  9. 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Models3 Oct
  10. 2023Defending Against Alignment-Breaking Attacks via Robustly Aligned LLM18 Sep
  11. 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
  12. 2023MasterKey: Automated Jailbreak Across Multiple Large Language Model Chatbots16 Jul
2 more
  1. 2023Jailbroken: How Does LLM Safety Training Fail?5 Jul
  2. 2023Jailbreaking ChatGPT via Prompt Engineering: An Empirical Study23 May

Other references · 30

  1. 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
  2. 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
  3. 2023A Survey of Large Language Modelscited by 2,537
  4. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
  5. 2023Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversationscited by 1,124
  6. 2022Red Teaming Language Models with Language Modelscited by 983
  7. 2021Recent Advances in Natural Language Processing via Large Pre-Trained Language Models: A Surveycited by 457
  8. 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
  9. 2023Large Language Models for Information Retrieval: A Surveycited by 331
  10. 2023Formalizing and Benchmarking Prompt Injection Attacks and Defensescited by 328
  11. 2023Visual Adversarial Examples Jailbreak Aligned Large Language Modelscited by 307
  12. 2023LLM Self Defense: By Self Examination, LLMs Know They Are Being Trickedcited by 226
18 more
  1. 2024SALAD-Bench: A Hierarchical and Comprehensive Safety Benchmark for Large Language Modelscited by 225
  2. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  3. 2023RAIN: Your Language Models Can Align Themselves without Finetuningcited by 149
  4. 2024Jailbreaking Attack against Multimodal Large Language Modelcited by 128
  5. 2023Abusing Images and Sounds for Indirect Instruction Injection in Multi-Modal LLMscited by 117
  6. 2024The Language Barrier: Dissecting Safety Challenges of LLMs in Multilingual Contextscited by 92
  7. 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
  8. 2023Split and Merge: Aligning Position Biases in LLM-based Evaluatorscited by 71
  9. 2023GPTScan: Detecting Logic Vulnerabilities in Smart Contracts by Combining GPT with Program Analysiscited by 65
  10. 2024LLM4Vuln: A Unified Evaluation Framework for Decoupling and Enhancing LLMs' Vulnerability Reasoningcited by 57
  11. 2024PAL: Proxy-Guided Black-Box Attack on Large Language Modelscited by 46
  12. 2022CCTEST: Testing and Repairing Code Completion Systemscited by 35
  13. 2022State-specific protein-ligand complex structure prediction with a multi-scale deep generative modelcited by 35
  14. 2024An Empirical Evaluation of LLMs for Solving Offensive Security Challengescited by 33
  15. 2023On Extracting Specialized Code Abilities from Large Language Models: A Feasibility Studycited by 13
  16. 2023VRPTEST: Evaluating Visual Referring Prompting in Large Multimodal Modelscited by 6
  17. 2018SCLib: A Practical and Lightweight Defense against Component Hijacking in Android Applicationscited by 3
  18. 2018Shining Light On Shadow Stackscited by 3

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 5; 2025: 2; 2026: 2.

9 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024Defensive Prompt Patch: A Robust and Interpretable Defense of LLMs against Jailbreak Attacks
  2. 2025Proactive defense against LLM Jailbreak
  3. 2025SecurityLingua: Efficient Defense of LLM Jailbreak Attacks via Security-Aware Prompt Compression
  4. 2025Involuntary Jailbreak: On Self-Prompting Attacks
  5. 2025Do Methods to Jailbreak and Defend LLMs Generalize Across Languages?
  6. 2025Scalable Defense against In-the-wild Jailbreaking Attacks with Safety Context Retrieval
  7. 2024Jailbreaking Leading Safety-Aligned LLMs with Simple Adaptive Attacks
  8. 2024Jailbreak Attacks and Defenses Against Large Language Models: A Survey