SparseD: Sparse Attention for Diffusion Language Models

Zeqing Wang, Gongfan Fang, Xinyin Ma, Xingyi Yang, Xinchao Wang

Introduction

Diffusion Language Models (DLMs) are emerging as a promising alternative to standard autoregressive (AR) models. While AR models generate text sequentially from left to right, DLMs generate the entire sequence in parallel by iteratively denoising a sequence of masked tokens.

While this parallel decoding is powerful, it introduces a severe bottleneck: high inference latency. Because DLMs denoise all tokens simultaneously, they must compute bidirectional attention over the entire sequence (both prompt and generated tokens) at every single denoising step. As the context length grows, this quadratic complexity becomes crippling.

In AR models, "sparse attention" (such as sliding windows or sink tokens) is a standard fix to reduce this complexity. However, applying AR-style sparse attention to DLMs destroys generation quality. DLMs possess fundamentally different attention dynamics, necessitating a novel approach to accelerate them without compromising performance.

The SparseD Approach

To address these challenges, the authors introduce SparseD, an algorithm built on three core mechanisms designed specifically for the unique characteristics of DLM attention:

1. Skipping Sparse (Full Attention Early On)

The authors discovered that the earliest denoising steps are highly sensitive and dictate the macroscopic structure and quality of the final text. Sparsifying these early steps causes catastrophic degradation. Therefore, SparseD applies standard, full attention for the first fraction of steps (e.g., the first 20%) to preserve generation quality, and only switches to sparse attention for the later "refinement" steps.

Loss comparison showing the importance of full attention in early steps

2. Isolated Selection (Block-wise)

Unlike AR models, which often have predictable and fixed attention patterns, DLM attention patterns vary wildly across different attention heads. SparseD dynamically computes and selects the most important query-key blocks for each individual head. Furthermore, it selects top scores separately for prompt (prefill) tokens and generation tokens to ensure neither context is ignored.

3. Sparse Reusing

A key insight of the paper is that while attention patterns vary across heads, a single head's pattern remains remarkably stable across time (denoising steps). You do not need to recalculate which tokens are important at step 50 if you already determined it at step 10. SparseD computes the sparse mask just once (after the early full-attention steps) and reuses it for all remaining steps, drastically cutting computational overhead.

Attention patterns across different heads and denoising steps, highlighting temporal consistency

Key Results and Insights

The authors evaluated SparseD on recent DLMs (Dream-7B-Instruct and LLaDA-1.5) across various benchmarks, including short-context (MMLU, GSM8K, HumanEval), long-context (RULER up to 64k), and multimodal tasks.

  • Lossless Accuracy: SparseD maintains the exact same accuracy as the original, unoptimized models across all benchmarks. It vastly outperforms AR-based sparse methods (which tanked accuracy) and cache-based DLM methods (which struggled heavily on long-context tasks like RULER-8k).
  • Significant Speedups: At a 64k context length with 1,024 diffusion steps, SparseD achieved up to a $1.50\times$ speedup over FlashAttention.
  • Negligible Memory Overhead: Because SparseD selects important attention scores in a block-wise manner, the memory required to store the sparse masks is minimal (e.g., ~246 MB for a 64k sequence, compared to the ~75 GB of total runtime memory).

Limitations and Future Work

While SparseD offers a practical and efficient solution for deploying DLMs in long-context applications, there are areas for future improvement:

  • System-Level Optimization: The current work focuses primarily on algorithmic design. Future efforts could explore lower-level system and kernel optimizations to accelerate the computation of these head-specific sparse patterns even further.
  • Incompatibility with KV-Caching: Currently, combining SparseD with KV-cache-based acceleration methods causes a drop in performance. Because sparse attention and KV-caching operate on fundamentally different computational assumptions, safely integrating the two remains an open challenge for future research.

Summary updated

BibTeX
@inproceedings{wang2026sparsed,
  author = {Zeqing Wang and Gongfan Fang and Xinyin Ma and Xingyi Yang and Xinchao Wang},
  title = {{SparseD: Sparse Attention for Diffusion Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=dwbrZtYP04},
}
Figure