← All questions
Inference & ServingHard· Ring Attention· Attention· Mathematical Foundations

Why is ring attention mathematically exact?

The online-softmax accumulator maintains three statistics: running maximum logit m, running log-sum-exp denominator ℓ, and weighted output sum O. When a new KV chunk arrives, these values are merged using update equations that are associative and commutative. By applying this merge protocol over ring steps instead of SRAM tiles, the output remains bit-identical to single-GPU full-sequence attention.

Code playground (Python)