RangeSWA: Training-Free Length Extrapolation for Continuous Diffusion Language Models

Guangfu Guo, Xiaoqian Lu, Linsey Pang, Weiran Yao, Haolin Chen, Long Cheng, Kunpeng LiuarXiv 2026 · arXiv

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.

Figure 1: Context access of different attention mech- anisms under length extrapolation. (a) Full attention accesses all tokens but may exceed the trained posi- tion range. (b) Sliding-window attention attends only to nearby tokens and ignores distant information. (c) RangeSWA uses both local and distant information and maps distant positions back into the trained range.

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:

  1. Local Sliding Window: Preserves fine-grained local details.
  2. Remote Block Summaries: Uses mean-pooled representations of distant blocks to provide a "coarse" global view.
  3. 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.
Figure 2: Overview of the RangeSWA attention mechanism. Each body query attends to a local window, summaries of remote blocks and the top-K retrieved blocks, together with control tokens, in a single softmax after positional remapping. The right panel shows the attention masks.

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.
Qualitative comparison showing how RangeSWA maintains topic coherence while Full Attention collapses into repetition.

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

Abstract

Continuous diffusion language models show promising potential in text generation tasks, but are prone to problems such as text repetition, semantic drift, and generation quality degradation when the generation length exceeds the training length. To address these challenges, we propose RangeSWA, a training-free length extrapolation method. The method combines local sliding-window attention, remote block summaries, and dynamic content retrieval to preserve local details and support long-range context access. In addition, generation degradation caused by length extrapolation is mitigated through positional remapping, conditioning attention correction, and denoising-stage-adaptive window scheduling. We conducted experiments on multiple continuous diffusion language models, and the results show that RangeSWA can effectively reduce generative perplexity and text repetition rates in long-text generation.
BibTeX
@misc{guo2026rangeswa,
  author = {Guangfu Guo and Xiaoqian Lu and Linsey Pang and Weiran Yao and Haolin Chen and Long Cheng and Kunpeng Liu},
  title = {{RangeSWA: Training-Free Length Extrapolation for Continuous Diffusion Language Models}},
  year = {2026},
  eprint = {2610.42084},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.42084},
}
Figure