context-parallelism -- pass the KV, or pass the queries?

When one prompt is too long for a single chip, the text is divided among several, and each chip holds some of the words but must compare them against all the others. Exactly one of the two things being compared must travel: either the stored notes about the text move around the chips, or the questions being asked of them do. Both routes work out the same answer — it is a shipping decision, not an approximation. Reading a full prompt puts every question in that chip's share in flight at once, and moving the notes is cheaper at every setting here. Writing the reply makes moving the question cheaper only while those questions sit left of the crossing. A large batch on a short shard sits on the same side as the prompt, and so does leaving the notes in place: then only the new notes travel, the two curves never cross, and moving the notes wins for both halves.

Interactive page: the serving decision that sits on top of a sequence-sharded attention. The sharding, the blocks rotating around a ring, the online-softmax accumulation and the compute-vs-transfer overlap are the mechanism -- and they are the neighbouring ring-attention page's subject, not re-taught here. This page asks the one question that mechanism leaves open:

Every (query, key) pair has to meet, and exactly one of the two operands has to travel to make that happen. Which one do you move?

Pass-KV circulates the keys and values and keeps each device's queries pinned. Pass-Q circulates the query blocks against resident KV. Both compute the same attention output -- the arithmetic is identical and neither is an approximation of the other. Only the traffic differs, and which one is cheaper flips between phases. Anchor: A4 KV cache / runtime shape (Family J, serving-time mechanisms).

What it shows

Head dimension is held fixed at 128 so the head counts stay the story; Q, K V are 16-bit and the circulating partial output and its softmax statistics are fp32, as an online softmax requires.

The bytes are an exact consequence of the stated shapes and dtypes. They are not a measurement of any particular interconnect, engine or accelerator -- there is no wire time on this page, only what has to cross it.

Two URLs, opposite verdicts

Same model, same devices, same grouping; only the phase differs:

URLVerdict
🔵index.html?phase=prefill&seqPow=17&devices=8&qheads=32&kvheads=8pass-KV -- 64.0 MiB/hop vs pass-Q 388.0 MiB/hop
🟠index.html?phase=decode&seqPow=17&devices=8&qheads=32&kvheads=8&batch=1pass-Q -- 24.3 KiB/hop vs pass-KV 64.0 MiB/hop

Interactions

Press play (or scrub) to step the exchange hop by hop -- the ring draws whichever operand is the one that moves under the current pattern, and the other stays pinned in its box. Drag anywhere on the plot to move the operating point; drag the ✕ to re-solve the crossing for a KV-head grouping. Hover a device for what it holds, what it is sending and to whom; hover either curve for its byte arithmetic term by term; hover the ✕ for the crossing expression. The steppers and sliders resize the problem live (sequence length, devices, query heads, KV heads, decode batch), and the phase select flips the verdict.

Render tier

T1 (Canvas2D throughout: the device ring, the log-log cost plot, the verdict card).

Wiring

layout.mount + controls (sequence length, devices, query heads, KV heads, phase, decode batch, shard persistence, which pattern the ring draws) + a Transport over the ring hops (autoplay + loop) + onPointer drags for the operating point and the crossing + hover-to-inspect + two challenges + an A/B compare across the two phases. URL hooks: every control is mirrored into the query string (?phase= ?seqPow= ?devices= ?qheads= ?kvheads= ?batch= ?persist= ?show=), plus ?step=N, ?opq=N and ?crossq=N (headless stand-ins for the two drags), ?hover=x,y and ?play=1. Source: page.js.

Sources