Near-Far Attention: Region-Aware Sparse Retrieval for Long-Context LLM Decoding

YuanShuo Wang, Jianchao Tan, Lei Gong, Teng Wang, Wenqi Lou +1 more
11/23/2026
cs.LG

No confident code implementation found for this paper.

Abstract

Sparse attention reduces the cost of long-context decoding, but token selection introduces additional scoring and ranking overhead. Moreover, uniform page scoring overlooks differences in relevance between near and far context.

Show full abstract

We propose Near-Far Attention (NFA), which adapts retrieval to regional attention patterns while keeping candidate scoring lightweight. During prefill, the Lightweight Gate Estimator identifies regions that can be skipped during decoding, adding less than 1% to dense-prefill time. For the remaining regions, the Calibration-Free Subspace Extractor supplies compact features shared by page-level and token-level scoring without offline calibration. The Distance-Aware Two-Level Selector then scores near and far pages differently and jointly ranks candidate tokens under a shared budget. Evaluations across model families, parameter scales, and GQA/MLA architectures show aggregate task quality comparable to full attention. On Qwen3-8B at 512K context length, NFA achieves up to $5.49\times$ operator speedup and $2.97\times$ whole-model decoding speedup over FlashInfer, including selection overhead.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{wang2026nearfar,
  title  = {Near-Far Attention: Region-Aware Sparse Retrieval for Long-Context LLM Decoding},
  author = {YuanShuo Wang and Jianchao Tan and Lei Gong and Teng Wang and Wenqi Lou and Xuehai Zhou},
  year   = {2026},
  eprint = {2611.30554},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.30554v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.30554.svg)](https://codeofpaper.com/paper/2611.30554)

Discussion