Skip to main navigation Skip to search Skip to main content

Online learning defense against iterative jailbreak attacks via prompt optimization

Research output: Chapter in Book/Report/Conference proceeding › Conference contribution

Abstract

Iterative jailbreak methods that repeatedly rewrite and input prompts into large language models (LLMs) to induce harmful outputs—using the model’s previous responses to guide each new iteration—have been found to be a highly effective attack strategy. Despite being an effective attack strategy against LLMs and their safety mechanisms, existing defenses do not proactively disrupt this dynamic trial-and-error cycle. In this study, we propose a novel framework that dynamically updates its defense strategy through online learning in response to each new prompt from iterative jailbreak methods. Leveraging the distinctions between harmful jailbreak-generated prompts and typical harmless prompts, we introduce a reinforcement learning-based approach that optimizes prompts to ensure appropriate responses for harmless tasks while explicitly rejecting harmful prompts. Additionally, to curb overfitting to the narrow band of partial input rewrites explored during an attack, we introduce Past‐Direction Gradient Damping (PDGD). Experiments conducted on three LLMs show that our approach significantly outperforms five existing defense methods against five iterative jailbreak methods. Moreover, our results indicate that our prompt optimization strategy simultaneously enhances response quality for harmless tasks.
Original languageEnglish
Title of host publication Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics
PublisherAssociation for Computational Linguistics (ACL)
Pages2592–2609
Number of pages18
ISBN (Electronic)9798891762985
Publication statusPublished - 24 Dec 2025
EventInternational Joint Conference on Natural Language Processing & Asia-Pacific Chapter of the Association for Computational Linguistics, 2025 - Mumbai, India
Duration: 20 Dec 2025 → 24 Dec 2025
https://2025.aaclnet.org/

Conference

ConferenceInternational Joint Conference on Natural Language Processing & Asia-Pacific Chapter of the Association for Computational Linguistics, 2025
Abbreviated title14th IJCNLP & 4th AACL
Country/TerritoryIndia
CityMumbai
Period20/12/25 → 24/12/25
Internet address

Fingerprint

Dive into the research topics of 'Online learning defense against iterative jailbreak attacks via prompt optimization'. Together they form a unique fingerprint.

Cite this