LatentBreak: Jailbreaking Large Language Models through Latent Space Feedback

Raffaele Mura, Giorgio Piras, Kamilė Lukošiūtė, Maura Pintor, Amin Karbasi, Battista Biggio

TL;DR

Current automated jailbreaks on Large Language Models (LLMs) are easily caught by simple perplexity filters because they rely on gibberish suffixes or massive templates. To solve this, LatentBreak uses latent-space feedback to subtly swap words with natural synonyms, shifting the prompt's internal representation to look "harmless" while keeping its toxic intent intact. This results in highly effective, compact, and virtually undetectable jailbreaks.

What Problem Does This Paper Address?

Safety-aligned LLMs are constantly under threat from jailbreak attacks—adversarial prompts designed to bypass safety guardrails and elicit harmful content. Most automated white-box attacks (like GCG) append meaningless token suffixes to maximize the likelihood of an affirmative response (e.g., forcing the model to start with "Sure, here is..."). Other methods (like AutoDAN or SAA) wrap requests in long, verbose templates.

The authors expose a major flaw in these approaches: they create massive local spikes in perplexity (a measure of how "surprised" a language model is by a sequence of tokens). Consequently, a straightforward sliding-window perplexity filter can easily detect and block them. The core challenge addressed by this paper is creating an automated jailbreak method that is highly effective, yet natural enough to slip past these perplexity-based defenses.

Methods

The authors introduce LatentBreak (LatB), a white-box jailbreak attack that eschews conspicuous suffixes and long templates. Instead, it iteratively substitutes words in the original harmful prompt with semantically equivalent alternatives generated by a substitution model (such as GPT-4o-mini).

To determine which word swaps will successfully trick the model, LatB leverages latent-space feedback:

  1. Harmless Centroid Mapping: The authors pre-compute the average internal representation (centroid) of a dataset of harmless prompts across the LLM's layers.
  2. Distance Minimization: During the attack, LatB measures the $\ell_2$ distance between the modified prompt's hidden states and this harmless centroid. By minimizing this distance, the algorithm coaxes the model's internal representation away from "refusal regions" and into "harmless regions."
  3. Intent Preservation: To ensure the prompt doesn't lose its original meaning during these swaps, an LLM-based intent judge evaluates semantic similarity at each step, rejecting any changes that alter the core request.
Figure 1: The LatentBreak approach and its results against perplexity-based detectors. In (a) we depict a latent-space representation of LatentBreak, shifting an initial harmful prompt (red dot) towards the harmless prompts centroid (blue dot), and resulting in a jailbreak with a few words substituted (violet dot). In (b) instead, we show the ROC curves of LatB and state-of-the-art attacks against a perplexity-based detector on 159 standard behaviors from HARMBENCH (Mazeika et al., 2024) and 600 harmless prompts. While competing attacks typically top the curve (i.e., all jailbreaks get easily detected), LatB is substantially less detected, comparable to the original prompt with no substitutions (None).

Datasets

  • HARMBENCH: The primary benchmark used for evaluation, utilizing all 159 prompts in the "standard" category to test attack success rates (ASR) and evaluate perplexity detectors.
  • ADVBENCH: A selection of 50 harmful behaviors used for ablation studies (e.g., comparing latent vs. logit feedback and selecting the optimal hidden layer).
  • ALPACA, ULTRACHAT_200K, and OPENORCA: Harmless prompts sampled from these datasets were used to compute the harmless latent centroid and to train the perplexity filters.

Key Insights and Ideas

  • Global vs. Local Perplexity: Attacks like AutoDAN claim low perplexity because their long, fluent templates dominate the average score. However, the authors show that a sliding-window filter (MaxPPL) easily exposes their local high-perplexity spikes.
  • Latent Space > Logits: Guiding word substitution by moving toward a harmless latent centroid is far more effective than traditional logit-based optimization (maximizing the probability of a target token like "Sure"). LatB consistently outperformed a logit-based variant ("LogitBreak") developed by the authors for comparison.
  • The Power of the Final Layers: Interestingly, the optimal layer for guiding the attack is typically the very last decoder layer of the victim model. This stands in contrast to previous representation engineering work which suggested intermediate layers are the most expressive for safety concepts.

Key Results

  • Resilience to Filtering: While suffix-based attacks (GCG, GBDA) and template attacks (SAA, AutoDAN) drop to near-zero success rates under a sliding-window perplexity filter, LatentBreak retains substantial efficacy. For example, on Qwen-7B, LatB maintains an 83.7% Attack Success Rate (ASR) post-filtering.
  • Compact Prompts: LatB minimally perturbs the input, resulting in a modest token size increase of only +6% to +33%. In contrast, SAA and AutoDAN inflate prompts by thousands of percent.
  • Bypassing Advanced Defenses: LatB proved capable of evading state-of-the-art model-level defenses, including adversarially trained models like R2D2 and representation-rerouting techniques like Circuit Breakers.
Figure 3: ROC curves of LatB and competing attacks against Llama3-8B-RR-based MaxPPL10 detector on 159 standard behaviors from HARMBENCH (Mazeika et al., 2024) and 600 harmless prompts.

Limitations and Future Work

  • White-Box Requirement: LatB requires full access to the victim model's internal parameters and activations, limiting its real-world deployment against closed-source commercial APIs.
  • Transferability: The authors have not yet tested whether adversarial prompts optimized on a surrogate white-box model can successfully transfer to unknown black-box targets.
  • Explicit Perplexity Optimization: Although LatB naturally achieves low perplexity, it does not explicitly minimize it during optimization. Incorporating a perplexity penalty into the loss function could make the attack even stealthier.

Summary updated

BibTeX
@misc{mura2025latentbreak,
  author = {Raffaele Mura and Giorgio Piras and Kamilė Lukošiūtė and Maura Pintor and Amin Karbasi and Battista Biggio},
  title = {{LatentBreak: Jailbreaking Large Language Models through Latent Space Feedback}},
  year = {2025},
  eprint = {2510.08604},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.08604},
}
Figure