Manuscript Offprint

arXiv:2610.42084

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

Guangfu Guo, Xiaoqian Lu, Linsey Pang, Weiran Yao, Haolin Chen, Long Cheng, Kunpeng Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

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.

1 Introduction

In recent years, continuous diffusion language models have emerged as a promising research direction in text generation (Li et al., 2022; Gong et al., 2022). Unlike traditional autoregressive models that generate text token by token (Radford et al., 2019), continuous diffusion language models update the entire sequence through iterative denoising and leverage bidirectional contextual information for text generation (Hu et al., 2026; Chen et al., 2026; Guo et al., 2026). However, these models are typically trained on sequences of limited length. When the generation length exceeds the training length, models are prone to text repetition, semantic drift, and generation quality degradation, which

Figure

Figure 1: Context access of different attention mechanisms under length extrapolation. (a) Full attention accesses all tokens but may exceed the trained position 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.

limits their application to long-text generation tasks. Such degeneration can also be hidden by a low generative perplexity (Zhang et al., 2026; Franca and Tong, 2026).

For length extrapolation in language models, prior work has proposed a variety of training-free methods, but these methods mainly target autoregressive (AR) language models. They typically extend the effective context length by adjusting positional encodings or modifying the attention mechanism. For example, positional interpolation (PI) (Chen et al., 2023) and positional scaling (bloc97, 2023; Peng et al., 2026) adjust rotary position embeddings (RoPE) (Su et al., 2023) to alleviate positional mismatches beyond the training length, while sliding-window attention (SWA) preserves local information by restricting the attention span (Beltagy et al., 2020; Xiao et al., 2024; Jolicoeur-Martineau et al., 2026). In addition, Self-Extend (Jin et al., 2024) and LM-Infinite (Han et al., 2024) also pro-vide training-free context extension. However, because continuous diffusion language models rely on bidirectional iterative denoising, the applicability of existing length extrapolation methods and their effect on generation stability remain to be studied.

As shown in Figure 1, full attention encounters positional distances unseen during training, which may lead to generation degradation. In contrast, sliding-window attention avoids excessively long positional distances but loses access to distant contextual information, limiting cross-paragraph interactions. Moreover, continuous diffusion language models update the entire sequence at each denoising step, and different stages may require different amounts of contextual information. Further analysis shows that sliding-window attention may also alter the model's attention allocation to conditioning information. Even when some prefix tokens are retained, this effect cannot be completely eliminated. Therefore, existing methods still face three main challenges: (1) positional mismatches beyond the training range; (2) unstable conditioning attention; and (3) limited access to distant contextual information.

To address these challenges, we propose RangeSWA, a training-free length extrapolation method for continuous diffusion language models. The method combines local sliding-window attention, remote block summaries, and dynamic content retrieval into a unified attention mechanism to preserve local information while enabling long-range context access. Meanwhile, we introduce positional remapping and conditioning attention correction to alleviate positional and conditioning mismatches caused by length extrapolation. In addition, denoising-stage-adaptive window scheduling adjusts the attention span across different denoising stages, further improving the stability of long-text generation. The proposed method requires no updates to pretrained model parameters and can be directly applied to existing models.

We conduct length extrapolation experiments from 1k to 8k tokens on three Embedded Language Flows (ELF) models, ELF-B/M/L (Hu et al., 2026), and further evaluate the applicability of the method to CoLa (Guo et al., 2026) and LangFlow (Chen et al., 2026). Experimental results show that, compared with standard sliding-window attention, RangeSWA effectively reduces generative perplexity and text repetition rates in long-text generation on ELF-M/L. Ablation experiments further demonstrate that conditioning attention correction and adaptive window scheduling account for most of the perplexity improvements, while remote context access further reduces text repetition.

We summarize our main contributions as follows:

  1. We identify three key challenges in length extrapolation for continuous diffusion language models: positional mismatches, conditioning attention instability, and limited access to distant contextual information.

  2. We propose RangeSWA, a training-free length extrapolation method that combines local and remote attention mechanisms, positional remapping, conditioning attention correction, and adaptive window scheduling to mitigate long-text generation degradation.

  3. We conduct experiments on ELF-B/M/L, CoLa, and LangFlow to demonstrate the effectiveness of RangeSWA in reducing generative perplexity and text repetition rates, and analyze the contributions of individual components through ablation studies.

References (52)