Adaptive Steering and Remasking for Safe Generation in Diffusion Language Models

Yejin Lee, Yo-Sub Han · 2026

Read Adaptive Steering and Remasking for Safe Generation in Diffusion Language Models by Yejin Lee, Yo-Sub Han (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-13043.txt.

Introduction

Lee, Kim and Han defend diffusion language models, whose iterative denoising lets harmful content appear at any spot and persist. Their run-time defence pairs adaptive safety steering, which tunes steering strength from the current denoising state, with safety-aware remasking of unsafe content. A light detector after the first generation block spots unsafe trajectories early and triggers targeted remasking plus regeneration under steering. On LLaDA and Dream it lifts jailbreak defence while keeping benign quality and general capability.

Catalog record

CREATORYejin Lee, Yo-Sub Han
YEAR2026
COLLECTIONPAPERS
FORMATTXT
FILE SIZE45463
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2605.13043

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Adaptive Steering and Remasking for Safe Generation in Diffusion Language Models Yejin Lee, Yo-Sub Han Abstract Diffusion Language Models (DLMs) provide a promising alternative to autoregressive language models by generating text through iterative denoising and bidirectional refinement. However, this iterative generation paradigm also introduces unique safety vulnerabilities when harmful tokens generated at intermediate denoising steps propagate through subsequent refinement processes and eventually induce unsafe outputs. While there are a few attempts to remedy this issue, they either fail to generate safe outputs or generate safe yet low-quality outputs. This motivates us to propose an inference-time defense framework based on the step-wise intervention during the denoising process, which then improves the safety without compromising the output quality. The key component of our framework is a contrastive safety direction (SGD), a latent direction that captures the semantic boundary between harmful and safe generations. We leverage SGD to assess the alignment of generated tokens with harmful semantics at each denoising step. When harmful alignment is detected, our method remasks the corresponding tokens and resumes the denoising process with adaptive steering, where the steering strength is modulated according to the estimated degree of harmfulness. As a plug-and-play module, our method circumvents the need for additional fine-tuning and can be directly incorporated into off-the-shelf diffusion models. The experimental results show that our approaches reduce jailbreak success rates to 0.64% while preserving generation quality close to the original model performance. This confirms the effectiveness of step-wise intervention for safe diffusion language model generation. Our code is available at https://github.com/leeyejin1231/DLM_Steering_Remasking . 1 Introduction Diffusion language models (DLMs) have recently emerged as a promising alternative to autoregressive language models by enabling parallel token generation and iterative refinement [ 28 , 9 , 2 , 18 , 5 ] . These models progressively denoise a fully masked sequence through iterative refinement, which enables flexible generation and global contextual reasoning. Recent studies demonstrated that DLMs achieve competitive performance across reasoning, coding, and structured generation tasks while improving decoding flexibility and efficiency [ 34 , 26 , 36 ] . Safety in DLMs remains underexplored. Existing safety alignment methods were primarily designed for autoregressive generation and do not directly transfer to diffusion-based generation. The iterative denoising process in DLMs introduces unique vulnerabilities because harmful signals can emerge and propagate across intermediate denoising steps. Recent studies showed that early denoising trajectories strongly influence the final output generation [ 19 ] . Prior work also demonstrated that harmful tokens injected during intermediate denoising steps can steer the entire generation trajectory toward unsafe responses [ 33 ] . These findings indicate that DLM safety depends not only on the final output distribution but also on the intermediate denoising trajectory. Existing DLM defense methods mainly relied on remasking-based interventions [ 19 , 14 ] . These approaches improved safety by suppressing harmful token generation or introducing stochastic remasking during decoding. However, these methods did not explicitly control the semantic denoising trajectory. As a result, harmful generations could still persist once unsafe semantic directions emerged during early denoising steps. Furthermore, existing methods often suffered from a trade-off between safety and generation quality because aggressive remasking disrupted coherent generation. We propose an inference-time safety framework that steers intermediate denoising trajectories toward safe semantic regions. We construct a Contrastive Safety Direction (CSD) from the representation difference between safe and harmful denoising behaviors. The proposed steering mechanism shifts harmful denoising trajectories toward aligned semantic regions without additional safety fine-tuning or parameter updates. The framework applies the steering intervention only during early denoising steps, where the denoising trajectory strongly influences the final generation. This design prevents unsafe semantic trajectories from becoming stabilized during iterative refinement. The method further minimizes unnecessary perturbations in later denoising stages, which preserves generation quality and decoding stability. We further integrate remasking-based refinement to suppress residual harmful token generation while maintaining fluent outputs. The refinement stage selectively remasks suspicious token positions and regenerates safer alternatives from corrected semantic contexts. The proposed framework operates entirely at inference time and is compatible with existing masked diffusion language models. Experimental results demonstrate that our work reduces jailbreak attack success rates across multiple DLM benchmarks and attack settings. The proposed method outperforms existing remasking-based defenses while preserving general generation capability. The results further show that early-step semantic steering effectively redirects harmful denoising trajectories before unsafe generations become stabilized. Contributions We summarize our contributions as follows: 1. We propose an inference-time defense framework that combines semantic steering and remasking for DLM safety. 2. We identify early denoising trajectories as a critical control point for DLM safety and demonstrate that partial-step steering effectively guides safe generation. 3. We demonstrate that the proposed method reduces jailbreak attack success rates while preserving generation quality across multiple benchmarks and attack scenarios. 2 Background 2.1 Diffusion Models Diffusion models define a generative process that transforms a simple noise distribution into data through iterative denoising [ 11 , 25 ] . A diffusion model introduces a forward process that progressively corrupts clean data and a reverse process that reconstructs the original data. Let x\textasciitilde q(x) denote a data sample. The forward process defines a sequence of latent variables z_{t} indexed by continuous time t\in[0,1] . The forward process gradually injects noise into x such that q(z_{t}|x)=\mathcal{N}(z_{t};\sqrt{a_{t}}x,(1-\alpha_{t})I). (1) The parameter \alpha_{t} consistently decreases over time. The variable z_{0} approximates clean data and z_{1} approaches pure noise. A diffusion models learn a parameterized reverse process p_{\theta}(z_{s}|z_{t}) that reconstructs less noisy variables from noisy inputs. Diffusion models enable flexible generation since they do not impose a fixed generation order. 2.2 Masked Diffusion Language Models Masked diffusion language models extend diffusion modeling to discrete token spaces. A masked diffusion model replaces continuous noise with a masking corruption process over tokens. Let x=(x_{1},\dots,x_{L}) denote a sequence of tokens. Each token is represented as a categorical variable over a vocabulary V . The forward process replaces tokens with a special [MASK] token with probability determined by a schedule. The forward process defines: q(z_{t}|x)=Cat(z_{t};\alpha_{t}x+(1-\alpha_{t})m), (2) where m denotes the one-hot vector of the mask token [ 28 ] . The parameter \alpha_{t} controls the masking ratio. The reverse process predicts original tokens from partially masked sequences. A neural network x_{\theta}(z_{t},t) estimates the clean token distribution. The model optimizes a variational objective that reduces to a weighted masked language modeling loss. Masked diffusion language models generate text by starting from a fully masked sequence and iteratively unmasking tokens. Each step predicts tokens in parallel and refines the sequence. This formulation enables bidirectional context modeling and non-autoregressive generation. However, the iterative refinement process introduces unique dependencies across denoising steps. 2.3 Remasking in Masked Diffusion Language Models Remasking defines an inference-time mechanism that updates masked positions during denoising [ 30 ] . A remasking strategy selects a subset of predicted tokens to keep and remasks the remaining positions. Let z_{t} be the current sequence and \hat{z_{t}} be model predictions. The next state is z_{t-1}=\mathcal{R}(z_{t},\hat{z_{t}}), (3) where \mathcal{R} denotes the remasking operator. Recent work formulates remasking as an inference-time scaling process that adjusts token selection behavior. A scaling factor modifies token probabilities before selection, controlling the trade-off between deterministic and stochastic generation. This mechanism enables flexible control of generation without retraining the model and directly affects denoising trajectories.

Read the complete text