Manuscript Offprint

arXiv:2609.07237

CEDAR: Error-Bounded Residual Routing for Efficient Long-Context Attention

Siyu Li, Dong Wang, Jie Zhou, Wei Li, Yang Xu, Sijie Song

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Post-hoc sparse attention accelerates long-context prefill by routing each query to a small set of token-level interactions. Hard selection, however, assigns zero probability to every omitted chunk: a routing miss cannot be recovered, and a fixed expansion budget spends the same work on easy and ambiguous queries. We introduce Coarse-to-fine Error-aware Dynamic Attention Routing (CEDAR), a coarse-to-fine method that keeps the language model frozen while preserving global coverage. Each semantic chunk contributes a cheap key-value summary to a residual attention path; chunks with high estimated approximation error are then expanded to exact token attention. Exact and summarized contributions are combined in a single softmax normalization, so refinement replaces, rather than duplicates, coarse evidence. We derive an output-error bound governed by within-chunk key/value dispersion and use it to allocate a variable refinement budget. A controlled clustered-attention study shows that residual summaries reduce reconstruction error by more than 98% relative to hard dropping at equal exact-chunk budgets. Experiments on long-context benchmarks demonstrate that CEDAR recovers most of the quality lost by hard sparse routing while maintaining approximately 3× kernel speedup at 128K context.

1 Introduction

Long-context language models increasingly operate on books, repositories, multi-document evidence, and extended conversations. Standard softmax attention remains expensive because every query interacts with every earlier key (Vaswani et al., 2017). Sparse attention reduces this cost by computing only a selected subset of interactions, but the selection must be both accurate and cheap (Child, 2019; Beltagy et al., 2020; Zaheer et al., 2020).

Recent methods make sparsity input dependent. MInference chooses structured patterns and es-

timates their indices online (Jiang et al., 2024); block-sparse methods retrieve relevant blocks (Guo et al., 2024); and Native Sparse Attention learns a hierarchical combination of compressed, selected, and local branches (Yuan et al., 2025). These approaches demonstrate that dynamic routing is effective, but many require architecture changes, continued training, or hardware-specific implementations.

DHSA (Xiong et al.) instead keeps a pretrained decoder-only model frozen and predicts content-aware variable-length chunks from its key states. Chunk-level similarity routes each query to a fixed token budget, after which a sparse backend computes exact attention over the selected tokens. This is attractive for post-hoc deployment, especially under limited memory. Nevertheless, DHSA exposes two related failure modes:

  1. Hard omission. Unselected chunks contribute neither probability mass nor values. A false-negative route is therefore irreversible, even when the omitted chunk is moderately relevant.

  2. Uniform refinement. A fixed token density allocates the same exact-computation budget to concentrated and diffuse query distributions. Easy queries are over-served while uncertain queries may remain under-refined.

The hierarchy already computed by DHSA suggests a natural remedy. A semantic chunk is not only a routing unit; it is also a compressible unit. We therefore ask: Can every chunk remain globally visible at low cost, while exact token attention is reserved for chunks whose summaries are insufficient?

We answer with CEDAR, illustrated in Figure 1. CEDAR adds a residual summary path to content-aware hierarchical routing. Every omitted chunk is represented by a length-corrected key-value summary. Selected chunks are expanded into their orig-inal tokens, and their summaries are removed. A single softmax combines both sets. We then estimate each chunk's possible approximation error from its relevance and within-chunk dispersion, and refine chunks greedily under a latency or error budget. This makes CEDAR a direct follow-up to DHSA: semantic chunking remains the routing substrate, while the treatment of unselected chunks and the allocation of exact work are changed.

Our contributions are:

  • Softmax-compatible residual coverage. We formulate hybrid attention over exact tokens and coarse chunk summaries without double counting, preserving a global information path even under aggressive sparsity.

  • Error-aware adaptive refinement. We derive a chunk-level output-error bound and turn it into a practical priority score that assigns variable exact budgets across queries.

  • Deployable extension of frozen LLMs. The method reuses DHSA boundaries and representations, requires no modification to backbone weights, and admits a streaming online-softmax implementation.

References (16)