Skip to content
All papers

Ring Attention with Blockwise Transformers for Near-Infinite Context

Hao Liu, Matei Zaharia, Pieter Abbeel2023arXiv 2023

Read it on arxiv.org(opens in a new tab)

Why this one

Read this after FlashAttention and FlashAttention-2, then keep The Google File System in the back of your mind. The trick here is not a new attention approximation or a bigger GPU wishlist. It treats a long context window like a distributed dataflow problem: split the sequence into blocks, move key and value blocks around a ring, and hide that movement behind useful compute. People often hear “near-infinite context” and think modeling breakthrough. The useful lesson is stricter: exact attention is still possible when memory is the limit, if your schedule respects where bytes live and when they move. For an engineer building long-context serving or training systems, this paper is worth the evening because it turns context length from a magic model property into a layout, communication, and overlap problem you can reason about.

What to take away

  • Sequence length can scale with device count when tokens are partitioned across machines instead of replicated everywhere.
  • The ring schedule overlaps KV block communication with attention compute, so networking is hidden rather than paid as a separate phase.
  • This preserves exact attention, unlike sparse or approximate long-context methods that change model behavior.

Reads with

Where it lands in the course

Inference Engineering · The KV Cache