← Latest papers
💻 computer science

JailBreakGuard: Defeating Jailbreak Attacks via Dynamic Prompt Perturbation

JailBreakGuard is a cost-effective, dynamic defense framework that mitigates diverse jailbreak attacks on large language models by employing a perplexity-based mechanism to selectively apply character or sentence-level prompt perturbations, achieving a significant reduction in attack success rates with minimal impact on benign query performance.

Original authors: Jun Yuan, Ziang Ruan, Liangguo Chen, Shuyu Jiang, Rui Tang, Hao Ren

Published 2026-09-29
📖 4 min read☕ Coffee break read

Original authors: Jun Yuan, Ziang Ruan, Liangguo Chen, Shuyu Jiang, Rui Tang, Hao Ren

Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the digital age, large language models have become the quiet engines behind countless applications, from drafting emails to answering complex questions. These systems are trained on vast amounts of human text, learning to predict what words should come next in a sentence. However, this same ability to understand and generate language makes them vulnerable to a specific kind of trickery known as a "jailbreak." In a jailbreak attack, a user crafts a prompt—a carefully worded request designed to bypass the model's built-in safety rules. By using role-playing scenarios, hidden instructions, or strange formatting, an attacker can trick the model into ignoring its ethical guidelines and generating harmful content, such as instructions for dangerous activities or hate speech. While developers have tried to harden these models against such tricks, attackers constantly evolve their methods, creating a moving target that is difficult to defend against with a single, static shield.

A new approach called JailBreakGuard offers a different way to handle this problem, shifting the focus from changing the model itself to carefully altering the incoming requests before they are processed. Researchers from Sichuan University and Guilin University of Electronic Technology found that not all malicious prompts look the same. Some rely on complex, story-like scenarios that read smoothly, while others use strange, garbled text filled with nonsensical characters to confuse the system. The team discovered that these two types of attacks behave very differently when measured by how "surprising" the text is to the model. Smooth, story-based attacks tend to look very normal and predictable, whereas the garbled, adversarial attacks look chaotic and highly unpredictable.

To exploit this difference, the researchers built a defense system that acts like a smart gatekeeper at the entrance of the application. Instead of applying the same fix to every request, the system first measures the "surprise level" of the incoming text. If the text is highly chaotic and unpredictable, the system assumes it is a garbled attack and applies a technique that randomly deletes, swaps, or inserts a few characters. This tiny amount of noise is enough to break the specific structure of the malicious code without changing the meaning of a normal question. If the text is smooth and predictable, the system assumes it might be a clever story-based attack and instead rewrites the sentence using a helper model. This rewriting process keeps the original meaning intact but strips away the hidden instructions designed to trick the safety filters.

The results of this dynamic approach were tested against nine different types of jailbreak attacks across seven categories. The system proved remarkably effective, reducing the average success rate of these attacks by more than 70 percent on the models it was tested against. Crucially, this defense did not come at the cost of the model's ability to help regular users. When the researchers tested the system on normal, harmless questions, the models' performance dropped by a negligible amount, with the maximum decrease in accuracy being only 3.19 percent. In fact, for some models, the rewriting process even made the questions slightly easier to understand, leading to a tiny improvement in accuracy.

This method stands out because it does not require changing the underlying model or its internal settings, making it easy to install at the service level where requests first arrive. It is also efficient, taking less time and using fewer computing resources than many existing defense methods. By recognizing that different attacks require different countermeasures, and by using the natural structure of the text to decide which countermeasure to use, JailBreakGuard provides a flexible and robust shield. It demonstrates that a defense does not need to be a heavy, unyielding wall; sometimes, the most effective protection is a light, intelligent touch that adapts to the shape of the threat.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →