Dynamic Deep Prompt Optimization for Defending Against Jailbreak Attacks on LLMs
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
Large Language Models (LLMs) demonstrate impressive capabilities across many applications but remain vulnerable to jailbreak attacks, which elicit harmful or unintended content. While model fine-tuning is an option for safety alignment, it is costly and prone to catastrophic forgetting. Prompt optimization has emerged as a promising alternative, yet existing prompt-based defenses typically rely on static modifications (e.g., fixed prefixes or suffixes) that cannot adapt to diverse and evolving attacks. We propose Dynamic Deep Prompt Optimization (DDPO), the first jailbreak defense based on deep prompt optimization. DDPO uses the target LLM's own intermediate layers as feature extractors to dynamically generate defensive embeddings via a lightweight multilayer perceptron. These tailored embeddings are then injected into a subsequent intermediate layer, enabling an input-dependent defense without modifying the LLM's weights. This design ensures high adaptability with minimal computational overhead. Experiments on a diverse set of models and attacks demonstrate that DDPO significantly outperforms static prompt optimization methods, particularly on weakly aligned models and when handling semantically ambiguous benign prompts, successfully distinguishing them from genuinely harmful requests.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 21 of its 31 references that are in the map. First posted on arXiv 10 Aug 2026.
Builds on
21 of 31 references.
Closest ancestors · 8
Same direction, newest first
- 2024AutoDefense: Multi-Agent LLM Defense against Jailbreak Attacks2 Mar
- 2024Break the Breakout: Reinventing LM Defense Against Jailbreak Attacks with Self-Refinement23 Feb
- 2024GradSafe: Detecting Jailbreak Prompts for LLMs via Safety-Critical Gradient Analysis21 Feb
- 2024Fight Back Against Jailbreaking via Prompt Adversarial Tuning9 Feb
- 2024Robust Prompt Optimization for Defending Language Models Against Jailbreaking Attacks30 Jan
- 2023Jailbreaking Black Box Large Language Models in Twenty Queries12 Oct
- 2023GPT-4 Is Too Smart To Be Safe: Stealthy Chat with LLMs via Cipher12 Aug
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
Other references · 13
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,429
- 2019Universal Adversarial Triggers for Attacking and Analyzing NLPcited by 722
- 2021P-Tuning v2: Prompt Tuning Can Be Comparable to Fine-tuning Universally Across Scales and Taskscited by 689
- 2023RAFT: Reward rAnked FineTuning for Generative Foundation Model Alignmentcited by 686
- 2023Baseline Defenses for Adversarial Attacks Against Aligned Language Modelscited by 651
- 2023An Empirical Study of Catastrophic Forgetting in Large Language Models During Continual Fine-tuningcited by 639
- 2023Safety-Tuned LLaMAs: Lessons From Improving the Safety of Large Language Models that Follow Instructionscited by 387
- 2023Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discoverycited by 336
- 2023OpenChat: Advancing Open-source Language Models with Mixed-Quality Datacited by 252
1 more
- 2021Gradient-based Adversarial Attacks against Text Transformerscited by 234
Built on by
Citing papers per year: 2026: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2024Defending Large Language Models Against Jailbreak Attacks via Layer-specific Editing
- 2026Adaptive Prompt Embedding Optimization for LLM Jailbreaking
- 2023A Wolf in Sheep's Clothing: Generalized Nested Jailbreak Prompts can Fool Large Language Models Easily
- 2025SecurityLingua: Efficient Defense of LLM Jailbreak Attacks via Security-Aware Prompt Compression
- 2025ShieldLearner: A New Paradigm for Jailbreak Attack Defense in LLMs
- 2025Efficient and Stealthy Jailbreak Attacks via Adversarial Prompt Distillation from LLMs to SLMs
- 2024Adversarial Tuning: Defending Against Jailbreak Attacks for LLMs
- 2026The Art of the Jailbreak: Formulating Jailbreak Attacks for LLM Security Beyond Binary Scoring