Continuous diffusion language models (CDLMs) are an exciting alternative to standard autoregressive (AR) models like GPT-4. By updating entire sequences iteratively through denoising, they capture bidirectional context more naturally. However, they share a common Achilles' heel: they are typically trained on short sequences and "break" when asked to generate longer text, leading to severe repetition and semantic drift.
In their new paper, RangeSWA, a team of researchers introduces a training-free method to extend the generation length of these models without any fine-tuning.
TL;DR
RangeSWA is a training-free length extrapolation method for continuous diffusion language models that combines local sliding-window attention with remote block summaries and dynamic content retrieval. It effectively mitigates text repetition and quality degradation in long-text generation by remapping positions and correcting attention imbalances inherent in diffusion architectures.
What Problem Does This Paper Address?
Most language models are trained on fixed-length windows (e.g., 1024 tokens). When generating beyond this "training horizon," models encounter positional distances they've never seen before. For AR models, techniques like Positional Interpolation or RoPE scaling work well.
However, CDLMs are different. They rely on bidirectional iterative denoising, where the model repeatedly refines the entire sequence. Simply applying AR extrapolation tricks often fails because CDLMs use special "control tokens" (for time steps and guidance) that interact globally with the sequence. Standard sliding-window attention (SWA) ignores distant context and accidentally boosts the influence of these control tokens, causing the model to lose its way.
Methods
RangeSWA (Range-based Sliding Window Attention) introduces a unified attention mechanism that integrates three distinct views of the context into a single softmax operation:
- Local Sliding Window: Preserves fine-grained local details.
- Remote Block Summaries: Uses mean-pooled representations of distant blocks to provide a "coarse" global view.
- Dynamic Content Retrieval: Identifies and includes the top-$K$ most relevant distant blocks in their original, fine-grained form.
To make this work in a diffusion setting, the authors add several crucial "corrections":
- Positional Remapping: Farther interactions use grouped coordinates to ensure all query-key distances stay within the pre-trained range.
- Conditioning Attention Correction: It compensates for the "mass shift" that occurs when a sliding window is used, preventing control tokens from dominating the attention budget.
- Denoising-Stage-Adaptive Window: The attention span is dynamically adjusted—wider during the high-noise early stages of diffusion to capture global structure, and narrower during the late stages to focus on local token decoding.
Datasets
The authors evaluated RangeSWA across several continuous diffusion backbones:
- ELF-B/M/L (Embedded Language Flows): Evaluated at 1k, 2k, 4k, and 8k token lengths.
- CoLa (Continuous Latent Diffusion): Tested for generalization on blockwise generation.
- LangFlow: A continuous diffusion model trained on OpenWebText.
Key Insights and Ideas
- The "Control Mass" Problem: A key discovery was that standard sliding windows significantly alter the model's attention allocation. Because distant body tokens are dropped, the relative weight of global control tokens spikes (sometimes by nearly 2x), leading to instability. RangeSWA's logit correction specifically targets this.
- Coarse vs. Fine Context: The paper shows that coarse summaries alone aren't enough to prevent repetition. You need the "dynamic retrieval" of specific distant blocks to maintain long-range lexical continuity.
- Diffusion is Non-Stationary: Unlike AR models where the context is fixed once generated, CDLMs update everything at every step. RangeSWA re-computes its retrieval at every layer and every denoising step to follow the evolving representation of the text.
Key Results
RangeSWA significantly outperforms standard full attention and sliding-window baselines in long-text scenarios:
- Repetition Reduction: On the ELF-M model at 8k tokens, RangeSWA reduced the four-gram repetition rate ($R_4$) from a staggering 95.1% (Full Attention) down to just 1.2%.
- Perplexity Stability: While full attention models often show "fake" low perplexity due to extreme repetition, RangeSWA maintains a healthy generative perplexity that correlates with actual text quality.
- Efficiency: Despite the extra retrieval steps, the sparse nature of the attention allows for a 1.21x speedup over full attention at 8k lengths on an H100 GPU. A "Lite" version of the algorithm achieves up to 1.62x speedup.
Limitations and Future Work
The authors acknowledge that RangeSWA has not yet been tested on massive-scale (multi-billion parameter) continuous diffusion models, as few such open-source checkpoints currently exist. While it effectively mitigates repetition and drift, the overall semantic coherence of very long generated texts still has room for improvement. Future work will likely explore scaling these methods to larger pre-trained models and further optimizing the retrieval-based attention kernels.
Summary updated