Ring Attention is a method that splits a long sequence into blocks, gives one block to each of several GPUs or TPUs (hosts), and computes attention while passing the key and value blocks around a ring of hosts. Liu, Zaharia, and Abbeel at UC Berkeley proposed it in 2023 in the paper "Ring Attention with Blockwise Transformers for Near-Infinite Context."
Computing attention block by block, as FlashAttention does, avoids keeping the matrix in memory. Even so, each layer's output (activations as long as the sequence) must still fit in the memory of a single device. By the paper's estimate, even a modest model with a hidden size of 1,024 needs more than 1,000 GB of memory to process 100 million tokens, which does not fit on a single GPU or TPU with less than 100 GB.
Ring Attention splits the sequence itself across the hosts. Each host keeps its own query block, and only the key and value blocks travel around the ring. The next block is sent and received while the current block is being computed, so communication latency is almost entirely hidden. As a result, the sequence length that can be handled grows in proportion to the number of hosts.
As a conveyor-belt sushi analogy: the customers (query blocks) stay in their seats while the plates (key and value blocks) travel around the belt. Each customer receives the next plate while eating the one in front of them, so no one has to wait.
In the figure at the top of the article, the left side shows the computation on one host, and the right side shows the ring of hosts and which host computes which tile of the attention matrix at which step.

