Why Jailbreaks Succeed in Diffusion Language Models: An Energy Landscape Analysis

Thong Bach, Dung Nguyen, Thao Minh Le, Truyen Tran

TL;DR

This paper models the safety of diffusion-based large language models (dLLMs) as an energy landscape where alignment training creates a "barrier" between safe and harmful outputs. By monitoring the "kinetic energy" and initial state of the denoising process, the authors develop three training-free signals that collectively detect all known jailbreak strategies by catching either suspicious intent at the start or the high-velocity "barrier crossing" required to generate harmful content.

What Problem Does This Paper Address?

While autoregressive LLMs (like GPT-4) dominate the headlines, diffusion language models (dLLMs)—which generate text by iteratively "denoising" a sequence of mask tokens—are an emerging alternative. However, safety research for dLLMs is still in its infancy.

Existing jailbreak attacks (like template injections or mid-trajectory "anchoring") exploit specific vulnerabilities, and defenses like DiffuGuard target specific attack mechanisms. What’s missing is a unified framework that explains why these attacks succeed and provides a principled way to detect them. The authors fill this gap by applying the physics of "energy landscapes" to the denoising process.

Methods

The core idea is that a well-aligned dLLM has an energy landscape with two "basins": a safe one and a harmful one, separated by an energy barrier. During normal operation, the model follows a "geodesic" (the path of least resistance) toward the safe basin.

To detect when an attack is trying to force the model into the harmful basin, the authors derive three complementary, training-free signals:

  1. Step-0 Ratio ($R_0$): This measures the model's "safety disposition" at the very first step, before any tokens are generated. It looks at the ratio of "refusal" tokens (e.g., "sorry", "cannot") to "compliance" tokens (e.g., "sure", "here") in the initial logit distribution.
  2. SED Slope (Velocity in $V_\perp$): This tracks the "kinetic energy" or velocity of the denoising trajectory across the general vocabulary.
  3. $\Delta E$ Slope (Velocity in $V_s$): This tracks velocity specifically within the safety-relevant subspace (refusal vs. compliance tokens).

The authors prove that a successful jailbreak must either reveal its harmful intent at Step 0 (caught by $R_0$) or expend significant kinetic energy to cross the barrier mid-trajectory (caught by the slope signals).

Datasets

The researchers evaluated their framework using a robust suite of benchmarks:

  • Harmful Prompts: 400 behaviors from HarmBench and 520 from AdvBench.
  • Benign Prompts: 200 instructions from AlpacaEval and 250 "safe-but-tricky" prompts from XSTest.
  • Attacks: They tested against PAD (template attack), DIJA (interleaved mask attack), and Anchoring (mid-trajectory intervention).
  • Models: Evaluation was performed across LLaDA-8B, LLaDA-1.5, Dream-7B, and a sparse LLaDA-MoE-7B.

Key Insights and Ideas

  • The Energy Budget: Jailbreaks are essentially "energy-expensive." An attacker can hide their intent at the start (evading $R_0$), but then they must "drive" the model across the energy barrier during denoising, which creates a detectable spike in trajectory velocity.
  • Architecture-Dependent Subspaces: Different models "hide" their safety signals in different places. In LLaDA models, the attack signal is diffuse across the vocabulary (caught by SED slope). In Dream-7B, it is highly concentrated in the safety subspace (caught by $\Delta E$ slope). This explains why a single detection signal isn't enough for all models.
  • Basin Separation: Figure 2 illustrates how harmful queries (black) stay in the safe basin ($\Delta E > 0$) as the model refuses, while successful attacks must force the trajectory below the $\Delta E = 0$ barrier.
Figure 2: Safety Energy Gap ∆E(t) trajectories during denoising. Each line shows the mean factorised gap (Eq. (3)) at each denoising step, averaged over 400 prompts per condition (harmful and attack conditions from HarmBench), plotted as the raw sum over masked positions at L = 128; the per-token form is used in Appendix D.4. The dashed line at ∆E = 0 marks the energy barrier. Harmful direct queries (black) remain in the safe basin (∆E > 0) as the model refuses. Template attacks (PAD, DIJA) start near ∆E ≈0 and descend into the harmful basin. Anchoring at t=1 shows partial recovery; at t=8, recovery fails.
  • The "Hard-to-Separate" Threshold: In parametric stress tests, the authors found that if an attacker reduces the "intensity" of a template to evade detection, the attack also becomes too weak to actually produce harmful content. The detection threshold and the barrier-crossing threshold are physically linked.

