arXiv:2610.20392cs.CLOct 2026

Manuscript Offprint

arXiv:2610.20392

FOLD: Position-Free Far Memory with Local Order for Long-Context Speculative Decoding

Shuxuan Li, Jialiang Kang, Yanghao Zhou, Ziye Zhu, Xiao Yang

Abstract

Speculative decoding accelerates LLM generation through lightweight drafting and parallel verification. It is particularly promising for long inputs, where KV-cache access costs can be amortized over multiple accepted tokens. Yet most drafters are trained on short sequences and degrade on long inputs, while long-context training is costly. Existing training-free approaches restrict the context window, rescale positions, or augment recent context with retrieved distant entries. Drafters, however, read target hidden states that already encode contextual and positional information, and their lightweight architecture makes full-history attention affordable. We propose FOLD, a training-free method that preserves exact local positions and treats all distant entries as far memory at a shared position. To counter attention dilution as the memory grows, we sharpen attention within it to emphasize relevant entries while separately controlling its total weight relative to the local window. Across six target-drafter pairs and diverse benchmarks of up to 256K tokens, FOLD predominantly delivers the highest speedup, with the best case more than doubling the speedup over autoregressive decoding, from 2.08×2.08\times to 4.22×4.22\times.

1 Introduction

Large language models (LLMs) are increasingly deployed in long-context applications, such as long-document understanding, repository-scale coding, and agentic workflows, where inputs can span hundreds of thousands of tokens (Zhu et al., 2026; Yang et al., 2026). At these lengths, attention over the KV cache becomes a major cost of decoding. For Llama-3.1-8B at 128K tokens, it takes 46% of an autoregressive (AR) decoding step, more than the weight matrix multiplications (Figure 1). Speculative decoding (SD) (Leviathan et al., 2023; Chen

Figure

Figure 1: Latency breakdown across context lengths for Llama-3.1-8B (vLLM, one H100 GPU, batch size 1), for an AR step and a DFlash SD round with block size 10. From 1K to 128K tokens, target KV-cache attention grows from 5% to 46% of the AR step, while drafter KV-cache attention stays below 7% of the SD round.

et al., 2023a) accelerates decoding without changing the output distribution, as a lightweight drafter proposes tokens that the target model verifies in parallel. This amortizes weight and KV cache reads over accepted tokens and pays off more as the context grows (Sadhukhan et al., 2025). Block-parallel drafters such as DFlash (Chen et al., 2026) and DSpark (Cheng et al., 2026) further reduce drafting cost by proposing a block of tokens at once.

Cheap drafting, however, helps only if the drafts are accepted. Most existing drafters are trained on short sequences, for example 3K tokens for the Llama-3.1-8B DFlash drafter (Chen et al., 2026), and degrade substantially on longer inputs. As Figure 2 shows, the speedup of the Llama-3.1-8B DFlash drafter nearly halves within 32K tokens, and that of the Gemma-4-12B drafter falls from 3.18×3.18\times to 1.94×1.94\times as LongBench v2 inputs grow beyond 128K. Long-context fine-tuning and dedicated length-generalization training can mitigate this degradation (Chen et al., 2026; Yang et al.,

*Corresponding author. Code is available at https://github.com/NuyoahNasuS/FOLD.

Figure

Figure 2: Long-context degradation of DFlash drafters. Speedup over AR decoding for Llama-3.1-8B and Gemma-4-12B on SPEED-Bench (1K–32K tokens) (Abramovich et al., 2026), Long-Bench v2 (Bai et al., 2025) (grouped by input length), and Retr.KV (Zhang et al., 2024).

2026), but require additional data and training for each target-drafter pair, motivating training-free adaptation of existing drafters.

Prior work attributes much of this degradation to relative positions beyond the training range (Chen et al., 2026; Yang et al., 2026). Training-free remedies, developed mostly for language models and partly adopted in SD, handle these positions differently. StreamingLLM (Xiao et al., 2024b) retains attention sinks and a recent window but discards the remaining history, a strategy also adopted for self-speculative drafting in MagicDec (Sadhukhan et al., 2025). Position scaling methods such as YaRN (Peng et al., 2024), also applied to block-parallel drafters (Rusanovsky et al., 2026), retain the full context but remap all positions. ReRoPE (Su, 2023) preserves exact local distances and caps distant ones, with length-dependent scaling applied to all attention logits to counter attention dilution. InfLLM (Xiao et al., 2024a) and SpecExtend (Cha et al., 2026) augment recent context with retrieved distant blocks, introducing selection and refresh overhead.

To address positional extrapolation, we seek to keep the drafter's effective relative distances within its training range while retaining distant information. Block-parallel drafters such as DFlash derive their historical keys and values from target hidden states that already encode contextual and positional information. Our findings suggest that distant states can serve as content-bearing memory at bounded distances, while precise local positions preserve the short-context structure needed for upcoming predictions. Reading this memory in full is also affordable for the lightweight drafter, whose KV-cache attention accounts for only a small fraction of SD-round latency (Figure 1). Retaining all history thus avoids selection and refresh overhead that can offset the savings from attending to fewer entries and erode SD speedup.

Building on this view, we propose FOLD, a training-free method that preserves exact relative positions within a local window to retain the positional structure learned on short sequences and maps all distant entries to a shared position just beyond it, forming a far memory. To counter attention dilution as the memory grows, FOLD normalizes the window and the memory separately and uses a concentration factor α\alpha to control both how attention is distributed within the memory and how much total weight it receives. FOLD leaves target-model verification unchanged and recovers the original attention computation when the context fits within the window. We evaluate FOLD across six target-drafter pairs with inputs of up to 256K tokens. On seven long-context benchmarks, it consistently raises the average speedup over AR decoding of the original drafters, by 9% to 61% across Llama-3.1-8B, Qwen3.5-9B, and Gemma-4-12B. The gains also extend to DSpark drafters and the SGLang inference engine. Our contributions are as follows:

• We analyze the behavior of long-context drafting, finding that large relative distances can reduce acceptance and that target-derived features encode coarse positional information.

• We propose FOLD, which retains distant context at a shared position and controls attention dilution through decoupled normalization.

• We systematically evaluate and analyze FOLD’s performance across drafter designs and input lengths.

References (33)