Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models

Xiang Hu, Zhanchao Zhou, Ruiqi Liang, Zehuan Li, Wei Wu +1 more
11/28/2025
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

This work explores the challenge of building ``Machines that Can Remember'', framing long-term memory as the problem of efficient ultra-long context modeling. We argue that this requires three key properties: \textbf{sparsity}, \textbf{random-access flexibility}, and \textbf{length generalization}. To address ultra-long-context modeling, we leverage Hierarchical Sparse Attention (HSA), a novel attention mechanism that satisfies all three properties. We integrate HSA into Transformers to build HSA-UltraLong, which is an 8B-parameter MoE model trained on over 8 trillion tokens and is rigorously evaluated on different tasks with in-domain and out-of-domain context lengths to demonstrate its capability in handling ultra-long contexts. Results show that our model performs comparably to full-attention baselines on in-domain lengths while achieving over 90\% accuracy on most in-context retrieval tasks with contexts up to 16M. This report outlines our experimental insights and open problems, contributing a foundation for future research in ultra-long context modeling.

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{hu2025every,
  title  = {Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models},
  author = {Xiang Hu and Zhanchao Zhou and Ruiqi Liang and Zehuan Li and Wei Wu and Jianguo Li},
  year   = {2025},
  eprint = {2511.23319},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2511.23319v1}
}

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/2511.23319.svg)](https://codeofpaper.com/paper/2511.23319)

Discussion