Key Results

  • High Detection Accuracy: The combined "OR" detector (flagging a query if any of the three signals trigger) achieved an AUROC of 0.83–0.95 across all tested attacks and models.
  • Complementarity: $R_0$ is excellent at catching direct harmful queries (AUROC ~0.90) but fails against template attacks like DIJA (AUROC ~0.15). Conversely, the velocity signals catch template attacks that $R_0$ misses.
  • Robustness: The system remained effective even when using automatically derived "refusal" token sets rather than hand-curated ones, proving the energy landscape is a measurable property of the model itself.

Limitations and Future Work

  • Adaptive Adversaries: The study primarily validates against existing attacks. While the theory suggests the energy cost is unavoidable, a "white-box" attacker specifically optimizing to minimize these three signals simultaneously remains a future challenge.
  • Vocabulary Dependence: The $R_0$ and $\Delta E$ signals depend on token sets. While these can be derived automatically, they are currently language-specific (e.g., English sets don't work for Chinese prompts without re-derivation).
  • Scaling with Length: On some models (LLaDA), detection recall drops as the requested response length increases significantly beyond 128 tokens.
  • Beyond Masked Diffusion: The authors note that while $R_0$ might transfer to autoregressive models, the trajectory signals are specific to the iterative nature of diffusion.

Summary updated

Abstract

Existing attacks and defenses for diffusion-based large language models (dLLMs) target specific vulnerabilities but lack a shared framework explaining why attacks succeed. We propose one by interpreting safety alignment as shaping the denoising energy landscape: a well-aligned model routes harmful queries toward safe outputs through an energy barrier that separates the two regions. Current jailbreak attacks reduce to two strategies for circumventing this barrier: obscuring the query's safety disposition at initialisation, or intervening mid-trajectory to force the denoising path across the energy barrier. From this perspective and the result that masked diffusion models minimise kinetic energy during denoising, we derive three complementary, training-free detection signals: a step-0 ratio that reads the initial safety disposition from the logit distribution before generation begins, and two trajectory-velocity signals that track kinetic energy in complementary subspaces of the logit space. An attack must either reveal its intent at initialisation or expend kinetic energy to cross the barrier in at least one monitored subspace, so the three signals cover each other's blind spots in the energy budget by construction. Evaluation across three dense dLLMs (LLaDA-8B, LLaDA-1.5, Dream-7B) and a sparse mixture-of-experts dLLM (LLaDA-MoE-7B) confirms this complementarity. In stress tests of known attacks, every configuration that evades detection also fails to produce harmful content, suggesting that the detection and barrier-crossing thresholds are hard to separate.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
PAD attack vs. benign promptsSED slopeAUROC0.90params=8B
Source quote
L1048: SED slope │ 0.89 │ 0.90 │ 0.79 │ 0.95 │ 0.91 │ 0.68
PAD attack vs. benign promptsΔE slopeAUROC0.98params=7B
Source quote
L1055: \Delta E slope │ 0.98 │ 0.96 │ 0.90 │ 0.97 │ 0.94 │ 0.86
Anchoring attack at t=8 vs. benign promptsSED slopeAUROC0.95params=8B
Source quote
L1048: SED slope │ 0.89 │ 0.90 │ 0.79 │ 0.95 │ 0.91 │ 0.68
Anchoring attack at t=8 vs. benign promptsΔE slopeAUROC0.92params=8B
Source quote
L1049: \Delta E slope │ 0.39 │ 0.43 │ 0.43 │ 0.92 │ 0.82 │ 0.68
BibTeX
@inproceedings{bach2026why,
  author = {Thong Bach and Dung Nguyen and Thao Minh Le and Truyen Tran},
  title = {{Why Jailbreaks Succeed in Diffusion Language Models: An Energy Landscape Analysis}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=7iH3OSPbuG},
}
Figure