Log inStart free
LESSON 33.13 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Prefix- and KV-aware routing

Four routers send the same 20 requests, and only some reuse the cached prompt.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 33.13 · ROUTER BAY20 REQUESTS · 10 SHARED PREFIXES · 1 PER 250 MS
01
Stage 1 of 5 · Shared prefix
Ten of the 20 requests start with the same 1,200-token system prompt. They arrive one every 250 ms.
Explain it simply

Each block on top is one request, placed at the time it arrives. The solid lower part of a block is the shared system prompt, the fixed instructions a chat bot puts first. Ten requests carry it, so the same 1,200 tokens arrive ten times. The letter under each block is the zone the user is in.

A strip of 20 request blocks, one every 250 ms. Ten blocks have a solid shared part of 1,200 tokens. Four lanes below: W1 and W2 in zone A, W3 and W4 in zone B.

request, prefillwaitrouter cost, cached prefixzone hopslowest TTFTfirst token
0123456time, sW1zone AW2zone AW3zone BW4zone BBAAR04ABBBBAABBABAAAAAAthe shared prefixarrivalsuser zoneshared 1,200 tokensown tokensR04: 1,392 tokens = 1,200 shared + 192 own · zone A0123456time, sW1zone AW2zone AW3zone BW4zone BBAAR04ABBBBAABBABAAAAAAthe shared prefixarrivalsuser zoneshared 1,200 tokensown tokensR04: 1,392 tokens = 1,200 shared + 192 own · zone A
Toy: the 33.C2 traffic, 20 requests on 4 replicas in 2 zones
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
prompti=1200+useri\sy{p}{data}{\text{prompt}_i} = \sy{c}{param}{1200} + \sy{u}{data}{\text{user}_i}
prompt1=1200+184=1384\text{prompt}_{1} = 1200 + 184 = 1384

A shared prompt is the 1,200 shared tokens plus the user part.

Common mix-ups

MYTHAlways send a shared prompt to the replica that caches it.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01Does prefix-aware routing raise or lower the prompt tokens that the replicas read?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.