Ring Attention with Blockwise Transformers for Near-Infinite Context

Hao Liu, Matei Zaharia, Pieter Abbeel
2/12/2026

No official code found. Best implementation: haoliuhl/ringattention (773 stars, Apache-2.0, last commit 2025-10-13).

Abstract

Transformers have emerged as the architecture of choice for many state-of-the-art AI models, showcasing exceptional performance across a wide range of AI applications. However, the memory demands imposed by Transformers limit their ability to handle long sequences, thereby posing challenges in utilizing videos, actions, and other long-form sequences and modalities in complex environments. We present a novel approach, Ring Attention with Blockwise Transformers (Ring Attention), which leverages blockwise computation of self-attention and feedforward to distribute long sequences across multiple devices while fully overlapping the communication of key-value blocks with the computation of blockwise attention. Our approach enables training and inference of sequences that are up to device count times longer than those achievable by prior memory-efficient Transformers, without resorting to approximations or incurring additional communication and computation overheads. Extensive experiments on language modeling and reinforcement learning tasks demonstrate the effectiveness of our approach in allowing millions of tokens context size and improving performance.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Large Context Attention

77353PythonJun 1, 20231 years agoApache-2.0
large-language-modelslong-contextmemory-efficienttransformers

Similar Papers

Cite this paper

@article{liu2026ring,
  title  = {Ring Attention with Blockwise Transformers for Near-Infinite Context},
  author = {Hao Liu and Matei Zaharia and Pieter Abbeel},
  year   = {2026},
  eprint = {2310.01889},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/pdf/2310.01889},
  journal = {ICLR 2023 2023}
}

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

Discussion