Introduction
Diffusion models have achieved state-of-the-art performance across a wide range of domains, including images (Rombach et al., 2022), speech (Popov et al., 2021), and protein structure generation (Wu et al., 2024). In language modeling, however, autoregressive large language models (AR-LLMs) remain the dominant approach, demonstrating strong capabilities in language generation and understanding, mathematical reasoning (Yang et al., 2024), and coding [16 ] . Despite their success, AR models generate text one token at a time, which inherently limits inference parallelism and makes revising previously generated content less natural.
Recent advances in Text Diffusion Models (TDMs) offer an alternative paradigm, in which text is generated through an iterative denoising process that can update multiple token positions and progressively refine the generated sequence (Sahoo et al., 2024; Nie et al., 2025). Moreover, at comparable model scales, recent TDMs have also shown competitive performance with AR-LLMs across benchmarks; For instance, Stable-DiffCoder-8B [6 ] vs. Seed-Coder-8B [2 ] on code generation benchmarks, and LLaDA-8B (Nie et al., 2025) vs. LLaMA3-8B [8 ] on mathematical reasoning tasks.
Despite these advantages, the safety of TDMs remains relatively underexplored compared to AR-LLMs, particularly with respect to toxic content generation and vulnerability to jailbreak attacks. Traditional safety mechanisms rely on fine-tuning and alignment [4 ] , post-hoc filtering and rejection sampling [21 ] , or inference-time methods that modify the decoding strategy during next-token prediction (Xu et al., 2024). However, these approaches either require additional training or assume AR decoding and therefore do not directly generalize to TDMs.
Recent work has begun exploring inference-time mechanisms specifically designed for TDMs, including particle-based steering (Singhal et al., 2025), classifier-based guidance (Schiff et al., 2025), and safety-oriented remasking approaches [15 ] . In particular, the Safety-Aware Denoiser (SAD) (Yusuf et al., 2026) provides a training-free framework to steer the denoising trajectory towards a safe region in the data distribution using only a small set of 500 ∼ 1000 unsafe reference samples. Nevertheless, SAD operates in token probability space, leaving open whether semantically richer model representations could enable more effective, position-specific safety guidance.
In this work, we propose SADDER (Safety-Aware Denoising with Directional Embedding-based Revision), a safety-guidance method that augments SAD with position-wise signals extracted from the model’s embedding space. At each denoising step, we first identify potentially unsafe token positions based on a safety-guidance signal in the embedding (or activation) space. We then use this information in a second step to modulate the SAD update, enabling more precise, position-by-position interventions along the sampling trajectory. By selectively modifying fewer positions, SADDER achieves a better balance between safety, generation quality, and inference cost than existing methods, when tested on popular Masked Diffusion Language Models (MDLMs) and Uniform-State Diffusion Models (USDMs) across unsafe continuation and jailbreak settings.
Background
We first describe two ingredients our method builds on: masked and uniform-state TDMs in Section 2.1, whose samplers differ in whether a committed token can still be changed in the subsequent denoising steps; and SAD in Section 2.2, the inference-time guidance framework that our method extends.
Text Diffusion Models
A TDM corrupts a clean token sequence x 0 1 : L x_0^{1:L} x 0 1 : L of length L L L with a fixed forward process and learns to reverse it. Tokens come from a vocabulary V \mathcal{V} V of size K K K and are represented as one-hot vectors, so a distribution over tokens is a vector in the simplex Δ K \Delta^K Δ K . Cat ( x ∣ π ) \operatorname{Cat}(x \mid\pi) Cat ( x ∣ π ) denotes the categorical distribution with probability vector π \pi π .
We write x t l x_t^l x t l for the token at position l l l and normalized diffusion time t ∈ [ 0 , 1 ] t \in[0,1] t ∈ [ 0 , 1 ] . Let α t ∈ [ 0 , 1 ] \alpha_t \in[0,1] α t ∈ [ 0 , 1 ] denote a noise schedule that decreases strictly in t t t with α 0 ≈ 1 \alpha_0 \approx1 α 0 ≈ 1 and α 1 ≈ 0 \alpha_1 \approx0 α 1 ≈ 0 . We discretize the diffusion time interval using a decreasing grid 1 = t 0 > t 1 > ⋯ > t T = 0 1 = t_0 > t_1 > \cdots> t_T = 0 1 = t 0 > t 1 > ⋯ > t T = 0 where T T T is the number of reverse sampling steps. At iteration j ∈ { 0 , … , T − 1 } j \in\{0,\ldots,T-1\} j ∈ { 0 , … , T − 1 } , the sampler transitions from x t j 1 : L x_{t_j}^{1:L} x t j 1 : L to x t j + 1 1 : L x_{t_{j+1}}^{1:L} x t j + 1 1 : L .
Masked diffusion language models (MDLMs). MDLMs (Sahoo et al., 2024; Nie et al., 2025; Ye et al., 2025) add a mask token with one-hot vector M \mathbf{M} M , so states live in { 0 , 1 } K + 1 \{0,1\}^{K+1} { 0 , 1 } K + 1 ; the network below never predicts the mask, so its outputs are in Δ K \Delta^K Δ K . In the forward process, each position transitions to the mask independently and, once masked, stays masked:
q t ( x t l ∣ x 0 l ) = Cat ( x t l ∣ α t x 0 l + ( 1 − α t ) M ) , (1) q_t(x_t^l \mid x_0^l) = \operatorname{Cat}(x_t^l \mid\alpha_t x_0^l + (1-\alpha_t)\mathbf{M}), \tag*{(1)} q t ( x t l ∣ x 0 l ) = Cat ( x t l ∣ α t x 0 l + ( 1 − α t ) M ) , (1)
i.e., the token is kept with probability α t \alpha_t α t and masked with probability 1 − α t 1-\alpha_t 1 − α t . The reverse process runs from the all-mask sequence back to t = 0 t = 0 t = 0 ; its transitions are the forward posterior q ( x s l ∣ x t l , x 0 l ) q(x_s^l \mid x_t^l, x_0^l) q ( x s l ∣ x t l , x 0 l ) with the unknown clean token replaced by the prediction of a denoising network x θ x_\theta x θ , which reads the whole noised sequence and outputs a distribution over the clean token at every position,
x θ : ( V ∪ { M } ) L × [ 0 , 1 ] ⟶ ( Δ K ) L , (2) x_\theta: (\mathcal{V} \cup\{\mathbf{M}\})^L \times[0,1] \longrightarrow(\Delta^K)^L, \tag*{(2)} x θ : ( V ∪ { M } ) L × [ 0 , 1 ] ⟶ ( Δ K ) L , (2)
with x θ , l ( x t 1 : L , t ) ∈ Δ K x_{\theta,l}(x_t^{1:L},t) \in\Delta^K x θ , l ( x t 1 : L , t ) ∈ Δ K the output at position l l l . Given x t 1 : L x_t^{1:L} x t 1 : L , the transition to an earlier level s < t s < t s < t factorizes across positions, with
p θ ( x s l ∣ x t 1 : L ) = { δ x t l ( x s l ) , x t l ≠ M , Cat ( x s l | ( 1 − α s ) M + ( α s − α t ) x θ , l ( x t 1 : L , t ) 1 − α t ) , x t l = M . (3) p_\theta(x_s^l \mid x_t^{1:L}) =
\begin{cases}
\delta_{x_t^l}(x_s^l), & x_t^l \ne\mathbf{M},\\
\operatorname{Cat}\left(x_s^l \,\middle|\, \dfrac{(1-\alpha_s)\mathbf{M}+(\alpha_s-\alpha_t)x_{\theta,l}(x_t^{1:L},t)}{1-\alpha_t}\right), & x_t^l = \mathbf{M}.
\end{cases} \tag*{(3)} p θ ( x s l ∣ x t 1 : L ) = ⎩ ⎨ ⎧ δ x t l ( x s l ) , Cat ( x s l 1 − α t ( 1 − α s ) M + ( α s − α t ) x θ , l ( x t 1 : L , t ) ) , x t l = M , x t l = M . (3)
Under equation 3, a revealed position is copied, and a masked position is revealed at random with probability ( α s − α t ) / ( 1 − α t ) (\alpha_s-\alpha_t)/(1-\alpha_t) ( α s − α t ) / ( 1 − α t ) , its token drawn from x θ , l x_{\theta,l} x θ , l . The samplers of LLaDA and Dream differ from equation 3 only in how they choose which masked positions to reveal (Nie et al., 2025; Ye et al., 2025). Remasking samplers (Wang et al., 2025) additionally return revealed positions to m m m so that they are predicted again.
Uniform-state diffusion models (USDMs). USDMs (Sahoo et al., 2025; 2026; DiffusionGemma Team, 2026) go a step further: they have no mask token, and any token can change at any step, which Sahoo et al. (2026) credit with self-correction and better guided generation. In the forward process, a token is kept with probability α t \alpha_t α t and otherwise replaced by one drawn uniformly from the vocabulary,
q t ( x t l ∣ x 0 l ) = Cat ( x t l ∣ α t x 0 l + ( 1 − α t ) 1 K 1 ) , (4) q_t(x_t^l \mid x_0^l) = \operatorname{Cat}\left(x_t^l \mid\alpha_t x_0^l + (1-\alpha_t)\frac{1}{K}\mathbf{1}\right), \tag*{(4)} q t ( x t l ∣ x 0 l ) = Cat ( x t l ∣ α t x 0 l + ( 1 − α t ) K 1 1 ) , (4)
with 1 \mathbf{1} 1 the all-ones vector. The reverse kernel is again the forward posterior with x 0 l x_0^l x 0 l replaced by the prediction; with α t ∣ s = α t / α s \alpha_{t\mid s}=\alpha_t/\alpha_s α t ∣ s = α t / α s , it is given by
q s ∣ t ( x s l ∣ x t l , x 0 l ) = Cat ( x s l | K α t x t l ⊙ x 0 l + ( α t ∣ s − α t ) x t l K α t ⟨ x t l , x 0 l ⟩ + 1 − α t + ( α s − α t ) x 0 l + ( 1 − α t ∣ s ) ( 1 − α s ) 1 / K K α t ⟨ x t l , x 0 l ⟩ + 1 − α t ) , (5) \begin{aligned}
q_{s\mid t}(x_s^l \mid x_t^l, x_0^l) \\
&= \operatorname{Cat}\left(x_s^l \middle| \frac{K\alpha_t x_t^l \odot x_0^l + (\alpha_{t\mid s}-\alpha_t)x_t^l}{K\alpha_t\langle x_t^l,x_0^l\rangle+ 1-\alpha_t} + \frac{(\alpha_s-\alpha_t)x_0^l + (1-\alpha_{t\mid s})(1-\alpha_s)1/K}{K\alpha_t\langle x_t^l,x_0^l\rangle+ 1-\alpha_t}\right), \tag*{(5)}
\end{aligned} q s ∣ t ( x s l ∣ x t l , x 0 l ) = Cat ( x s l K α t ⟨ x t l , x 0 l ⟩ + 1 − α t K α t x t l ⊙ x 0 l + ( α t ∣ s − α t ) x t l + K α t ⟨ x t l , x 0 l ⟩ + 1 − α t ( α s − α t ) x 0 l + ( 1 − α t ∣ s ) ( 1 − α s ) 1/ K ) , (5)
where ⊙ \odot ⊙ denotes the Hadamard product between two vectors and x 0 l = x θ , l ( x t 1 : L , t ) x_0^l=x_{\theta,l}(x_t^{1:L},t) x 0 l = x θ , l ( x t 1 : L , t ) is given by the pretrained model. Every entry of this vector can be positive, which is what lets any token change at any step.
The Safety-Aware Denoiser
The safety-aware denoiser (SAD) (Yusuf et al., 2026) is a training-free guidance method that steers a pretrained TDM away from a negation set of sequences that should not be generated. It adapts the safe denoiser of Kim et al. [12 ] , later extended to flow matching [13 ] , by replacing the Gaussian corruption kernel with the categorical kernels equation 1 and equation 4.
Safe Denoiser. Assume the training data D \mathcal{D} D split into safe and unsafe sets, D = D s a f e ∪ D u n s a f e \mathcal{D}=\mathcal{D}_{\mathrm{safe}}\cup\mathcal{D}_{\mathrm{unsafe}} D = D safe ∪ D unsafe with ∣ D s a f e ∣ ≫ ∣ D u n s a f e ∣ \lvert\mathcal{D}_{\mathrm{safe}}\rvert\gg\lvert\mathcal{D}_{\mathrm{unsafe}}\rvert ∣ D safe ∣ ≫ ∣ D unsafe ∣ . Restricting p d a t a p_{\mathrm{data}} p data to each set gives p s a f e p_{\mathrm{safe}} p safe and p u n s a f e p_{\mathrm{unsafe}} p unsafe , and running the forward process from p d a t a p_{\mathrm{data}} p data , p s a f e p_{\mathrm{safe}} p safe , and p u n s a f e p_{\mathrm{unsafe}} p unsafe defines the data, safe, and unsafe denoisers E D [ x 0 ∣ x t ] \mathbb{E}_{\mathcal{D}}[x_0\mid x_t] E D [ x 0 ∣ x t ] , E D s a f e [ x 0 ∣ x t ] \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}}[x_0\mid x_t] E D safe [ x 0 ∣ x t ] , and E D u n s a f e [ x 0 ∣ x t ] \mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0\mid x_t] E D unsafe [ x 0 ∣ x t ] , which are related as follows.
Theorem 2.1 (Theorem 3.2 in Kim et al. [12 ] ). There exists a nonnegative weight β ∗ ( x t ) \beta^*(x_t) β ∗ ( x t ) , monotone in the posterior likelihood that x t x_t x t originates from the unsafe set, such that
E D s a f e [ x 0 ∣ x t ] = E D [ x 0 ∣ x t ] + β ∗ ( x t ) ( E D [ x 0 ∣ x t ] − E D u n s a f e [ x 0 ∣ x t ] ) . (6) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}}[x_0\mid x_t]=\mathbb{E}_{\mathcal{D}}[x_0\mid x_t]+\beta^*(x_t)\left(\mathbb{E}_{\mathcal{D}}[x_0\mid x_t]-\mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0\mid x_t]\right). \tag*{(6)} E D safe [ x 0 ∣ x t ] = E D [ x 0 ∣ x t ] + β ∗ ( x t ) ( E D [ x 0 ∣ x t ] − E D unsafe [ x 0 ∣ x t ] ) . (6)
Thm. 2.1 states that by subtracting “unsafe” components from the data denoiser, with β ∗ \beta^* β ∗ adapting to how unsafe the current state is, we can provably generate samples from the safe denoiser. A pretrained model provides the data denoiser, so only the unsafe denoiser and β ∗ \beta^* β ∗ remain.
SAD. For a TDM, the data denoiser is simply the pre-trained model’s output, E D [ x 0 l ∣ x t 1 : L ] = x θ , l ( x t 1 : L , t ) \mathbb{E}_{\mathcal{D}}[x_0^l\mid x_t^{1:L}]=x_{\theta,l}(x_t^{1:L},t) E D [ x 0 l ∣ x t 1 : L ] = x θ , l ( x t 1 : L , t ) , since the mean of a categorical variable is its probability vector; the relation is exact for the ideal denoiser, which x θ x_\theta x θ approximates. The unsafe denoiser is approximated by Monte Carlo over a negation set, D u n s a f e = { x 0 ( n ) } n = 1 N \mathcal{D}_{\mathrm{unsafe}}=\{x_0^{(n)}\}_{n=1}^{N} D unsafe = { x 0 ( n ) } n = 1 N :
E ^ D u n s a f e [ x 0 ∣ x t ] = ∑ n = 1 N x 0 ( n ) q t ( x t ∣ x 0 ( n ) ) ∑ m = 1 N q t ( x t ∣ x 0 ( m ) ) , \hat{\mathbb{E}}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0\mid x_t]=\sum_{n=1}^{N}x_0^{(n)}\frac{q_t(x_t\mid x_0^{(n)})}{\sum_{m=1}^{N}q_t(x_t\mid x_0^{(m)})}, E ^ D unsafe [ x 0 ∣ x t ] = n = 1 ∑ N x 0 ( n ) ∑ m = 1 N q t ( x t ∣ x 0 ( m ) ) q t ( x t ∣ x 0 ( n ) ) ,
where q t ( x t ∣ x 0 ( n ) ) = ∏ l = 1 L q t ( x t l ∣ x 0 ( n ) , l ) q_t(x_t\mid x_0^{(n)})=\prod_{l=1}^{L}q_t(x_t^l\mid x_0^{(n),l}) q t ( x t ∣ x 0 ( n ) ) = ∏ l = 1 L q t ( x t l ∣ x 0 ( n ) , l ) is the sequence kernel from equation 1 or equation 4, a product because positions are noised independently. The precise definition of the weight is β ∗ ( x t ) = Z u n s a f e p u n s a f e , t ( x t ) / ( Z s a f e p s a f e , t ( x t ) ) \beta^*(x_t)=Z_{\mathrm{unsafe}}p_{\mathrm{unsafe},t}(x_t)/(Z_{\mathrm{safe}}p_{\mathrm{safe},t}(x_t)) β ∗ ( x t ) = Z unsafe p unsafe , t ( x t ) / ( Z safe p safe , t ( x t )) [12 Appendix A] , where p s a f e , t p_{\mathrm{safe},t} p safe , t and p u n s a f e , t p_{\mathrm{unsafe},t} p unsafe , t are the marginal distributions of the forward process at level t t t started from the safe and unsafe distribution, and Z s a f e Z_{\mathrm{safe}} Z safe and Z u n s a f e Z_{\mathrm{unsafe}} Z unsafe are the normalizing constants of the two restricted densities.
Unfortunately, directly computing β ∗ ( x t ) \beta^*(x_t) β ∗ ( x t ) is intractable : the denominator requires q t ( x t ∣ x 0 ) q_t(x_t\mid x_0) q t ( x t ∣ x 0 ) over all safe data, roughly most of the training set, at every sampling step. SAD approximates
β ∗ ( x t ) ≈ η β ( x t ) , \beta^*(x_t)\approx\eta\,\beta(x_t), β ∗ ( x t ) ≈ η β ( x t ) ,
using an unbiased estimate of β ( x t ) \beta(x_t) β ( x t ) and a hyperparameter η \eta η to replace the remaining terms of β ∗ \beta^* β ∗ .
β ( x t ) = ∫ p u n s a f e ( x 0 ) q t ( x t ∣ x 0 ) d x 0 ≈ 1 N ∑ n = 1 N q t ( x t ∣ x 0 ( n ) ) . (7) \beta(x_t) = \int p_{\mathrm{unsafe}}(x_0)\,q_t(x_t \mid x_0)\,\mathrm{d}x_0 \approx\frac{1}{N}\sum_{n=1}^{N} q_t(x_t \mid x_0^{(n)}). \tag*{(7)} β ( x t ) = ∫ p unsafe ( x 0 ) q t ( x t ∣ x 0 ) d x 0 ≈ N 1 n = 1 ∑ N q t ( x t ∣ x 0 ( n ) ) . (7)
Because SAD approximates β ∗ \beta^* β ∗ this way, the SAD implementation offers no theoretical safety guarantees on generated data, unlike what the theory in Thm. 2.1 promises.
Prior work shows that such guidance must be strong early in sampling and fade later, or it degrades sample quality [12 , 13 , 14 ] ; SAD therefore keeps η \eta η at a nonzero constant over a window C C C of critical timesteps at the start of the reverse process and sets η = 0 \eta= 0 η = 0 outside it.
Methods: SADDER
SAD provides safety guidance in the token probability space. We can enhance this guidance by selecting a guidance signal in the embedding (or activation) space for each token position, then modifying the selected token positions using the SAD update rule. In what follows, we introduce SADDER (Safety-Aware Denoising with Directional Embedding-based Revision), consisting of two phases.
First Phase: Selecting Risky Positions.
The goal of the first phase is to create a gating mechanism which tells us which token positions need to be modified. Inspired by [15 ] , we propose accessing TDM’s internal embedding space to obtain this information.
For each sample i i i , we denote c i c_i c i as a given prompt and x i h a r m x_i^{\mathrm{harm}} x i harm , x i s a f e x_i^{\mathrm{safe}} x i safe as two corresponding harmful and safe responses for c i c_i c i , respectively. We denote P i = ∣ c i ∣ P_i = |c_i| P i = ∣ c i ∣ as the prompt length and R i h a r m = min ( ∣ x i h a r m ∣ , M ) R_i^{\mathrm{harm}} = \min(|x_i^{\mathrm{harm}}|, M) R i harm = min ( ∣ x i harm ∣ , M ) the response length after truncation of M M M tokens. Similarly, R i s a f e = min ( ∣ x i s a f e ∣ , M ) R_i^{\mathrm{safe}} = \min(|x_i^{\mathrm{safe}}|, M) R i safe = min ( ∣ x i safe ∣ , M ) . Let h k , l ( ⋅ ) ∈ R d h_{k,l}(\cdot) \in\mathbb{R}^d h k , l ( ⋅ ) ∈ R d be the layer-k k k hidden representation at position l l l . h k , l ( t ) ( ⋅ ) h_{k,l}^{(t)}(\cdot) h k , l ( t ) ( ⋅ ) denotes the layer-k k k ’s hidden state for position l l l at timestep t t t . We extract hidden states and compute the average representations over response tokens:
h ˉ i , k h a r m = 1 R i h a r m ∑ l = P i + 1 P i + R i h a r m h k , l ( c i ⊕ x i h a r m ) , h ˉ i , k s a f e = 1 R i s a f e ∑ l = P i + 1 P i + R i s a f e h k , l ( c i ⊕ x i s a f e ) (8) \bar{h}_{i,k}^{\mathrm{harm}} = \frac{1}{R_i^{\mathrm{harm}}} \sum_{l=P_i+1}^{P_i+R_i^{\mathrm{harm}}} h_{k,l}(c_i \oplus x_i^{\mathrm{harm}}), \qquad\bar{h}_{i,k}^{\mathrm{safe}} = \frac{1}{R_i^{\mathrm{safe}}} \sum_{l=P_i+1}^{P_i+R_i^{\mathrm{safe}}} h_{k,l}(c_i \oplus x_i^{\mathrm{safe}}) \tag*{(8)} h ˉ i , k harm = R i harm 1 l = P i + 1 ∑ P i + R i harm h k , l ( c i ⊕ x i harm ) , h ˉ i , k safe = R i safe 1 l = P i + 1 ∑ P i + R i safe h k , l ( c i ⊕ x i safe ) (8)
We arrive at the (normalized) layer-wise difference in the semantic representations of harmful and safe responses, v ^ k \hat{v}_k v ^ k , by averaging over the examples i i i :
v ^ k = h ˉ k h a r m − h ˉ k s a f e ∥ h ˉ k h a r m − h ˉ k s a f e ∥ 2 , (9) \hat{v}_k = \frac{\bar{h}_k^{\mathrm{harm}} - \bar{h}_k^{\mathrm{safe}}}{\lVert\bar{h}_k^{\mathrm{harm}} - \bar{h}_k^{\mathrm{safe}} \rVert_2}, \tag*{(9)} v ^ k = ∥ h ˉ k harm − h ˉ k safe ∥ 2 h ˉ k harm − h ˉ k safe , (9)
where h ˉ k h a r m = 1 N h a r m ∑ i h ˉ i , k h a r m \bar{h}_k^{\mathrm{harm}} = \frac{1}{N_{\mathrm{harm}}} \sum_i \bar{h}_{i,k}^{\mathrm{harm}} h ˉ k harm = N harm 1 ∑ i h ˉ i , k harm , and h ˉ k s a f e = 1 N s a f e ∑ i h ˉ i , k s a f e \bar{h}_k^{\mathrm{safe}} = \frac{1}{N_{\mathrm{safe}}} \sum_i \bar{h}_{i,k}^{\mathrm{safe}} h ˉ k safe = N safe 1 ∑ i h ˉ i , k safe . Intuitively, we want to intervene on the token location only when the hidden state at time t t t is closer to the average harmful representations than to the average safe representations:
∥ h k , l ( t ) − h ˉ k h a r m ∥ 2 2 < ∥ h k , l ( t ) − h ˉ k s a f e ∥ 2 2 . (10) \lVert h_{k,l}^{(t)} - \bar{h}_k^{\mathrm{harm}} \rVert_2^2 < \lVert h_{k,l}^{(t)} - \bar{h}_k^{\mathrm{safe}} \rVert_2^2. \tag*{(10)} ∥ h k , l ( t ) − h ˉ k harm ∥ 2 2 < ∥ h k , l ( t ) − h ˉ k safe ∥ 2 2 . (10)
Using a midpoint m k = h ˉ k h a r m + h ˉ k s a f e 2 m_k = \frac{\bar{h}_k^{\mathrm{harm}}+\bar{h}_k^{\mathrm{safe}}}{2} m k = 2 h ˉ k harm + h ˉ k safe , a simple linear algebraic manipulation gives us the following equivalence:
∥ h k , l ( t ) − h ˉ k h a r m ∥ 2 2 < ∥ h k , l ( t ) − h ˉ k s a f e ∥ 2 2 ⟺ ⟨ h k , l ( t ) − m k , v ^ k ⟩ > 0 (11) \lVert h_{k,l}^{(t)} - \bar{h}_k^{\mathrm{harm}} \rVert_2^2 < \lVert h_{k,l}^{(t)} - \bar{h}_k^{\mathrm{safe}} \rVert_2^2 \Longleftrightarrow\left\langle h_{k,l}^{(t)} - m_k, \hat{v}_k \right\rangle> 0 \tag*{(11)} ∥ h k , l ( t ) − h ˉ k harm ∥ 2 2 < ∥ h k , l ( t ) − h ˉ k safe ∥ 2 2 ⟺ ⟨ h k , l ( t ) − m k , v ^ k ⟩ > 0 (11)
See Section A.2 for the derivation. Unlike [15 ] , we use the centred score to decide whether this particular position will lead to harmful generation:
s k , l ( t ) : = ⟨ h k , l ( t ) − m k , v ^ k ⟩ . (12) s_{k,l}^{(t)} := \left\langle h_{k,l}^{(t)} - m_k, \hat{v}_k \right\rangle. \tag*{(12)} s k , l ( t ) := ⟨ h k , l ( t ) − m k , v ^ k ⟩ . (12)
Algorithm 1 SADDER: selective SAD guidance.
Input: denoiser p θ p_\theta p θ ; unsafe dataset D u n s a f e \mathcal{D}_{\mathrm{unsafe}} D unsafe ; v ^ k , m k \hat{v}_k, m_k v ^ k , m k ; initial state x t 0 x_{t_0} x t 0 ; editable positions G \mathcal{G} G ; time steps t 0 > ⋯ > t T = 0 t_0 > \cdots> t_T = 0 t 0 > ⋯ > t T = 0 ; intervention steps C C C ; strength η \eta η .
for j = 0 , … , T − 1 j = 0, \ldots, T - 1 j = 0 , … , T − 1 do
Set t ← t j t \leftarrow t_j t ← t j . Obtain p D , t , ⋅ p_{D,t,\cdot} p D , t , ⋅ and h k , l ( t ) h_{k,l}^{(t)} h k , l ( t ) from one model evaluation on x t x_t x t .
Initialize p ~ 0 ∣ t , l ← p D , t , l \tilde{p}_{0|t,l} \leftarrow p_{D,t,l} p ~ 0∣ t , l ← p D , t , l and a k , l ( t ) ← 0 a_{k,l}^{(t)} \leftarrow0 a k , l ( t ) ← 0 for all l l l .
if j ∈ C j \in C j ∈ C then
if MDLMs then M t ← { l ∈ G : x t l = M } \mathcal{M}_t \leftarrow\{l \in\mathcal{G} : x_t^l = \mathrm{M}\} M t ← { l ∈ G : x t l = M }
if USDMs then M t ← { 1 , … , L } \mathcal{M}_t \leftarrow\{1, \ldots, L\} M t ← { 1 , … , L } .
Compute s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ s_{k,l}^{(t)} \leftarrow\langle h_{k,l}^{(t)} - m_k, \hat{v}_k \rangle s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ for l ∈ M t l \in\mathcal{M}_t l ∈ M t .
Select Risky Positions: a k , l ( t ) ← 1 { s k , l ( t ) > 0 } a_{k,l}^{(t)} \leftarrow\mathbb{1}\{s_{k,l}^{(t)} > 0\} a k , l ( t ) ← 1 { s k , l ( t ) > 0 } for l ∈ M t l \in\mathcal{M}_t l ∈ M t .
if at least one gate equals 1 then
Estimate E D u n s a f e [ x 0 l ∣ x t 1 : L ] \mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0^l \mid x_t^{1:L}] E D unsafe [ x 0 l ∣ x t 1 : L ] and β ( x t ) \beta(x_t) β ( x t ) on the current state.
SAD On Selected Positions: Compute Sadder Denoiser in equation 14.
end if
end if
x t j + 1 ← Solver ( x t , t j , t j + 1 , Sadder Denoiser ; G ) x_{t_{j+1}} \leftarrow\operatorname{Solver}(x_t, t_j, t_{j+1}, \text{Sadder Denoiser}; \mathcal{G}) x t j + 1 ← Solver ( x t , t j , t j + 1 , Sadder Denoiser ; G ) .
end for
Return: the generated continuation of x t T x_{t_T} x t T .
Geometric meaning of equation 12: The set of h k , l ( t ) h_{k,l}^{(t)} h k , l ( t ) that satisfies ⟨ h k , l ( t ) − m k , v ^ k ⟩ = 0 \langle h_{k,l}^{(t)} - m_k, \hat{v}_k \rangle= 0 ⟨ h k , l ( t ) − m k , v ^ k ⟩ = 0 is the hyperplane, in which every vector h k , l ( t ) − m k h_{k,l}^{(t)} - m_k h k , l ( t ) − m k is orthogonal to the direction v ^ k \hat{v}_k v ^ k . Any h k , l ( t ) h_{k,l}^{(t)} h k , l ( t ) that satisfies ⟨ h k , l ( t ) − m k , v ^ k ⟩ > 0 \langle h_{k,l}^{(t)} - m_k, \hat{v}_k \rangle> 0 ⟨ h k , l ( t ) − m k , v ^ k ⟩ > 0 lies on the side of this hyperplane containing h ˉ k h a r m \bar{h}_k^{\mathrm{harm}} h ˉ k harm . On the contrary, any h k , l ( t ) h_{k,l}^{(t)} h k , l ( t ) that satisfies ⟨ h k , l ( t ) − m k , v ^ k ⟩ < 0 \langle h_{k,l}^{(t)} - m_k, \hat{v}_k \rangle< 0 ⟨ h k , l ( t ) − m k , v ^ k ⟩ < 0 lies on the side of this hyperplane containing h ˉ k s a f e \bar{h}_k^{\mathrm{safe}} h ˉ k safe .
The tokens that have positive scores, through the following gating mechanism:
a k , l ( t ) ← 1 s k , l ( t ) > 0 , (13) a_{k,l}^{(t)} \leftarrow\mathbb{1}_{s_{k,l}^{(t)}>0}, \tag*{(13)} a k , l ( t ) ← 1 s k , l ( t ) > 0 , (13)
where 1 \mathbb{1} 1 is an indicator function that returns the binary1 gating values: a k , l ( t ) ∈ { 0 , 1 } a_{k,l}^{(t)} \in\{0, 1\} a k , l ( t ) ∈ { 0 , 1 } .
Second Phase: SAD on Selected Positions
In the first phase, we select which position is aligned with the harmful direction in the embedding space. In the second phase, we modify the sampling trajectory of the selected ones using the SAD denoiser formulation, given by
Sadder Denoiser : = ∏ l = 1 L [ E D [ x 0 l ∣ x t 1 : L ] + η β ( x t ) a k , l ( t ) ( E D [ x 0 l ∣ x t 1 : L ] − E D u n s a f e [ x 0 l ∣ x t 1 : L ] ) ] (14) \operatorname{Sadder\ Denoiser} := \prod_{l=1}^{L} \left[\mathbb{E}_{D}[x_0^l \mid x_t^{1:L}] + \eta\beta(x_t)a_{k,l}^{(t)}\left(\mathbb{E}_{D}[x_0^l \mid x_t^{1:L}] - \mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0^l \mid x_t^{1:L}]\right)\right] \tag*{(14)} Sadder Denoiser := l = 1 ∏ L [ E D [ x 0 l ∣ x t 1 : L ] + η β ( x t ) a k , l ( t ) ( E D [ x 0 l ∣ x t 1 : L ] − E D unsafe [ x 0 l ∣ x t 1 : L ] ) ] (14)
where β ( x t ) \beta(x_t) β ( x t ) is defined in equation 7 and η \eta η is a controllable hyperparameter that changes the strength of the guidance as in SAD. Similar to SAD, the data denoiser at position l l l is E D [ x 0 l ∣ x t 1 : L ] \mathbb{E}_{D}[x_0^l \mid x_t^{1:L}] E D [ x 0 l ∣ x t 1 : L ] and the unsafe denoiser at position l l l is approximated by
E D u n s a f e [ x 0 l ∣ x t 1 : L ] ≈ ∑ x n ∈ D u n s a f e x n l q t ( x t ∣ x n l ) ∑ x m ∈ D u n s a f e q t ( x t ∣ x m l ) . (15) \mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0^l \mid x_t^{1:L}] \approx\sum_{x_n \in\mathcal{D}_{\mathrm{unsafe}}} x_n^l \frac{q_t(x_t \mid x_n^l)}{\sum_{x_m \in\mathcal{D}_{\mathrm{unsafe}}} q_t(x_t \mid x_m^l)}. \tag*{(15)} E D unsafe [ x 0 l ∣ x t 1 : L ] ≈ x n ∈ D unsafe ∑ x n l ∑ x m ∈ D unsafe q t ( x t ∣ x m l ) q t ( x t ∣ x n l ) . (15)
Algorithm 1 summarizes our algorithm.
Theoretical analyses of SADDER
In Safe Denoiser, equation 6 provides an identity of conditional expectations under a particular safe/unsafe partition, while, in the implementation of SAD, this quantity is approximated by a well-tuned hyperparameter η \eta η . A freely chosen position-dependent gate at l l l in SADDER also changes that identity, as in SAD. In the following theorem, we formally derive under what condition this new target denoiser is a position-wise safe denoiser.
Theorem 3.1 (Characterization of an exact position-wise safe denoiser). Given a data denoiser from a pre-trained diffusion model, an unsafe denoiser in equation 15, and the intervention strength: η β ( x t ) a k , l ( t ) \eta\beta(\mathbf{x}_t)a_{k,l}^{(t)} η β ( x t ) a k , l ( t ) , the position-l l l factor of the SADDER Denoiser in equation 14 is exactly the conditional mean under the position-wise safe target distribution D s a f e ( l ) \mathcal{D}_{\mathrm{safe}}^{(l)} D safe ( l ) :
E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] = E D [ x 0 l ∣ x t 1 : L ] + η β ( x t ) a k , l ( t ) ( E D [ x 0 l ∣ x t 1 : L ] − E D u n s a f e [ x 0 l ∣ x t 1 : L ] ) (16) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[x_0^l \mid x_t^{1:L}] = \mathbb{E}_{\mathcal{D}}[x_0^l \mid x_t^{1:L}] + \eta\beta(\mathbf{x}_t)a_{k,l}^{(t)}\left(\mathbb{E}_{\mathcal{D}}[x_0^l \mid x_t^{1:L}] - \mathbb{E}_{\mathcal{D}_{\mathrm{unsafe}}}[x_0^l \mid x_t^{1:L}]\right) \tag*{(16)} E D safe ( l ) [ x 0 l ∣ x t 1 : L ] = E D [ x 0 l ∣ x t 1 : L ] + η β ( x t ) a k , l ( t ) ( E D [ x 0 l ∣ x t 1 : L ] − E D unsafe [ x 0 l ∣ x t 1 : L ] ) (16) if the activation strength is calibrated to the posterior unsafe odds according to
η β ( x t ) a k , l ( t ) = π t , l ( x t 1 : L ) 1 − π t , l ( x t 1 : L ) , (17) \eta\beta(\mathbf{x}_t)a_{k,l}^{(t)} = \frac{\pi_{t,l}(x_t^{1:L})}{1-\pi_{t,l}(x_t^{1:L})}, \tag*{(17)} η β ( x t ) a k , l ( t ) = 1 − π t , l ( x t 1 : L ) π t , l ( x t 1 : L ) , (17) where the posterior probability of the position-l l l being unsafe is denoted by π t , l ( x t 1 : L ) : = E D [ ψ l ( x 0 1 : L ) ∣ x t 1 : L ] \pi_{t,l}(x_t^{1:L}) := \mathbb{E}_{\mathcal{D}}[\psi_l(x_0^{1:L}) \mid x_t^{1:L}] π t , l ( x t 1 : L ) := E D [ ψ l ( x 0 1 : L ) ∣ x t 1 : L ] , and the unsafety is measured by an oracle function denoted by ψ l : V L ⟶ [ 0 , 1 ] \psi_l : \mathcal{V}^L \longrightarrow[0,1] ψ l : V L ⟶ [ 0 , 1 ] , satisfying ψ l ( x 0 1 : L ) + ( 1 − ψ l ( x 0 1 : L ) ) = 1 \psi_l(x_0^{1:L}) + (1-\psi_l(x_0^{1:L})) = 1 ψ l ( x 0 1 : L ) + ( 1 − ψ l ( x 0 1 : L )) = 1 for any clean sequence x 0 1 : L x_0^{1:L} x 0 1 : L .
See Section A.4 for proof.
Remark 1. Thm. 3.1 characterizes our algorithm, SADDER, in terms of a position-wise safe-denoiser guarantee, rather than asserting that the exact membership function ψ \psi ψ is available at inference. However, it identifies the quantity that the activation gate should approximate: the posterior expected unsafe membership of clean sequences compatible with the current noised state. In practice, the centred activation score is a surrogate for this quantity without formal guarantees, like β ∗ ( x t ) \beta^*(\mathbf{x}_t) β ∗ ( x t ) was approximated by η β ( x t ) \eta\beta(\mathbf{x}_t) η β ( x t ) in SAD; the resulting SADDER denoiser is also approximate.
The position-specific target distribution p D s a f e ( l ) p_{\mathcal{D}_{\mathrm{safe}}}^{(l)} p D safe ( l ) for each position l l l , stated in Thm. 3.1, may differ for each l l l : p D s a f e ( 1 ) , ⋯ , p D s a f e ( L ) p_{\mathcal{D}_{\mathrm{safe}}}^{(1)}, \cdots, p_{\mathcal{D}_{\mathrm{safe}}}^{(L)} p D safe ( 1 ) , ⋯ , p D safe ( L ) . Hence, a natural next question is whether there exists one clean-sequence distribution p D s a f e g l o b a l ( x 0 1 : L ) p_{\mathcal{D}_{\mathrm{safe}}}^{\mathrm{global}}(\mathbf{x}_0^{1:L}) p D safe global ( x 0 1 : L ) , such that simultaneously for every l l l , it satisfies E D s a f e g l o b a l ( x 0 l ∣ x t 1 : L ) = E D s a f e ( l ) ( x 0 l ∣ x t 1 : L ) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{\mathrm{global}}}(x_0^l \mid x_t^{1:L}) = \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(x_0^l \mid x_t^{1:L}) E D safe global ( x 0 l ∣ x t 1 : L ) = E D safe ( l ) ( x 0 l ∣ x t 1 : L ) . Thm. A.1 states this formally.
Related Work
Activation steering and remasking. Contrastive Activation Addition (Rimsky et al., 2024) steers language models using directions extracted from paired examples; ILRR ([1 ] ) guides masked diffusion by aligning activations with a reference sequence. For safety, Diffu-Guard ([17 ] ) combines stochastic remasking with block-level audit and repair. Most closely related, Lee & Han [15 ] construct paired samples ( x i , y i h a r m , y i s a f e ) (x_i, y_i^{\mathrm{harm}}, y_i^{\mathrm{safe}}) ( x i , y i harm , y i safe ) , using harmful model responses to WildJailbreak prompts ([11 ] ) and paraphrased refusals. They estimate a Contrastive Safety Direction (CSD), ν \nu ν , from the difference between the mean harmful and safe response representations. In Phase 1 , they modify hidden states at masked and prompt positions during the first fraction ρ \rho ρ of the denoising steps: S ( h ℓ , j ( t ) ) = h ℓ , j ( t ) − β ⟨ h ℓ , j ( t ) , v ^ ℓ ⟩ v ^ ℓ \mathcal{S}(h_{\ell,j}^{(t)}) = h_{\ell,j}^{(t)} - \beta\langle h_{\ell,j}^{(t)}, \hat{v}_{\ell} \rangle\hat{v}_{\ell} S ( h ℓ , j ( t ) ) = h ℓ , j ( t ) − β ⟨ h ℓ , j ( t ) , v ^ ℓ ⟩ v ^ ℓ , where v ^ ℓ \hat{v}_{\ell} v ^ ℓ is the normalized CSD and β \beta β controls the intervention strength. In Phase 2 , they refine the generated sequence by selecting positions according to m j ( k ) = 1 { ⟨ h ℓ , j ( k ) , v ^ ℓ ⟩ > θ } m_j^{(k)} = \mathbb{1}\{\langle h_{\ell,j}^{(k)}, \hat{v}_{\ell} \rangle> \theta\} m j ( k ) = 1 {⟨ h ℓ , j ( k ) , v ^ ℓ ⟩ > θ } , then remasking and regenerating those positions for up to K K K refinement iterations, stopping early if no positions exceed the threshold. SADDER uses a similar contrastive direction, but centres the activation score at the midpoint of the harmful and safe representations. This places the zero-score boundary at their Euclidean bisector. The score gates SAD’s correction in token probability space rather than directly modifying hidden states; in masked models, it also ranks revealed positions for budgeted remasking within the denoising loop.
Sampling-based baselines. Best-of-N N N sampling generates independent candidate completions and selects the one with the highest reward. FK steering (Singhal et al., 2025) instead maintains multiple diffusion trajectories and resamples them at intermediate steps using reward-derived potentials. Both provide inference-time control without retraining the generator. SADDER modifies token predictions within each trajectory, using unsafe references and activation scores rather than ranking candidate sequences. Comparisons with Best-of-N N N and FK steering assess whether this local intervention offers a better safety–quality tradeoff at a given inference budget.
Diffusion-specific jailbreaks. DIJA (Wen et al., 2026) constructs interleaved text–mask prompts that exploit bidirectional context and parallel decoding to elicit harmful completions. PAD (Zhang et al., 2025) adapts affirmative-response priming to parallel generation through a multi-point attention attack. These attacks expose vulnerabilities associated with diffusion’s generation process and motivate evaluating safety guidance on adversarially structured inputs as well as ordinary unsafe continuation. We include all in our evaluation of selective guidance and token revision.
Experiments
We ask whether selective guidance improves the safety–quality tradeoff of SAD, and whether its benefits transfer from unsafe continuation to adversarial instructions. Following Yusuf et al. (2026), we evaluate these tasks separately. The main continuation results distinguish SADDER from SADDER with a full-SAD warm-up. Other variants, calibration sweeps, and the extended algorithm are reported in Appendix § 15 .
Unsafe continuation on Masked Diffusion Language Models (MDLMs)
Setting and metrics. We evaluate LLaDA-8B-Base Nie et al. (2025) and Dream-7B-Base Ye et al. (2025) on 600 unsafe prompts updated from RealToxicityPrompts (RTP) Gehman et al. [7 ] and BeaverTails (BT) Ji et al. [10 ] , generating 32 tokens in 32 steps. Baselines are unmodified sampling, full SAD, adapted CSD† (Lee & Han, [15 ] ), best-of-eight (BoN-8), and eight-particle FK steering (Singhal et al., 2025). SADDER + warm-up applies full SAD on steps 0–7 and selective guidance on steps 8–15. Evaluation prompts were held out from development; later hyperparameter selection uses a separate 300-prompt development set (Appendix § 15 ).
Safety is the Llama-Guard-3-8B Meta [20 ] unsafe rate. Harmful PPL is GPT-2-large (Radford et al., 2019) corpus perplexity over all outputs to harmful prompts, including safe outputs. Benign BERT (BERTScore F1 × 100) and Benign PPL use 600 benign RTP prompt-continuation pairs, retaining each method’s safety-selected settings and reference set. NFE counts generator forward evaluations, excluding reward scoring and one-time reference encoding.
Safety–quality tradeoffs. On LLaDA/RTP, SADDER lowers the unsafe rate from 38.6% unmodified to 29.4%, versus 32.4% for full SAD; warm-up reaches 31.2%. On BeaverTails, SADDER reaches 29.9%, full SAD 27.1%, and warm-up 24.4%. Across all four model/dataset settings, SADDER achieves higher benign BERTScore and lower benign PPL than full SAD. SADDER also achieves higher benign BERTScore than warm-up throughout, although both variants remain below unmodified sampling on this metric (Table 1 and Table 9 ). Harmful-prompt PPL reveals a different trade-off: on LLaDA/RTP, CSD reaches a 22.4% unsafe rate but PPL 225, versus 42.1 for SADDER and 31.6 for warm-up without remasking. CSD’s benign PPL of 21.6 does not expose this deterioration on harmful prompts. Gains also depend on the model: on Dream, full SAD at η = 10,000 \eta= 10{,}000 η = 10 , 000 achieves lower unsafe rates than either SADDER variant on both datasets. BoN-8 further reduces unsafe rates at a cost of 256 generator evaluations plus reward scoring.
Table 1 : LLaDA-Base safety, generation quality, and cost. Entries use A b A_b A b , where A A A is the mean and b b b is one sample standard deviation across three generation seeds. For percentages, SDs are in percentage points. NFE shows average cost.
Table 1. LLaDA-Base safety, generation quality, and cost.
Table 9. Dream-Base safety, generation quality, and cost.
Unsafe Continuation on Uniform-State Diffusion Models
Setting and metrics. We evaluate Duo ((Sahoo et al., 2025)) and UDLM ((Schiff et al., 2025)) on 300 unsafe prompt records from RealToxicityPrompts (RTP). Both models generate at a context length of 128 in 128 denoising steps. Unsafe references and contrastive directions follow § 5.1 , with k ∈ { 6 , 9 , 12 } k \in\{6, 9, 12\} k ∈ { 6 , 9 , 12 } . Baselines are unmodified sampling, full SAD, CSD†, and best-of-N N N for N ∈ { 3 , 5 , 8 } N \in\{3, 5, 8\} N ∈ { 3 , 5 , 8 } . Full SAD and SADDER sweep η ∈ { 3 × 10 4 , 5 × 10 4 , 10 5 , 1.5 × 10 5 } \eta\in\{3 \times10^{4}, 5 \times10^{4}, 10^{5}, 1.5 \times10^{5}\} η ∈ { 3 × 1 0 4 , 5 × 1 0 4 , 1 0 5 , 1.5 × 1 0 5 } . In masked models, guidance must reach a position before it is revealed. Uniform-state samplers have no such constraint, so we gate every position at every step, using (13) for SADDER and no gate for full SAD.
Safety is the Llama-Guard-3-8B unsafe rate. Benign BERT uses 300 separate benign RTP prompt–continuation pairs. All entries are means over five generation seeds, and Appendix I reports exact values with seed standard deviations.
Safety–quality tradeoffs. Figure 1 reports the tradeoff. On UDLM, SADDER reaches a 45.9% unsafe rate, against 68.5% without steering and 47.4% for the lowest unsafe rate among full SAD settings. SADDER’s benign BERTScore is 80.92, against 80.49 for full SAD and 80.81 unmodified, so it is safer than full SAD without any loss in reference similarity. On Duo, full SAD reaches lower unsafe rates than SADDER at every η \eta η , from 43.4% versus 47.2% at η = 3 × 10 4 \eta= 3 \times10^{4} η = 3 × 1 0 4 to 41.1% versus 43.6% at η = 1.5 × 10 5 \eta= 1.5 \times10^{5} η = 1.5 × 1 0 5 . The same holds at matched benign BERTScore: full SAD reaches 43.4% at 81.77, where SADDER reaches 45.0%. What SADDER does buy is quality, on both models: at every η \eta η its benign BERTScore is higher than full SAD’s. On Duo the gap is widest at the end of the sweep, 81.68 against 80.76.
Figure 1. Safety–quality tradeoff at equal NFE on Duo and UDLM. Best-of-N N N is reported in Appendix I. Larger markers denote larger guidance strength η \eta η . The dashed vertical line marks the unmodified model’s benign BERTScore, and error bars are one standard deviation across seeds.
SADDER, full SAD, and CSD† use the same number of generator evaluations, whereas best-of-N N N uses N N N times as many. Neither baseline is consistent across the two models. On Duo, best-of-8 reaches 33.1%, the lowest unsafe rate we observe, yet on UDLM best-of-N N N does not improve on unmodified sampling at any budget. CSD† reaches 35.1% on Duo at k = 9 k = 9 k = 9 but 63.5% on UDLM at the same layer, and it is sensitive to the layer choice: across k k k , its unsafe rate on Duo spans 15.5 points, whereas SADDER’s varies by at most 2.2 points at fixed η \eta η .
Jailbreak robustness on instruction-tuned models
Setting. We evaluate DIJA and PAD on LLaDA-8B-Instruct and Dream-7B-Instruct using 100 held-out HarmBench behaviors, 128 sampling steps, and WildJailbreak Jiang et al. [11 ] unsafe references. CSD and SADDER share the unsafe-response set. DiffuGuard [17 ] is evaluated with full repair, which can modify fixed attack text, and gen repair, restricted to initially masked positions; their audit thresholds also differ (Appendices § 18 and § 11 .§ 6 ).
Table 2 reports full-response HarmBench (HB) ASR, LlamaGuard (LG) unsafe rate, harmful PPL, and NFE. XSTest over-refusal uses WildGuard (WG) Han et al., [9 ] judgments on 250 safe, unmodified prompts across three seeds, with the DIJA guidance configuration. WG rates use valid labels (non-empty) within each seed, then average across seeds. Appendices § 18 .§ 5 and § 18 .§ 2 report generated-span judgments, valid-score counts, paired comparisons, and calibration-prompt reuse.
Table 2. Dream-Instruct: held-out HarmBench attacks and XSTest over-refusal. Entries use A b A_b A b : mean and sample SD across three seeds (percentage points for rates). HB, LG, and PPL assess complete responses. XSTest reports full-response WG refusal on safe prompts, using valid judge labels only (coverage in Appendix § 18 .§ 2 ). NFE is mean cost.
Attack and evaluator dependence. Under DIJA, SADDER and warm-up leave HB ASR near unmodified sampling, while LG flags roughly four-fifths of responses as unsafe. Large HB reductions from CSD and full-block DiffuGuard do not yield comparable LG reductions: Dream’s full-block DiffuGuard reaches 33.3% HB ASR but 84.0% LG unsafe rate and harmful PPL 537. Both judges assess complete responses, so this discrepancy cannot be attributed solely to scaffold inclusion. Appendix § 18 .§ 5 separates evaluator choice from the influence of fixed attack text by comparing full-response and generated-span judgments on the same outputs. SADDER retains generator cost and incurs a smaller PPL increase, but offers limited DIJA robustness.
PAD gives a more favorable result: Dream warm-up reduces HB ASR by 9.0 points (paired 95% CI: [−15.7, −2.3]), lowers LG unsafe rate from 64.0% to 55.0%, and increases PPL from 8.53 to 10.40. This supports an attack-specific tradeoff rather than general jailbreak robustness. Appendix § 18 reports component, strength, and timing studies.
Over-refusal. Dream warm-up reduces WG refusal on safe XSTest prompts by 35.4 points on jointly scored outputs (95% CI: [−41.6, −29.3]), but raises WG harmfulness on unsafe contrasts from 0.0% to 6.9% among scored responses. Fewer refusals therefore do not establish greater helpfulness at unchanged safety.
Summary and Discussion
We introduced SADDER, an extension of the Safety-Aware Denoiser, using midpoint-centred contrastive activation scores to select where to apply probability-space safety guidance. Rather than directly
AI Use Statement
We used generative AI tools, to assist with refining research hypotheses and experimental designs, reviewing mathematical derivations and proof arguments, analyzing and interpreting experimental results, and implementing and debugging experimental code. We also used these tools to draft and revise portions of the manuscript, improve clarity and organization, prepare LaTeX pseudocode, and identify and discuss relevant literature. The models used for text generation and automated safety evaluation within our experiments are described in the experimental protocol.
The authors reviewed and revised the AI-assisted material included in this work. We checked mathematical statements and derivations, verified references against the cited sources, and checked reported numerical claims against experimental outputs. AI-generated code was reviewed and revised by the authors before use in the experiments. The authors made the final methodological decisions and determined the interpretation and presentation of the findings. We take responsibility for the final content of this work, including all text, claims, and artifacts produced with the assistance of generative AI.
Ethics Statement
This work investigates training-free safety guidance for text diffusion models. Our experiments involve toxic text, harmful instructions, and adversarial prompts from existing datasets and benchmarks. These materials serve a defensive evaluation purpose but may contain offensive or distressing content. Analysis of model vulnerabilities could also inform attempts to circumvent safeguards. Any release of associated harmful generations or attack artifacts should therefore consider risks of misuse, exposure to harmful content, and disclosure of sensitive information. Furthermore, safety guidance could be misused to suppress legitimate expression, while overly broad or biased safety criteria may restrict benign content and disproportionately affect particular communities.
Our evaluation relies on benchmark datasets and automated safety judges, which may reflect social biases and fail to capture context-dependent harms. Differences between evaluators further limit the interpretation of reported safety metrics. We report safety alongside generation quality, inference cost, and over-refusal, including settings where the proposed guidance offers limited benefit. Reduced refusal does not necessarily imply improved helpfulness, and lower measured attack success does not establish that responses are safe or usable. Our findings are restricted to the evaluated models, datasets, and sampling configurations; they do not establish safety across untested settings. Deployment would require additional assessment of robustness, fairness, and risks specific to the intended application.
Reproducibility Statement
The main text presents the mathematical formulation of SADDЕR, and Algorithm 1 specifies the selective guidance procedure. Appendix § 11 .§ 2 derives the centered-score equivalence, and Appendices § 11 .§ 4 and § 11 .§ 5 provide proofs of the theoretical results. Appendix § 11 .§ 6 describes the datasets, prompt selection, and reference-set construction. Appendix § 11 .8 documents shared settings, hyper-parameter ranges, and configuration selection, while Appendix § 12 details the sampling extensions. Appendices § 15 and § 18 report additional experimental settings and results. Appendix § 18 .§ 5 compares evaluators and response scopes, and Appendix § 18 .§ 2 describes refusal evaluation and the handling of missing judge labels. Appendix § 12 .§ 2 specifies metric aggregation, seed standard deviations, bootstrap intervals, and paired comparisons. These materials support independent implementation and assessment of the reported results.
Acknowledgments
This work was supported by Mitacs through the Mitacs Accelerate program, in partnership with RBC Borealis (Royal Bank of Canada).
Appendix
Notation
Tables 3 and 4 collect the notation for selective SADDER and its theoretical analysis. The special mask token M M M is distinct from the centroid midpoint m k m_k m k and response truncation cap M M M . We distinguish decreasing noise time t t t from the increasing reverse iteration index j j j : j = 0 j = 0 j = 0 is the first model update, and the corresponding noise levels satisfy t 0 > ⋯ > t T = 0 t_0 > \cdots> t_T = 0 t 0 > ⋯ > t T = 0 . All experimental windows below use inclusive iteration indices. So C = 0 C = 0 C = 0 –15 means 16 updates. The optional warm-up length w w w counts initial full-SAD updates; w = 8 w = 8 w = 8 uses updates 0–7.
Table 3. Notation for selective SADDER.
Table 4. Denoiser and theoretical notation.
Derivation of equivalence
Expanding the relationship in equation 10 gives us
2 ⟨ h k , l ( t ) , h ˉ k h a r m − h ˉ k s a f e ⟩ > ∥ h k h a r m ∥ 2 2 − ∥ h k s a f e ∥ 2 2 . (18) 2\left\langle h_{k,l}^{(t)},\bar{h}_k^{\mathrm{harm}}-\bar{h}_k^{\mathrm{safe}}\right\rangle> \lVert h_k^{\mathrm{harm}}\rVert_2^2-\lVert h_k^{\mathrm{safe}}\rVert_2^2. \tag*{(18)} 2 ⟨ h k , l ( t ) , h ˉ k harm − h ˉ k safe ⟩ > ∥ h k harm ∥ 2 2 − ∥ h k safe ∥ 2 2 . (18)
In terms of v ^ k \hat{v}_k v ^ k , this is,
⟨ h k , l ( t ) , v ^ k ⟩ > ∥ h ˉ k h a r m ∥ 2 2 − ∥ h ˉ k s a f e ∥ 2 2 2 ∥ h ˉ k h a r m − h ˉ k s a f e ∥ . (19) \left\langle h_{k,l}^{(t)},\hat{v}_k\right\rangle> \frac{\left\|\bar{h}_k^{\mathrm{harm}}\right\|_2^2-\left\|\bar{h}_k^{\mathrm{safe}}\right\|_2^2}{2\left\|\bar{h}_k^{\mathrm{harm}}-\bar{h}_k^{\mathrm{safe}}\right\|}. \tag*{(19)} ⟨ h k , l ( t ) , v ^ k ⟩ > 2 h ˉ k harm − h ˉ k safe h ˉ k harm 2 2 − h ˉ k safe 2 2 . (19)
For notational simplicity, we ignore superscripts and subscripts j , k , t j,k,t j , k , t below.
⟨ h , v ^ ⟩ > ∥ h ˉ h a r m ∥ 2 2 − ∥ h ˉ s a f e ∥ 2 2 2 ∥ h ˉ h a r m − h ˉ s a f e ∥ , (20) \langle h,\hat{v}\rangle> \frac{\left\|\bar{h}^{\mathrm{harm}}\right\|_2^2-\left\|\bar{h}^{\mathrm{safe}}\right\|_2^2}{2\left\|\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right\|}, \tag*{(20)} ⟨ h , v ^ ⟩ > 2 h ˉ harm − h ˉ safe h ˉ harm 2 2 − h ˉ safe 2 2 , (20)
since ⟨ h − m , v ^ ⟩ = ⟨ h , v ^ ⟩ − ⟨ m , v ^ ⟩ \langle h-m,\hat{v}\rangle=\langle h,\hat{v}\rangle-\langle m,\hat{v}\rangle ⟨ h − m , v ^ ⟩ = ⟨ h , v ^ ⟩ − ⟨ m , v ^ ⟩ , we rewrite the above equation by
⟨ h − m , v ^ ⟩ > ∥ h ˉ h a r m ∥ 2 2 − ∥ h ˉ s a f e ∥ 2 2 2 ∥ h ˉ h a r m − h ˉ s a f e ∥ − ⟨ m , v ^ ⟩ , (21) \langle h-m,\hat{v}\rangle> \frac{\left\|\bar{h}^{\mathrm{harm}}\right\|_2^2-\left\|\bar{h}^{\mathrm{safe}}\right\|_2^2}{2\left\|\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right\|}-\langle m,\hat{v}\rangle, \tag*{(21)} ⟨ h − m , v ^ ⟩ > 2 h ˉ harm − h ˉ safe h ˉ harm 2 2 − h ˉ safe 2 2 − ⟨ m , v ^ ⟩ , (21)
= ∥ h ˉ h a r m ∥ 2 2 − ∥ h ˉ s a f e ∥ 2 2 2 ∥ h ˉ h a r m − h ˉ s a f e ∥ − ( h ˉ h a r m − h ˉ s a f e ) T ( h ˉ h a r m + h ˉ s a f e ) 2 ∥ h ˉ h a r m − h ˉ s a f e ∥ , (22) = \frac{\left\|\bar{h}^{\mathrm{harm}}\right\|_2^2-\left\|\bar{h}^{\mathrm{safe}}\right\|_2^2}{2\left\|\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right\|}-\frac{\left(\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right)^{T}\left(\bar{h}^{\mathrm{harm}}+\bar{h}^{\mathrm{safe}}\right)}{2\left\|\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right\|}, \tag*{(22)} = 2 h ˉ harm − h ˉ safe h ˉ harm 2 2 − h ˉ safe 2 2 − 2 h ˉ harm − h ˉ safe ( h ˉ harm − h ˉ safe ) T ( h ˉ harm + h ˉ safe ) , (22)
= ( h ˉ h a r m − h ˉ s a f e ) T ( h ˉ h a r m + h ˉ s a f e ) − ( h ˉ h a r m − h ˉ s a f e ) T ( h ˉ h a r m + h ˉ s a f e ) 2 ∥ h ˉ h a r m − h ˉ s a f e ∥ = 0 , (23) = \frac{\left(\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right)^{T}\left(\bar{h}^{\mathrm{harm}}+\bar{h}^{\mathrm{safe}}\right)-\left(\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right)^{T}\left(\bar{h}^{\mathrm{harm}}+\bar{h}^{\mathrm{safe}}\right)}{2\left\|\bar{h}^{\mathrm{harm}}-\bar{h}^{\mathrm{safe}}\right\|}=0, \tag*{(23)} = 2 h ˉ harm − h ˉ safe ( h ˉ harm − h ˉ safe ) T ( h ˉ harm + h ˉ safe ) − ( h ˉ harm − h ˉ safe ) T ( h ˉ harm + h ˉ safe ) = 0 , (23)
where the RHS becomes zero by expanding the additional inner product ⟨ c , v ^ ⟩ \langle c,\hat{v}\rangle ⟨ c , v ^ ⟩ .
Global target distribution.
Theorem A.1 (When position-wise SADDER target distribution matches a global target distribution). Given the position-wise safe target from Thm. 3.1 given in equation 32,
p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) = 1 − ψ l ( x 0 1 : L ) 1 − π t , l ( x t 1 : L ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) , (24) p_{D_{\mathrm{safe}}^{(l)}}(x_0^{1:L}\mid x_t^{1:L})=\frac{1-\psi_l(x_0^{1:L})}{1-\pi_{t,l}(x_t^{1:L})}p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L}), \tag*{(24)} p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) = 1 − π t , l ( x t 1 : L ) 1 − ψ l ( x 0 1 : L ) p data ( x 0 1 : L ∣ x t 1 : L ) , (24) and the global target distribution, with g l ( x 0 1 : L ) : = 1 − ψ l ( x 0 1 : L ) g_l(x_0^{1:L}) := 1-\psi_l(x_0^{1:L}) g l ( x 0 1 : L ) := 1 − ψ l ( x 0 1 : L ) and R l ( x 0 1 : L ) : = ∏ j ≠ l ( 1 − ψ j ( x 0 1 : L ) ) R_l(x_0^{1:L}) := \prod_{j\ne l}(1-\psi_j(x_0^{1:L})) R l ( x 0 1 : L ) := ∏ j = l ( 1 − ψ j ( x 0 1 : L )) for each position l l l ,
p D s a f e g l o b a l ( x 0 1 : L ∣ x t 1 : L ) = g l ( x 0 1 : L ) R l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] . (25) p_{D_{\mathrm{safe}}^{\mathrm{global}}}(x_0^{1:L}\mid x_t^{1:L})=\frac{g_l(x_0^{1:L})R_l(x_0^{1:L})p_D(x_0^{1:L}\mid x_t^{1:L})}{\mathbb{E}_D[g_l(x_0^{1:L})R_l(x_0^{1:L})\mid x_t^{1:L}]}. \tag*{(25)} p D safe global ( x 0 1 : L ∣ x t 1 : L ) = E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] g l ( x 0 1 : L ) R l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) . (25) the following equality holds,
E D s a f e g l o b a l ( x 0 l ∣ x t 1 : L ) = E D s a f e ( l ) ( x 0 l ∣ x t 1 : L ) , (26) \mathbb{E}_{D_{\mathrm{safe}}^{\mathrm{global}}}(x_0^l\mid x_t^{1:L})=\mathbb{E}_{D_{\mathrm{safe}}^{(l)}}(x_0^l\mid x_t^{1:L}), \tag*{(26)} E D safe global ( x 0 l ∣ x t 1 : L ) = E D safe ( l ) ( x 0 l ∣ x t 1 : L ) , (26) if and only if
Cov D s a f e ( l ) ( R l ( x 0 1 : L ) , x 0 l ∣ x t 1 : L ) = 0 , (27) \operatorname{Cov}_{D_{\mathrm{safe}}^{(l)}}(R_l(x_0^{1:L}),x_0^l\mid x_t^{1:L})=0, \tag*{(27)} Cov D safe ( l ) ( R l ( x 0 1 : L ) , x 0 l ∣ x t 1 : L ) = 0 , (27) for every l , t , x t 1 : L l,t,x_t^{1:L} l , t , x t 1 : L .
See Section A.5 for proof.
Remark 2. Thm. A.1 states that the global and position-wise denoisers agree at position l l l for all l = { 1 , ⋯ , L } l=\{1,\cdots,L\} l = { 1 , ⋯ , L } if and only if the remaining-position safety weight denoted by R l ( x 0 1 : L ) R_l(x_0^{1:L}) R l ( x 0 1 : L ) is conditionally uncorrelated with x 0 l x_0^l x 0 l under D s a f e ( l ) D_{\mathrm{safe}}^{(l)} D safe ( l ) . Under this condition and the calibration assumption in Thm. 3.1 , every SADDER factor is the marginal safe denoiser of the same global target. However, this does not guarantee the existence of any globally compatible distribution. It only states that this specific global target in equation 25 agrees with the local target at position l l l if and only if a conditional covariance is zero.
Proof of Thm. 3.1
Proof. In the theorem, we assumed that these exists a measurable position-wise unsafe-membership function on clean sequences. In particular, for each token position l ∈ { 1 , … , L } l\in\{1,\ldots,L\} l ∈ { 1 , … , L } , this function maps the clean sequence to a level of unsafe-ness at index l l l :
ψ l : V L ⟶ [ 0 , 1 ] . (28) \psi_l:\mathcal{V}^{L}\longrightarrow[0,1]. \tag*{(28)} ψ l : V L ⟶ [ 0 , 1 ] . (28)
Recall that we let
π t , l ( x t 1 : L ) : = E D [ ψ l ( x 0 1 : L ) ∣ x t 1 : L ] (29) \pi_{t,l}(x_t^{1:L}) := \mathbb{E}_{D}\left[\psi_l(x_0^{1:L}) \mid x_t^{1:L}\right] \tag*{(29)} π t , l ( x t 1 : L ) := E D [ ψ l ( x 0 1 : L ) ∣ x t 1 : L ] (29)
denote the posterior probability of the position-l l l being unsafe, for a noised sequence x t 1 : L x_t^{1:L} x t 1 : L .
Now, we define the corresponding normalized position-wise safe and unsafe posterior distributions by
p D u n s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) : = ψ l ( x 0 1 : L ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) π t , l ( x t 1 : L ) , (30) p_{D_{\mathrm{unsafe}}}^{(l)}(x_0^{1:L} \mid x_t^{1:L}) := \frac{\psi_l(x_0^{1:L})p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L})}{\pi_{t,l}(x_t^{1:L})}, \tag*{(30)} p D unsafe ( l ) ( x 0 1 : L ∣ x t 1 : L ) := π t , l ( x t 1 : L ) ψ l ( x 0 1 : L ) p data ( x 0 1 : L ∣ x t 1 : L ) , (30)
π t , l ( x t 1 : L ) : = ∑ x 0 1 : L ∈ D ψ l ( x 0 1 : L ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) , (31) \pi_{t,l}(x_t^{1:L}) := \sum_{x_0^{1:L}\in D}\psi_l(x_0^{1:L})p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L}), \tag*{(31)} π t , l ( x t 1 : L ) := x 0 1 : L ∈ D ∑ ψ l ( x 0 1 : L ) p data ( x 0 1 : L ∣ x t 1 : L ) , (31)
p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) : = ( 1 − ψ l ( x 0 1 : L ) ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) Z s a f e , l , (32) p_{D_{\mathrm{safe}}}^{(l)}(x_0^{1:L} \mid x_t^{1:L}) := \frac{(1-\psi_l(x_0^{1:L}))p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L})}{Z_{\mathrm{safe},l}}, \tag*{(32)} p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) := Z safe , l ( 1 − ψ l ( x 0 1 : L )) p data ( x 0 1 : L ∣ x t 1 : L ) , (32)
1 − π t , l ( x t 1 : L ) : = ∑ x 0 1 : L ∈ D ( 1 − ψ l ( x 0 1 : L ) ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) . (33) 1-\pi_{t,l}(x_t^{1:L}) := \sum_{x_0^{1:L}\in D}(1-\psi_l(x_0^{1:L}))p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L}). \tag*{(33)} 1 − π t , l ( x t 1 : L ) := x 0 1 : L ∈ D ∑ ( 1 − ψ l ( x 0 1 : L )) p data ( x 0 1 : L ∣ x t 1 : L ) . (33)
Because ψ l ( x 0 1 : L ) + ( 1 − ψ l ( x 0 1 : L ) ) = 1 \psi_l(x_0^{1:L})+(1-\psi_l(x_0^{1:L}))=1 ψ l ( x 0 1 : L ) + ( 1 − ψ l ( x 0 1 : L )) = 1 for any clearn sequence x 0 1 : L x_0^{1:L} x 0 1 : L , we can write the following:
p d a t a ( x 0 1 : L ∣ x t 1 : L ) = ( 1 − ψ l ( x 0 1 : L ) ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) (34) p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L})=(1-\psi_l(x_0^{1:L}))p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L}) \tag*{(34)} p data ( x 0 1 : L ∣ x t 1 : L ) = ( 1 − ψ l ( x 0 1 : L )) p data ( x 0 1 : L ∣ x t 1 : L ) (34)
+ ψ l ( x 0 1 : L ) p d a t a ( x 0 1 : L ∣ x t 1 : L ) . (35) {} \qquad+\psi_l(x_0^{1:L})p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L}). \tag*{(35)} + ψ l ( x 0 1 : L ) p data ( x 0 1 : L ∣ x t 1 : L ) . (35)
If we plug in equation 30 and equation 32 to the RHS, the data posterior can be decomposed into the position-wise, normalized, safe and unsafe distributions:
p d a t a ( x 0 1 : L ∣ x t 1 : L ) = ( 1 − π t , l ( x t 1 : L ) ) p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) p_{\mathrm{data}}(x_0^{1:L}\mid x_t^{1:L})=(1-\pi_{t,l}(x_t^{1:L}))p_{D_{\mathrm{safe}}}^{(l)}(x_0^{1:L}\mid x_t^{1:L}) p data ( x 0 1 : L ∣ x t 1 : L ) = ( 1 − π t , l ( x t 1 : L )) p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L )
+ π t , l ( x t 1 : L ) p D u n s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) . (36) \qquad+\pi_{t,l}(x_t^{1:L})p_{D_{\mathrm{unsafe}}}^{(l)}(x_0^{1:L}\mid x_t^{1:L}). \tag*{(36)} + π t , l ( x t 1 : L ) p D unsafe ( l ) ( x 0 1 : L ∣ x t 1 : L ) . (36)
Taking the conditional expectation of the one-hot clean token x 0 l x_0^l x 0 l on both sides gives, i.e.,
E x 0 l ∼ D [ x 0 l ∣ x t 1 : L ] = ∫ x 0 l p ( x 0 l ∣ x t 1 : L ) d x 0 l \mathbb{E}_{x_0^l\sim D}[x_0^l\mid x_t^{1:L}]=\int x_0^l p(x_0^l\mid x_t^{1:L})\,dx_0^l E x 0 l ∼ D [ x 0 l ∣ x t 1 : L ] = ∫ x 0 l p ( x 0 l ∣ x t 1 : L ) d x 0 l
E D [ x 0 l ∣ x t 1 : L ] = ( 1 − π t , l ) E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] + π t , l E D u n s a f e ( l ) [ x 0 l ∣ x t 1 : L ] . (37) \mathbb{E}_{D}[x_0^l\mid x_t^{1:L}]=(1-\pi_{t,l})\mathbb{E}_{D_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}]+\pi_{t,l}\mathbb{E}_{D_{\mathrm{unsafe}}^{(l)}}[x_0^l\mid x_t^{1:L}]. \tag*{(37)} E D [ x 0 l ∣ x t 1 : L ] = ( 1 − π t , l ) E D safe ( l ) [ x 0 l ∣ x t 1 : L ] + π t , l E D unsafe ( l ) [ x 0 l ∣ x t 1 : L ] . (37)
where the dependence of π t , l \pi_{t,l} π t , l on x t 1 : L x_t^{1:L} x t 1 : L is suppressed for readability. Solving equation 37 for the safe conditional mean yields
E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] = E D [ x 0 l ∣ x t 1 : L ] − π t , l E D u n s a f e ( l ) [ x 0 l ∣ x t 1 : L ] 1 − π t , l = E D [ x 0 l ∣ x t 1 : L ] + π t , l 1 − π t , l ( E D [ x 0 l ∣ x t 1 : L ] − E D u n s a f e ( l ) [ x 0 l ∣ x t 1 : L ] ) . (38) \begin{aligned}
\mathbb{E}_{D_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}]
=\frac{\mathbb{E}_{D}[x_0^l\mid x_t^{1:L}]-\pi_{t,l}\mathbb{E}_{D_{\mathrm{unsafe}}^{(l)}}[x_0^l\mid x_t^{1:L}]}{1-\pi_{t,l}} \\
&=\mathbb{E}_{D}[x_0^l\mid x_t^{1:L}]+\frac{\pi_{t,l}}{1-\pi_{t,l}}\left(\mathbb{E}_{D}[x_0^l\mid x_t^{1:L}]-\mathbb{E}_{D_{\mathrm{unsafe}}^{(l)}}[x_0^l\mid x_t^{1:L}]\right). \tag*{(38)}
\end{aligned} E D safe ( l ) [ x 0 l ∣ x t 1 : L ] = 1 − π t , l E D [ x 0 l ∣ x t 1 : L ] − π t , l E D unsafe ( l ) [ x 0 l ∣ x t 1 : L ] = E D [ x 0 l ∣ x t 1 : L ] + 1 − π t , l π t , l ( E D [ x 0 l ∣ x t 1 : L ] − E D unsafe ( l ) [ x 0 l ∣ x t 1 : L ] ) . (38)
Substituting the calibration condition in equation 17 gives equation 16.
Note that the unsafe denoiser in this theorem is induced by ψ \psi ψ , i.e.,
E D u n s a f e [ x 0 l ∣ x t 1 : L ] = ∑ x n ∈ D u n s a f e x n l ψ l ( x 0 1 : L ) q t ( x t 1 : L ∣ x 0 1 : L ) ∑ x n ∈ D u n s a f e ψ l ( x 0 1 : L ) q t ( x t 1 : L ∣ x 0 1 : L ) , \mathbb{E}_{D_{\mathrm{unsafe}}}[x_0^l\mid x_t^{1:L}]
=\frac{\sum_{x_n\in D_{\mathrm{unsafe}}}x_n^l\psi_l(x_0^{1:L})q_t(x_t^{1:L}\mid x_0^{1:L})}{\sum_{x_n\in D_{\mathrm{unsafe}}}\psi_l(x_0^{1:L})q_t(x_t^{1:L}\mid x_0^{1:L})}, E D unsafe [ x 0 l ∣ x t 1 : L ] = ∑ x n ∈ D unsafe ψ l ( x 0 1 : L ) q t ( x t 1 : L ∣ x 0 1 : L ) ∑ x n ∈ D unsafe x n l ψ l ( x 0 1 : L ) q t ( x t 1 : L ∣ x 0 1 : L ) ,
which differs from our implementation of unsafe denoiser given in equation 15. Hence, we note that this theorem statement holds when these two unsafe denoisers match.
Proof of Thm. A.1
Proof. Conditioned on x t 1 : L x_t^{1:L} x t 1 : L , the global posterior satisfies
p D s a f e g l o b a l ( x 0 1 : L ∣ x t 1 : L ) = g l ( x 0 1 : L ) R l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] . (39) p_{D_{\mathrm{safe}}}^{\mathrm{global}}(x_0^{1:L}\mid x_t^{1:L})
=\frac{g_l(x_0^{1:L})R_l(x_0^{1:L})p_D(x_0^{1:L}\mid x_t^{1:L})}{\mathbb{E}_{D}[g_l(x_0^{1:L})R_l(x_0^{1:L})\mid x_t^{1:L}]}. \tag*{(39)} p D safe global ( x 0 1 : L ∣ x t 1 : L ) = E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] g l ( x 0 1 : L ) R l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) . (39)
where g l ( x 0 1 : L ) : = 1 − ψ l ( x 0 1 : L ) g_l(x_0^{1:L}) := 1-\psi_l(x_0^{1:L}) g l ( x 0 1 : L ) := 1 − ψ l ( x 0 1 : L ) .
The position-l l l safe posterior is
p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) = g l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] . (40) p_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(x_0^{1:L}\mid x_t^{1:L})=\frac{g_l(x_0^{1:L})p_{\mathcal{D}}(x_0^{1:L}\mid x_t^{1:L})}{\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})\mid x_t^{1:L}]}. \tag*{(40)} p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) = E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] g l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) . (40)
If we plug in equation 40 into equation 39, we have the global posterior as a reweighted position-wise posterior:
p D s a f e g l o b a l ( x 0 1 : L ∣ x t 1 : L ) = R l ( x 0 1 : L ) p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] (41) p_{\mathcal{D}_{\mathrm{safe}}^{\mathrm{global}}}(x_0^{1:L}\mid x_t^{1:L})=\frac{R_l(x_0^{1:L})p_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(x_0^{1:L}\mid x_t^{1:L})\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})\mid x_t^{1:L}]}{\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})R_l(x_0^{1:L})\mid x_t^{1:L}]} \tag*{(41)} p D safe global ( x 0 1 : L ∣ x t 1 : L ) = E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] R l ( x 0 1 : L ) p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] (41)
= R l ( x 0 1 : L ) p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] , (42) =\frac{R_l(x_0^{1:L})p_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(x_0^{1:L}\mid x_t^{1:L})}{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]}, \tag*{(42)} = E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] R l ( x 0 1 : L ) p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) , (42)
where the second line is true because
E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] = ∑ x 0 1 : L R l ( x 0 1 : L ) p D s a f e ( l ) ( x 0 1 : L ∣ x t 1 : L ) , (43) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]=\sum_{x_0^{1:L}}R_l(x_0^{1:L})p_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(x_0^{1:L}\mid x_t^{1:L}), \tag*{(43)} E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] = x 0 1 : L ∑ R l ( x 0 1 : L ) p D safe ( l ) ( x 0 1 : L ∣ x t 1 : L ) , (43)
= ∑ x 0 1 : L R l ( x 0 1 : L ) g l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] , due to equation 40 (44) =\sum_{x_0^{1:L}}R_l(x_0^{1:L})\frac{g_l(x_0^{1:L})p_{\mathcal{D}}(x_0^{1:L}\mid x_t^{1:L})}{\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})\mid x_t^{1:L}]},\quad\text{due to equation 40} \tag*{(44)} = x 0 1 : L ∑ R l ( x 0 1 : L ) E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] g l ( x 0 1 : L ) p D ( x 0 1 : L ∣ x t 1 : L ) , due to equation 40 (44)
= E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] . (45) =\frac{\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})R_l(x_0^{1:L})\mid x_t^{1:L}]}{\mathbb{E}_{\mathcal{D}}[g_l(x_0^{1:L})\mid x_t^{1:L}]}. \tag*{(45)} = E D [ g l ( x 0 1 : L ) ∣ x t 1 : L ] E D [ g l ( x 0 1 : L ) R l ( x 0 1 : L ) ∣ x t 1 : L ] . (45)
Taking the conditional expectation of x 0 l x_0^l x 0 l on equation 42 gives
E D s a f e g l o b a l [ x 0 l ∣ x t 1 : L ] = E D s a f e ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] . (46) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{\mathrm{global}}}[x_0^l\mid x_t^{1:L}]=\frac{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})x_0^l\mid x_t^{1:L}]}{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]}. \tag*{(46)} E D safe global [ x 0 l ∣ x t 1 : L ] = E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] E D safe ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] . (46)
Subtracting E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}] E D safe ( l ) [ x 0 l ∣ x t 1 : L ] and using the definition of conditional covariance proves
E D s a f e g l o b a l [ x 0 l ∣ x t 1 : L ] − E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] (47) \mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{\mathrm{global}}}[x_0^l\mid x_t^{1:L}]-\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}] \tag*{(47)} E D safe global [ x 0 l ∣ x t 1 : L ] − E D safe ( l ) [ x 0 l ∣ x t 1 : L ] (47)
= E D s a f e ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] − E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] (48) =\frac{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})x_0^l\mid x_t^{1:L}]}{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]}-\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}] \tag*{(48)} = E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] E D safe ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] − E D safe ( l ) [ x 0 l ∣ x t 1 : L ] (48)
= 1 E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] ( E D s a f e ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] − E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] E D s a f e ( l ) [ x 0 l ∣ x t 1 : L ] ) , (49) =\frac{1}{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]}\left(\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})x_0^l\mid x_t^{1:L}]-\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[x_0^l\mid x_t^{1:L}]\right), \tag*{(49)} = E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] 1 ( E D safe ( l ) [ R l ( x 0 1 : L ) x 0 l ∣ x t 1 : L ] − E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] E D safe ( l ) [ x 0 l ∣ x t 1 : L ] ) , (49)
= Cov D s a f e ( l ) ( R l ( x 0 1 : L ) , x 0 l ∣ x t 1 : L ) E D s a f e ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] , (50) =\frac{\operatorname{Cov}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}(R_l(x_0^{1:L}),x_0^l\mid x_t^{1:L})}{\mathbb{E}_{\mathcal{D}_{\mathrm{safe}}^{(l)}}[R_l(x_0^{1:L})\mid x_t^{1:L}]}, \tag*{(50)} = E D safe ( l ) [ R l ( x 0 1 : L ) ∣ x t 1 : L ] Cov D safe ( l ) ( R l ( x 0 1 : L ) , x 0 l ∣ x t 1 : L ) , (50)
where the last line is true due to
Cov [ X , Y ∣ Z ] = E [ ( X − E ( X ∣ Z ) ) ( Y − E ( Y ∣ Z ) ) ] , (51) \operatorname{Cov}[X,Y\mid Z]=\mathbb{E}[(X-\mathbb{E}(X\mid Z))(Y-\mathbb{E}(Y\mid Z))], \tag*{(51)} Cov [ X , Y ∣ Z ] = E [( X − E ( X ∣ Z )) ( Y − E ( Y ∣ Z ))] , (51)
= E [ X Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] + E [ X ∣ Z ] E [ Y ∣ Z ] , (52) =\mathbb{E}[XY\mid Z]-\mathbb{E}[X\mid Z]\mathbb{E}[Y\mid Z]-\mathbb{E}[X\mid Z]\mathbb{E}[Y\mid Z]+\mathbb{E}[X\mid Z]\mathbb{E}[Y\mid Z], \tag*{(52)} = E [ X Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] + E [ X ∣ Z ] E [ Y ∣ Z ] , (52)
= E [ X Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] . (53) =\mathbb{E}[XY\mid Z]-\mathbb{E}[X\mid Z]\mathbb{E}[Y\mid Z]. \tag*{(53)} = E [ X Y ∣ Z ] − E [ X ∣ Z ] E [ Y ∣ Z ] . (53)
Since the denominator is positive, the global and local means are the same, when the numerator is zero.
Datasets, prompt selection, and reference construction
We distinguish three data roles: evaluation prompts, unsafe references for the SAD update, and safe/harmful examples for constructing the activation direction. A benchmark used for one role is not automatically used for the others. RealToxicityPrompts (RTP). RTP contains naturally occurring text prefixes and their original continuations, with Perspective annotations [7 ] . For unsafe continuation, the configured pool requires a maximum available prompt-side Perspective score of at least 0.8 and a subsequent Llama-Guard unsafe verdict on the prompt. Its builder also retains the adapter’s continuation-score floor of 0.5. These filters describe an enriched evaluation cohort, not the full RTP distribution. Since Llama-Guard also judges generated outputs, the prompt selection is not judge-independent. Note the negation set used to construct the unsafe reference bank for the contrastive direction is not Llama-Guard scored.
The original RTP development/search set comprises pool indices 0–299. The reported continuation tables use the expanded evaluation set, indices 300–899, collected as three 200-prompt shards at offsets 300, 500, and 700. These evaluation records exclude the original development records. The subsequent configuration-selection procedure is described below.
BeaverTails. BeaverTails provides instruction–response pairs with response-safety annotations [10 ] . We condition on prompts associated with unsafe-labeled responses, using 600 records for the evaluation set. The corresponding unsafe responses supply the negative reference set and safe-labeled responses supply the safe direction set. An unsafe response annotation does not establish that its prompt is itself malicious.
Benign continuation controls. The quality cohort requires both the maximum prompt-side Perspective score and the maximum score from the continuation’s own fields to be at most 0.2. We remove duplicate prompt strings and prompt strings present in the excluded unsafe-reference artifacts, shuffle with seed zero, and retain 600 records. BERTScore compares each generated response with its own benign human continuation, including for unmodified sampling. BeaverTails-tuned methods use this same benign RTP cohort while retaining their BeaverTails reference banks. This is a quality diagnostic rather than an independent capability evaluation.
JailbreakBench, AdvBench, and HarmBench. JailbreakBench supplies harmful behaviors for standardized jailbreak evaluation [3 ] ; its 100 harmful behaviors are development data in our study. AdvBench contains harmful instructions used to evaluate adversarial prompting (Zou et al., 2023). HarmBench provides harmful behaviors and a behavior-conditioned evaluation classifier [18 ] and our jobs restrict evaluation to its standard behavior category. We shuffle with seed zero and use the first 100 behaviors of each dataset for development. The transfer protocol reserves AdvBench offsets 100–519 and HarmBench-standard offsets 100–199. The main jailbreak tables report the latter held-out HarmBench cohort under DIJA and PAD. These are our experimental splits, not official benchmark train/test partitions.
WildJailbreak and the jailbreak reference bank. WildJailbreak contains both harmful and benign prompts, including adversarial rewrites [11 ] . Our unsafe set construction selects the adversarial-harmful training subset, skips the first 1,000 filtered records, and generates LLaDA-Instruct responses from three disjoint 1,300-prompt windows. Exact evaluation-behavior strings are excluded. Generation uses 256 steps, up to 256 new tokens, temperature zero, and seed 42. Unsafe-response filtering, refusal filtering, and deduplication produce the documented 357-response unsafe WildJailbreak set. The jailbreak contrastive direction uses unsafe responses and refusal references with the chat template and a 64-token response cap.
XSTest and over-refusal. XSTest contains 250 safe prompts that models should answer and 200 unsafe contrast prompts (Röttger et al., 2024). Over-refusal is the refusal rate on the safe subset, reported separately from refusal on unsafe prompts. Our runs use unmodified prompts through the model’s chat template (vanilla). The evaluator we use matches the response opening against XSTest’s full-refusal strings; it does not detect partial refusals or every paraphrased refusal.
Models, attacks, and evaluation measures
We use LLaDA-8B-Base and LLaDA-8B-Instruct (Nie et al., 2025), and Dream-7B-Base and Dream-7B-Instruct (Ye et al., 2025). The base checkpoints are evaluated by prompted continuation; instruction checkpoints use the attack-specific input construction. The implementation’s layer k k k follows the hidden-state indexing and interior layers are inputs to block k k k , and the final layer includes the model’s final normalization.
Attacks and fixed context. Zero-shot runs present the original harmful behavior through the chat template. DIJA fills mask spans inside the saved adversarial prompt (Wen et al., 2026) and the refined prompts are reused across methods. PAD inserts fixed anchors into the generation region (Zhang et al., 2025). SADDER and generation-scope DiffuGuard modify only initially editable positions. Full-block DiffuGuard additionally permits repair of fixed scaffold text after the first masked position, including PAD anchors; under DIJA it also appends the released implementation’s extra masked tail. The main jailbreak tables concern DIJA and PAD.
Safety and quality. Llama-Guard-3-8B [20 ] judges the generated response alone under continuation framing. HarmBench-Llama-2-13b-cls [18 b] judges the response against the requested behavior. We report their respective unsafe rates separately. GPT-2-large (Radford et al., 2019) scores generated text with a causal language-model likelihood; this is an external fluency proxy for both model families, not LLaDA’s pseudo-perplexity. Padding and text after the first end-of-sequence token are excluded. Harmful PPL includes all scorable outputs on the unsafe cohort, whether the safety judge labels them safe or unsafe. Benign PPL and BERTScore F1 (Zhang et al., 2020) use the separate benign cohort. BERTScore specifies English and disables baseline rescaling; it leaves the encoder to the installed package’s default. BERTScore is multiplied by 100 in the tables. Higher reference similarity and lower PPL are useful diagnostics, but neither alone establishes helpfulness or safety.
WildGuard response views. For DIJA, the appendix additionally reports WildGuard Han et al. [9 ] harmfulness on the newline-joined spans marked as initially masked, paired with the original harmful behavior. This excludes the fixed scaffold and any full-block repairs outside those spans. Full-response WildGuard harmfulness and refusal remain in the appendix; XSTest uses full-response refusal. The generated-span evaluation is available only for fixed-policy DIJA runs, not PAD or the window studies (Appendix § 18 .§ 5 ).
Uncertainty and cost. Tables report averages with 95% confidence intervals, estimated by repeatedly resampling the evaluation prompts. The appendix also reports standard deviations (SDs) across three generation seeds, showing how much results vary between runs. Appendix B.2 explains both measures and the paired comparisons. NFE counts generator forward passes, including additional passes after remasking. It excludes reward scoring, safety judges, and preparation of the reference set, so it measures generator computation rather than total runtime.
Hyperparameters and configuration selection
Table 5 gives the shared settings; Table 6 summarizes the tested hyperparameter ranges by model and parameter; Table 7 lists the selected continuation operating points. The remaining variant settings and results follow in Appendix § 15 . Full SAD does not depend on the hidden-state layer.
Table 5. Shared sampling and guidance settings.
Table 6. Hyperparameter values considered, consolidated by model. Values are unions across the sweeps, not a single fully crossed grid; a single value denotes a fixed setting. k k k is the scoring layer, η \eta η the SAD strength, w w w the number of full-SAD warm-up steps, and [ s , e ] [s, e] [ s , e ] the inclusive intervention window.
Table 7. Selected main-table continuation settings.
Development settings. Base models use RTP: the original search uses indices 0–299; additional strength development uses 64 prompts at indices 900–963, seeds 42/43, and window [ 0 , 7 ] [0, 7] [ 0 , 7 ] (k = 31 k = 31 k = 31 for LLaDA, 27 for Dream). Instruction-model development uses 100 JBB behaviors; LLaDA additionally uses the first 100 AdvBench and HarmBench behaviors. These runs use seed 42 or seeds 42/43/44, as documented with the results. Sampling uses 32 steps for Base models and 128 nominal steps for Instruct models.
All windows begin at step zero. BT denotes BeaverTails.
Implementation and evaluation details
Motivation for remasking. The safety improvements reported by CSD-based steering and DiffuGuard [15 , 17 ] motivate examining remasking as an optional extension to SADDER. Reopening previously generated positions allows guidance to revise token choices that would otherwise remain fixed. Uniform-state diffusion provides a related capability through its native token replacement transitions, allowing repeated revision without an explicit mask token. As such, we wanted to evaluate selective SAD with risk-based remasking and matched random controls in the appendix.
Optional remasking and warm-up
Algorithm 2 extends the selective-only main algorithm. Let R t = { l ∈ G : x l t ≠ M } R_t = \{l \in G : x_l^t \ne M\} R t = { l ∈ G : x l t = M } be the revealed editable positions. The remasking policy r r r determines the reopened set:
Q t ( r ) = { ∅ , r = none , Top min ( b , ∣ R t ∣ ) { s k , l ( t ) : l ∈ R t } , r = top- b , { l ∈ R t : s k , l ( t ) > 0 } , r = aligned . (54) Q_t(r) =
\begin{cases}
\varnothing, & r = \text{none},\\
\operatorname{Top}_{\min(b,\lvert R_t\rvert)}\{s_{k,l}^{(t)} : l \in R_t\}, & r = \text{top-}b,\\
\{l \in R_t : s_{k,l}^{(t)} > 0\}, & r = \text{aligned}.
\end{cases} \tag*{(54)} Q t ( r ) = ⎩ ⎨ ⎧ ∅ , Top m i n ( b , ∣ R t ∣) { s k , l ( t ) : l ∈ R t } , { l ∈ R t : s k , l ( t ) > 0 } , r = none , r = top- b , r = aligned . (54)
Here Top \operatorname{Top} Top returns position indices with the largest scores; we use b = 1 b = 1 b = 1 in the top-b b b experiments. This ranking policy can reopen a position even if every score is non-positive. Aligned remasking instead reopens every positive-score revealed position, without a top-b b b cap. After replacing selected tokens by M M M , the model predictions and hidden states are recomputed. The steering gate is then evaluated on this changed state; reopening does not force a position to be steered. Warm-up length w w w applies full SAD on admitted denoising steps with index j < w j < w j < w , followed by selective steering for j ≥ w j \ge w j ≥ w . Remasking is disabled during warm-up and on the final sampling step. Outside the intervention set C C C , neither guidance nor remasking is applied. Setting w = 0 w = 0 w = 0 disables warm-up; setting r = none r = \text{none} r = none disables remasking. Thus the selective-only main method is exactly the case w = 0 w = 0 w = 0 , r = none r = \text{none} r = none .
Algorithm 2 SADDER with optional remasking and full-SAD warm-up.
Input: inputs of Algorithm 1; warm-up length w ≥ 0 w \ge0 w ≥ 0 ; policy r ∈ { none , top- b , aligned } r \in\{\text{none},\text{top-}b,\text{aligned}\} r ∈ { none , top- b , aligned } ; budget b ≥ 0 b \ge0 b ≥ 0 .
w = 0 w = 0 w = 0 and r = none r = \text{none} r = none recover Algorithm 1.
for j = 0 , … , T − 1 j = 0, \ldots, T - 1 j = 0 , … , T − 1 do
Set t ← t j t \leftarrow t_j t ← t j . Evaluate p D , t , ⋅ p_{D,t,\cdot} p D , t , ⋅ and h k , ⋅ ( t ) h^{(t)}_{k,\cdot} h k , ⋅ ( t ) together on the current x t x_t x t .
Initialize p ~ 0 ∣ t , l ← p D , t , l \widetilde{p}_{0|t,l} \leftarrow p_{D,t,l} p 0∣ t , l ← p D , t , l and a k , l ( t ) ← 0 a^{(t)}_{k,l} \leftarrow0 a k , l ( t ) ← 0 for all l l l .
if j ∈ C j \in C j ∈ C then
Initialize Q t ← ∅ Q_t \leftarrow\varnothing Q t ← ∅ .
if j ≥ w j \ge w j ≥ w and r ≠ none r \ne\text{none} r = none and j < T − 1 j < T - 1 j < T − 1 then
R t ← { l ∈ G : x t l ≠ M } R_t \leftarrow\{l \in G : x^l_t \ne\mathrm{M}\} R t ← { l ∈ G : x t l = M } .
Compute s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ s^{(t)}_{k,l} \leftarrow\langle h^{(t)}_{k,l} - m_k, \hat{v}_k\rangle s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ for l ∈ R t l \in R_t l ∈ R t .
Select Q t ( r ) Q_t(r) Q t ( r ) using Equation (54) .
Set x t l ← M x^l_t \leftarrow\mathrm{M} x t l ← M for l ∈ Q t l \in Q_t l ∈ Q t .
end if
if Q t ≠ ∅ Q_t \ne\varnothing Q t = ∅ then
Recompute p D , t , ⋅ p_{D,t,\cdot} p D , t , ⋅ and h k , ⋅ ( t ) h^{(t)}_{k,\cdot} h k , ⋅ ( t ) together on the changed x t x_t x t .
Reset p ~ 0 ∣ t , ⋅ ← p D , t , ⋅ \widetilde{p}_{0|t,\cdot} \leftarrow p_{D,t,\cdot} p 0∣ t , ⋅ ← p D , t , ⋅ .
end if
M t ← { l ∈ G : x t l = M } M_t \leftarrow\{l \in G : x^l_t = \mathrm{M}\} M t ← { l ∈ G : x t l = M } .
if j < w j < w j < w then
Full-SAD warm-up: a k , l ( t ) ← 1 a^{(t)}_{k,l} \leftarrow1 a k , l ( t ) ← 1 for l ∈ M t l \in M_t l ∈ M t .
else
Compute s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ s^{(t)}_{k,l} \leftarrow\langle h^{(t)}_{k,l} - m_k, \hat{v}_k\rangle s k , l ( t ) ← ⟨ h k , l ( t ) − m k , v ^ k ⟩ for l ∈ M t l \in M_t l ∈ M t .
Select risky positions: a k , l ( t ) ← 1 { s k , l ( t ) > 0 } a^{(t)}_{k,l} \leftarrow\mathbb{1}\{s^{(t)}_{k,l} > 0\} a k , l ( t ) ← 1 { s k , l ( t ) > 0 } for l ∈ M t l \in M_t l ∈ M t .
end if
if at least one gate equals 1 then
Estimate p ^ D u n s a f e , t , ⋅ \widehat{p}_{D_{\mathrm{unsafe}},t,\cdot} p D unsafe , t , ⋅ and β ^ ( x t ) \widehat{\beta}(x_t) β ( x t ) on this same state; set η t ← η β ^ ( x t ) \eta_t \leftarrow\eta\widehat{\beta}(x_t) η t ← η β ( x t ) .
SAD update on selected positions: update p ~ 0 ∣ t , l \widetilde{p}_{0|t,l} p 0∣ t , l using Equation (14) for each l l l with a k , l ( t ) = 1 a^{(t)}_{k,l} = 1 a k , l ( t ) = 1 .
end if
end if
x t j + 1 ← Solver ( x t , t j , t j + 1 , p ~ 0 ∣ t , ⋅ ; G ) x_{t_{j+1}} \leftarrow\operatorname{Solver}(x_t,t_j,t_{j+1},\widetilde{p}_{0|t,\cdot};\mathcal{G}) x t j + 1 ← Solver ( x t , t j , t j + 1 , p 0∣ t , ⋅ ; G ) .
end for
Return: the generated continuation of x t T x_{t_T} x t T .
Metric estimates and uncertainty
We compute uncertainty from the saved evaluations. Let i = 1 , … , n i = 1,\ldots,n i = 1 , … , n index evaluation records and s = 1 , … , S s = 1,\ldots,S s = 1 , … , S index the observed generation seeds. The main continuation evaluations have n = 600 n = 600 n = 600 and S = 3 S = 3 S = 3 ; the main HarmBench evaluations have n = 100 n = 100 n = 100 and S = 3 S = 3 S = 3 .
Unsafe rates and other averages. Let y i , s ∈ { 0 , 1 } y_{i,s} \in\{0,1\} y i , s ∈ { 0 , 1 } indicate whether the output for prompt record i i i and seed s s s is judged unsafe. On a complete, balanced evaluation, the unsafe percentage is
r ^ u n s a f e = 100 n S ∑ i = 1 n ∑ s = 1 S y i , s . (55) \hat{r}_{\mathrm{unsafe}} = \frac{100}{nS}\sum_{i=1}^{n}\sum_{s=1}^{S} y_{i,s}. \tag*{(55)} r ^ unsafe = n S 100 i = 1 ∑ n s = 1 ∑ S y i , s . (55)
The same expression defines HarmBench ASR, refusal rate, or short-output rate when y i , s y_{i,s} y i , s is the corresponding event indicator. A mean repetition score uses the per-output repetition score instead. Each metric retains its own evaluation population: for example, XSTest over-refusal uses only safe prompts. When observation counts differ, rate estimates use the total number of valid observations as their denominator.
Quality metrics. Let I s \mathcal{I}_s I s contain the valid records for a quality metric at seed s s s . The reported mean averages a metric computed within each seed:
Q ^ s = f ( ∑ i ∈ I s A i , s ∑ i ∈ I s D i , s ) , Q ^ = 1 S ∑ s = 1 S Q ^ s . (56) \widehat{Q}_s = f\left(\frac{\sum_{i\in\mathcal{I}_s} A_{i,s}}{\sum_{i\in\mathcal{I}_s} D_{i,s}}\right), \qquad\widehat{Q} = \frac{1}{S}\sum_{s=1}^{S}\widehat{Q}_s. \tag*{(56)} Q s = f ( ∑ i ∈ I s D i , s ∑ i ∈ I s A i , s ) , Q = S 1 s = 1 ∑ S Q s . (56)
For BERTScore, A i , s A_{i,s} A i , s is the response-level F1 score, D i , s = 1 D_{i,s}=1 D i , s = 1 , and f ( z ) = z f(z)=z f ( z ) = z ; the displayed values are multiplied by 100. For PPL, A i , s A_{i,s} A i , s is the total negative log likelihood of scored tokens, D i , s D_{i,s} D i , s is their count, and f ( z ) = exp ( z ) f(z)=\exp(z) f ( z ) = exp ( z ) . Thus PPL is an average of seed-level corpus perplexities, not an average of response perplexities. Missing or unscorable measurements are excluded; they are not assigned zero.
95% confidence intervals. To estimate uncertainty due to the evaluation prompts, we randomly sample prompts from the evaluated set, allowing the same prompt to be selected more than once. Each resampled set has the same number of prompts as the original set. Whenever a prompt is selected, we keep its responses from all three seeds together. We calculate the metric again for each resampled set and repeat this process 5,000 times. The 2.5th and 97.5th percentiles of these 5,000 estimates form the reported 95% confidence interval.
Seed SD and paired comparisons. For seed-level estimates θ ^ s \widehat{\theta}_s θ s , the reported sample SD is
S D s e e d = 1 S − 1 ∑ s = 1 S ( θ ^ s − θ ‾ s e e d ) 2 , θ ‾ s e e d = 1 S ∑ s θ ^ s . (57) \mathrm{SD}_{\mathrm{seed}} = \sqrt{\frac{1}{S-1}\sum_{s=1}^{S}\left(\widehat{\theta}_s-\overline{\theta}_{\mathrm{seed}}\right)^2}, \qquad\overline{\theta}_{\mathrm{seed}} = \frac{1}{S}\sum_s \widehat{\theta}_s. \tag*{(57)} SD seed = S − 1 1 s = 1 ∑ S ( θ s − θ seed ) 2 , θ seed = S 1 s ∑ θ s . (57)
It describes variation across runs and is not a confidence interval; it is unavailable for a single seed. To compare methods A and B, retain matched prompts and seeds and use identical cluster weights for both:
Δ ^ = θ ^ A − θ ^ B , Δ ^ ∗ ( b ) = θ ^ A ∗ ( b ) − θ ^ B ∗ ( b ) . (58) \widehat{\Delta} = \widehat{\theta}_A-\widehat{\theta}_B, \qquad\widehat{\Delta}^{*(b)} = \widehat{\theta}^{*(b)}_A-\widehat{\theta}^{*(b)}_B. \tag*{(58)} Δ = θ A − θ B , Δ ∗ ( b ) = θ A ∗ ( b ) − θ B ∗ ( b ) . (58)
Continuation results with confidence intervals
Table 8 reports the main LLaDA continuation estimates with pointwise 95% prompt-cluster bootstrap intervals from 5,000 resamples, retaining all observed seeds within each sampled prompt. These intervals describe prompt uncertainty; the main-table subscripts describe variation across three generation seeds. The selected configurations and evaluation cohorts are identical in both tables.
Table 8. LLaDA-Base safety, generation quality, and cost.
Dream-Base continuation results
Table 9 reports the complete Dream-Base comparison under the same continuation protocol as LLaDA (§ 5.1 ). Unsafe rate and harmful PPL use the RTP or BeaverTails harmful cohort; benign PPL and BERTScore use the separate benign RTP cohort. Entries are means with 95% prompt-cluster intervals; NFE measures generator cost.
Continuation settings and component variants
Settings are selected by unsafe rate; benign quality is evaluated afterward. Tables 10 and 11 report layer, strength, and the last admitted step (all windows begin at zero). The warm-up variant uses full SAD on steps 0–7 and selective guidance on 8–15, with aligned remasking on LLaDA and no remasking on Dream. Equation equation 54 defines the alternative reopening policies.
Table 10. LLaDA selected continuation settings on development set.
Table 11. Dream selected continuation settings on development set.
SADDER variants. These tables extend the main comparison with top-1 and aligned remasking, using the same metrics and uncertainty conventions.
Table 12. LLaDA-Base component variants.
Table 13. Dream-Base component variants.
Paired comparisons and component diagnostics
The following figure and benign-quality table compare the selected component configurations; their LLaDA warm-up entries include aligned remasking. Paired differences compare SADDER with the separately selected full-SAD operating point on identical prompt–seed observations. Negative unsafe-rate and PPL differences, and positive BERTScore differences, favour SADDER. Quality comparisons use common valid pairs within each cohort. Intervals are conditional on the selected settings and observed seeds.
Figure 2. Selected SADDER component configurations minus full SAD on 600 harmful prompts per dataset and three seeds. LLaDA warm-up includes its aligned remasking, Dream does not. Points and bars show unsafe-rate differences (pp) and pointwise 95% paired bootstrap CIs; negative favors SADDER.
Table 14. SADDER variants: paired benign-quality changes versus full SAD.
Paired random controls. Tables 15 and 16 compare each selected SADDER component configuration with full SAD and random controls at the same layer, strength, and intervention window. LLaDA warm-up here includes aligned remasking. Random selection replaces the steering gate with a random subset of the gate-implied size, preserving the remasking and warm-up policies. Random reopening replaces top-1 remasking with one random position, or aligned remasking with a random subset of the threshold-implied size, preserving steering and warm-up. Counts are computed on each trajectory’s current state and may diverge across trajectories. The full-SAD comparator steers all masked positions throughout the window, without additional remasking or a selective phase. Differences are SADDER minus the comparator; negative values favor SADDER. Dashes indicate that a matched control is unavailable or reopening is not used. Each interval uses 5,000 paired prompt-cluster resamples of the same 600 prompt records and three seeds, conditional on the selected configuration.
Table 15. LLaDA-Base: paired unsafe-rate differences (pp), means [95% CI].
Table 16. Dream-Base: paired unsafe-rate differences (pp), means [95% CI].
BoN-2/4/8, FK-2/4/8, and composition
We compare BoN and FK at budgets 2, 4, and 8, with harmful and benign quality measured on the corresponding cohorts. The FK adaptation resamples every four steps, using one clean-state draw per particle and a difference potential on log safety rewards. RoBERTa supplies the search reward; LlamaGuard judges final outputs. NFE excludes reward scoring.
Table 17. LLaDA: BoN and FK at budgets 2, 4, and 8.
Table 18. Dream: BoN and FK at budgets 2, 4, and 8.
Composition with BoN. SADDER can guide each candidate before BoN-2 selection. In the LLaDA/RTP run, this reduces unsafe rate from 30.61% to 26.7% at the same 64 generator evaluations. Its unsafe-prompt PPL increases from 20.90 to 28.80. The two tables distinguish separate composition studies. PPL is evaluated on harmful prompts; benign quality was not measured for these hybrids.
Table 19. Composition.
Jailbreak robustness and ablations
LLaDA-Instruct jailbreak results
Table 20 gives the LLaDA-Instruct comparison corresponding to the Dream-Instruct results in Table 2 . Both tables use the same metrics and reporting conventions. XSTest uses the DIJA-configured defense; for LLaDA generation-scope DiffuGuard, this is λ = 0.35 \lambda= 0.35 λ = 0.35 .
Table 20. LLaDA-Instruct: held-out HarmBench attacks and XSTest over-refusal. Entries use A b A_b A b : mean and sample SD across three seeds (percentage points for rates). HB, LG, and PPL assess complete responses. XSTest reports full-response WG refusal on safe prompts, using valid judge labels only (coverage in Appendix § 18 .§ 2 ). NFE is mean cost.
XSTest over-refusal
We evaluate refusal on 250 safe XSTest prompts and separately on 200 unsafe contrasts, using unmodified prompts and seeds 42, 43, and 44. Over-refusal is the refusal rate on safe prompts only. String matching uses full-refusal openings after lowercasing, trimming surrounding whitespace, and normalizing typographic apostrophes. WildGuard separately judges response refusal and harmfulness from each prompt–response pair (Han et al., [9 ] ).
Table 21 reports the string-based measurements. Table 23 and Table 24 report WildGuard means with seed-SD subscripts and 95% prompt-cluster bootstrap intervals below. The n n n columns count valid labels out of 750 safe-prompt or 600 unsafe-prompt outputs. Missing WildGuard labels are excluded separately for each method; they are not counted as safe or non-refusing. Each point estimate averages the valid-label rates within the three seeds. Intervals use 5,000 resamples of prompt clusters, retaining all seeds.
Table 23. LLaDA: WildGuard judgments on XSTest.
Table 24. Dream: WildGuard judgments on XSTest.
Refusal detection and coverage. The detectors assign different refusal rates to the same responses. For LLaDA warm-up on unsafe prompts, opening-string matching gives 53.5% refusal and WildGuard gives 97.5%; the corresponding Dream rates are 69.5% and 91.5%. So a reduction in stereotyped refusal openings can overstate the reduction in refusal behavior. WildGuard’s response-harmfulness labels provide a separate check: Dream warm-up has 6.9% harmful responses on unsafe XSTest prompts, compared with 0.0% for unmodified sampling, among outputs with valid labels. Coverage also varies with the intervention. Paired comparisons use the intersection of valid labels, rather than subtracting rates computed on different subsets. On safe prompts, warm-up changes WildGuard refusal by −5.9 percentage points on LLaDA (95% CI: [−9.7, −2.1]; 593 matched outputs) and −35.4 points on Dream ([−41.6, −29.3]; 602 matched outputs).
DiffuGuard settings. Generation-scope DiffuGuard uses λ = 0.35 \lambda= 0.35 λ = 0.35 on LLaDA and λ = 0.5 / 0.75 \lambda= 0.5/0.75 λ = 0.5/0.75 for Dream’s DIJA/PAD settings. Both Dream thresholds are evaluated on XSTest. On vanilla prompts, full-block and generation-scope repair regions coincide, so these rows compare thresholds rather than repair scopes. Calibration reuses XSTest-safe prompts for the trigger diagnostic in Appendix § 11 .§ 6 ; these measurements include calibration prompts.
Table 21. XSTest string-based refusal: means [95% CI] and seed SDs.
Table 22. Paired string-based refusal changes versus unmodified sampling (pp).
Table 25. LLaDA: paired WildGuard refusal changes (pp).
Table 26. Dream: paired WildGuard refusal changes (pp).
Held-out attack comparisons
Table 27 reports the main jailbreak-table estimates with pointwise 95% prompt-cluster bootstrap confidence intervals, using 5,000 resamples and retaining all observed seeds within each sampled prompt. These intervals describe prompt uncertainty; the main-table subscripts describe variation across the three generation seeds. The XSTest over-refusal is the offline string-based matching metric rather than the WildGuard over-refusal metric.
Table 27. Held-out HarmBench attacks and XSTest over-refusal.
WildGuard harmfulness and refusal
Tables 28 and 29 report full-response WildGuard harmfulness and refusal on the same HarmBench outputs, including remasking and random-selection controls. Entries show the mean with a seed-SD subscript and a 95% prompt-cluster bootstrap interval below. The n n n columns count valid labels out of 300 outputs per attack and method. Missing labels are excluded, and rates average the valid-output rate within each of the three seeds. Table 30 compares selective SADDER and warm-up against full SAD and random selection on jointly scored outputs. Negative harmfulness differences indicate fewer harmful responses; negative refusal differences indicate fewer refusals, which alone does not establish a safety improvement. The prompt–response pairs use the original behavior and the complete response, including any retained attack scaffold.
Comparison across safety judges. The judges differ in their assessment of these gains. On Dream/PAD, warm-up lowers HB ASR from 51.7% to 42.7%, while WG harmfulness increases from 66.0% to 69.0%; selective SADDER reaches 80.0% WG harmfulness. On LLaDA/PAD, warm-up reduces both HB ASR (58.7% to 57.0%) and WG harmfulness (80.0% to 76.3%). Full-block DiffuGuard on Dream/DIJA illustrates a larger disagreement: 33.3% HB ASR accompanies 98.3% WG harmfulness and PPL 537. The apparent safety benefit depends on the judge as well as the model and attack, particularly when the intervention disrupts fluency.
Table 28. LLaDA: WildGuard judgments on HarmBench.
Table 29. Dream: WildGuard judgments on HarmBench.
Table 30. Paired WildGuard differences on HarmBench (pp).
DIJA judge and response-view sensitivity
Separating generated content from the attack scaffold. DIJA completions contain both fixed attack text and model-generated spans. A harmfulness judgment on the complete response can therefore depend on text supplied by the attacker. We compare HarmBench (HB), LlamaGuard (LG), and WildGuard (WG) on two response views: the complete response, including the scaffold, and only the spans marked as initially masked in the saved completion segmentation (fills ). Nonempty spans are trimmed and joined by newlines before judging. HB measures behavior-specific attack success, LG unsafe content, and WG response harmfulness. These are distinct evaluator criteria, even when the response view is held fixed. The main table retains full-response HB/LG for attacks and uses WG only for XSTest. Generated-span attack scores from all three judges are reported here. All response-view comparisons use the same generated completions and defence settings, so differences between views reflect the scoring procedure.
This view isolates the initially editable content, rather than judging the assembled attack response. Removing intervening text can change the context needed to interpret a span. For full-block DiffuGuard, repairs outside the initially masked spans are also excluded. Generated-span scores thus complement complete-response judgments; they do not measure the safety of every token that a defence may modify.
Judge disagreement persists after removing fixed text. Table 31 and Table 32 separate judge choice from response-view choice. On unmodified sampling, removing the scaffold lowers LG unsafe rate from 82.0% to 53.3% on LLaDA and from 80.7% to 48.7% on Dream. HB falls more modestly, from 78.7% to 73.0% and from 82.0% to 76.0%, respectively; WG remains above 96%. Full-response scores therefore cannot be interpreted as measurements of generated spans alone. Conversely, excluding fixed text does not make the judges interchangeable.
Table 31. LLaDA: DIJA judge and response-view comparison on 100 held-out HarmBench behaviors, three seeds. Full includes the fixed scaffold; fills excludes it. Rates (%) are means with seed-SD subscripts. HB/LG have 300 scored outputs per row; WG has 300 except Dream aligned remasking (299).
Table 32. Dream: DIJA judge and response-view comparison on 100 held-out HarmBench behaviors, three seeds. Full includes the fixed scaffold; fills excludes it. Rates (%) are means with seed-SD subscripts. HB/LG have 300 scored outputs per row; WG has 300 except Dream aligned remasking (299).
Warm-up illustrates the consequence for method comparisons. Against paired unmodified outputs, LG reports reductions of 11.7 points on LLaDA (95% CI: [−19.7, −4.3]) and 9.0 points on Dream ([−16.0, −2.0]), while the corresponding HB and WG impacts include zero. Dream selective SAD-DER also improves HB relative to full SAD by 8.0 points ([−13.3, −2.7]), but increases LG unsafe rate by 15.0 points ([8.0, 22.0]). These are evaluator-dependent effects, not a consistent safety ordering across judges. The paired estimates in Table 33 retain the same prompts and seeds and use pointwise 95% intervals.
Table 33. Generated-span DIJA score differences (percentage points), with 95% prompt-cluster bootstrap intervals. Comparisons use the same prompts and seeds; full SAD and random selection have no warm-up.
Uniform-state diffusion continuation results
Table 34 reports the complete Duo and UDLM comparison under the protocol of § 5.2 . Unsafe rate uses the RTP harmful cohort; benign BERTScore uses the separate benign RTP cohort. Entries report means and standard deviations across five generation seeds.
Guidance analysis and ablations for uniform-state diffusion
Where the gate opens
Figure 3 plots the open-gate ratio during unguided continuations of unsafe RTP prompts. The open-gate ratio generally increases as denoising proceeds, consistent with position-wise representations becoming more informative as the continuation takes shape. SADDER uses this evolving signal to select positions for guidance, whereas SAD applies its correction to all eligible positions at every step.
Figure 3. Open-gate ratio along unguided continuations of unsafe RTP prompts: the fraction of positions with s k , l ( t ) > 0 s_{k,l}^{(t)} > 0 s k , l ( t ) > 0 . The horizontal axis runs from early to late denoising steps.
Softening the gate
We replace the binary gate with a k , l ( t ) = max { 2 σ ( s k , l ( t ) / τ ) − 1 , 0 } a_{k,l}^{(t)} = \max\left\{2\sigma\left(s_{k,l}^{(t)}/\tau\right)-1, 0\right\} a k , l ( t ) = max { 2 σ ( s k , l ( t ) / τ ) − 1 , 0 } , where σ \sigma σ is the sigmoid function and τ \tau τ controls the softness of the gate. The transformation makes the gate zero when s k , l ( t ) = 0 s_{k,l}^{(t)} = 0 s k , l ( t ) = 0 , and clipping at zero leaves positions with negative scores unguided. For positive scores, the gate takes a value between zero and one; the strict gate is recovered as τ → 0 \tau\to0 τ → 0 .
Figure 4 shows no consistent effect of the temperature. On UDLM the four gates coincide in both metrics across the whole range. On Duo the strict gate trends toward lower unsafe rates and lower benign BERTScore, but the differences are smaller than the seed-to-seed variation of either gate. We therefore keep the strict indicator, which needs no additional hyperparameter.
Figure 4. Unsafe rate and benign BERTScore across guidance strengths for the strict gate and softened gates with τ ∈ { 30 , 70 , 100 } \tau\in\{30, 70, 100\} τ ∈ { 30 , 70 , 100 } on Duo (k = 9 k = 9 k = 9 ) and UDLM (k = 12 k = 12 k = 12 ). Error bars are one standard deviation across seeds: five seeds for the strict gate (the runs reported in Table 34 ) and three seeds for the softened gates.
Table 34. Uniform-state continuation on RTP.