Blockwise SFT for Diffusion Language Models: Reconciling Bidirectional Attention and Autoregressive Decoding

Bowen Sun, Yujun Cai, Ming-Hsuan Yang, Yiwei Wang

Abstract

Discrete diffusion language models have shown strong potential for text generation, yet standard supervised fine-tuning (SFT) misaligns with their semi-autoregressive inference: training randomly masks tokens across the entire response, while inference generates fixed-size blocks sequentially. This mismatch introduces noisy prefixes and leaky suffixes, biasing gradients away from the desired blockwise likelihood. We propose Blockwise SFT, which partitions responses into fixed-size blocks, selects one active block per step for stochastic masking, freezes all preceding tokens, and fully hides future ones. Loss is computed only over the active block, directly mirroring the blockwise decoding process. Experiments on GSM8K, MATH, and MetaMathQA show consistent gains over classical SFT under equal compute or token budgets. Block size consistency studies and ablations confirm that improvements stem from faithful training-inference alignment rather than incidental masking effects. Our results highlight the importance of matching supervision granularity to the decoding procedure in diffusion-based language models.

Introduction: The Training-Inference Gap

Discrete diffusion language models (LMs) represent a promising frontier in text generation, offering a middle ground between the sequential nature of traditional autoregressive models and the parallel efficiency of non-autoregressive approaches. By generating text in parallel blocks, these models aim to optimize both speed and quality. However, a significant hurdle remains: the fundamental mismatch between how these models are trained and how they are deployed, known as the "training-inference gap."

Standard Supervised Fine-Tuning (SFT) for diffusion models typically employs a "global" approach. During training, tokens are randomly masked across the entire response, and the model uses bidirectional attention to reconstruct them. This contrasts sharply with inference, where the model operates semi-autoregressively—generating one fixed-size block at a time based on a clean, already-generated prefix, with zero knowledge of future tokens.

The Training-Inference Gap: Classical SFT uses bidirectional context and corrupts prefixes, while inference is one-directional and relies on clean prefixes.

This discrepancy leads to three primary issues:

  1. Noisy Prefixes: The model trains on corrupted contexts that never appear during real generation.
  2. Suffix Leakage: Bidirectional training allows the model to "cheat" by looking at future tokens to predict current ones—a capability it lacks at inference.
  3. Granularity Mismatch: Training optimizes token-level decisions, but inference requires block-level coordination.

Proposed Method: Blockwise SFT

To bridge this gap, we introduce Blockwise SFT, a training strategy designed to mirror the semi-autoregressive decoding process exactly. Instead of global masking, the method partitions the response into fixed-size blocks and focuses supervision on a single segment at a time.

The Blockwise SFT pipeline: splitting the completion, selecting an active block, and applying a masking strategy that aligns with semi-autoregressive decoding.

The Blockwise SFT pipeline follows a structured four-step process:

  1. Partitioning: The response is split into fixed-size blocks.
  2. Active Block Selection: For each training step, one block is randomly selected as the "active block."
  3. Structured Masking:
  4. Prefix: All tokens before the active block are kept "clean" (unmasked) and frozen.
  5. Active Block: Tokens within this block are stochastically masked for denoising.
  6. Suffix: All tokens after the active block are completely hidden (masked).
  7. Focused Loss: The loss is computed only over the masked tokens within the active block.

This approach ensures that gradients are aligned with the blockwise decoding process, preserves cross-block causality, and concentrates supervision where the model actually makes decisions during inference.

Experimental Evaluation

We evaluated Blockwise SFT using the MetaMathQA dataset for training and two rigorous benchmarks for evaluation: GSM8K (grade-school math) and MATH (high-school competition math). These datasets were chosen because mathematical reasoning requires strict causal dependencies; a model cannot solve a subsequent step if the previous steps are corrupted or if it has already "seen" the final answer through suffix leakage.

Key Results

Blockwise SFT consistently outperformed classical SFT and other recent diffusion-SFT variants across all tests:

  • GSM8K: Achieved 76.0% Pass@1, a significant +8.3 point gain over classical SFT (67.7%).
  • MATH: Achieved 34.2% Pass@1, notably improving upon the base model (31.7%), whereas classical SFT actually degraded performance to 29.6%.
  • Efficiency: Under a fixed "supervised-token budget," Blockwise SFT showed faster early-training progress and remained robust against the overfitting that often plagues classical SFT.

Discussion and Insights

The core insight of this work is that alignment is crucial. While bidirectional attention is a powerful mechanism, it can become a detrimental "crutch" during training if it violates the causal constraints of the decoding procedure. Even though Blockwise SFT supervises fewer tokens per training step (only one block vs. the whole sequence), the resulting gradients are "cleaner" and more representative of the inference task.

Furthermore, our consistency studies show that performance peaks when the training block size matches the inference block size. This confirms that the gains stem from structural alignment rather than incidental masking effects. Mathematically, we also prove that Blockwise SFT provides a variational upper bound on the true blockwise likelihood, grounding the method in solid theory.

Conclusion and Future Work

Blockwise SFT demonstrates that matching supervision granularity to the decoding procedure is vital for diffusion-based language models. By eliminating suffix leakage and noisy prefixes, we significantly enhance the reasoning capabilities of these models.

Future research could explore adaptive block sizing—adjusting block length based on model uncertainty or task complexity. Additionally, extending this alignment principle to other training paradigms, such as Reinforcement Learning from Human Feedback (RLHF), could further refine the behavior and reliability of diffusion LLMs.

Summary updated

BibTeX
@misc{sun2025blockwise,
  author = {Bowen Sun and Yujun Cai and Ming-Hsuan Yang and Yiwei Wang},
  title = {{Blockwise SFT for Diffusion Language Models: Reconciling Bidirectional Attention and Autoregressive Decoding}},
  year = {2025},
  eprint = {2508.19529},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.19529},
}

Loading related content...

Figure