KV Crossover
Inference systemsDiscrete-event study

KV
Crossover

When is a cached prefix worth copying?

Follow one routing decision across two A100 workers. Wait for the warm cache, recompute on the other worker, or copy blocks over a shared link.

Explore the prefix anatomy
Twelve matching KV blocks in the example prompt pair Exploded drawing of twelve equal cache blocks. Each block holds 512 tokens, or 64 MiB on the modeled A100. 512 tokens / block 12 shared blocks
Mooncake example pair12 shared blocks · 512 tokens per block768 MiB

Partial-copy hand fixture (Request 3, cuts B/0 to B/4)

SYNTHETIC FIXTUREConstructed costs (not A100)

Observed TTFT across forced cuts B/0 to B/4 is 90, 80, 70, 80, 90 ms (physical copy 0 to 256 MiB). Two blocks fit under worker B's 40 ms remaining phase; a third adds 20 ms of copy wait to save 10 ms of prefill.

Synthetic hand fixture: forced cuts on worker B (not A100)Synthetic hand fixture: forced cuts on worker B (not A100)TTFT (ms): Solid olive bars show observed forced replay. Hollow blue diamonds mark the serial forecast (nominal and aware agree).Observed / forecast (ms) · new MiBB/0 · recompute90.000 / 91.000 · 0B/1 · copy 180.000 / 81.000 · 64B/2 · copy 270.000 / 71.000 · 128B/3 · copy 380.000 / 80.000 · 192B/4 · copy 490.000 / 90.000 · 256020406080100Fastest measured: B/2.Only B cuts are measured while A has 119 ms left. The endpoints B/0 and B/4 tie at 90 ms.

Request 1076 counterfactual branches (Tool/agent, 1x nominal)

TRACE COUNTERFACTUALPost-selected teaching case (1x A100)

Serial forecasts predict 20.77 to 21.57 s, while forced observed TTFT is 1.66 to 4.60 s. All four placements miss the 1,000 ms TTFT target and leave the measured cohort at 133/325 on time (0 gained, 0 lost).

Trace counterfactual: forced branches for tool/agent request 1076Trace counterfactual: forced branches for tool/agent request 1076TTFT (ms): Solid olive bars show observed forced replay. Hollow blue diamonds mark the serial forecast (nominal and aware agree).Observed / forecast (ms) · new MiB1,000 ms TTFT targetA/12 · recompute suffix4,522.709 / 20,924.732 · 0A/13 · copy 14,599.237 / 20,849.771 · 64A/14 · copy 24,466.450 / 20,773.988 · 128B/14 · wait locally1,662.062 / 21,571.573 · 005,00010,00015,00020,00025,000Fastest measured: B/14.Post-selected case under nominal continuation. Reference cohort: 133/325 on time (all four branches miss the 1,000 ms TTFT target).

Mooncake trace findings (separate denominators: Conversation vs Tool/agent)

PAIRED TRACE REPLAYQualified A100 subset
StudyConversationTool/agent
Primary aware minus nominal (24 windows)0.000 req/s (0/274 contested at 1x)0.000 req/s (1/845 contested at 1x)
Held-out replication (26 blocks, 1,560 s, continuous)1,386 / 2,920 on time (98 overlaps, 0 flips)1,799 / 8,238 on time (87 overlaps, 0 flips)
Continuous matrix: budgeted minus longest (sched-aware / aware)+1 net (+0.00064 req/s), -2.375 GiB cohort receipts+8 net (+0.00513 req/s), -6.188 GiB cohort receipts
Same-action TTFT median abs error (serial to scheduler-aware)9298.0 ms to 15.5 ms14469.5 ms to 126.2 ms (35 absent)

Source-queue overlap crossover (54 cells)

DESIGNED A100 GRIDNot trace prevalence

Elevated some primary slice (18 cells): 7/18 interior wins, mean focal TTFT -76.743 ms, mean drain traffic -78.222 MiB/cell, on-time 78/90 (1.733 req/s each). Full 54-cell grid: 7/54 wins, mean focal TTFT -25.581 ms, total drain saved 1,408 MiB, on-time 243/270 (1.800 req/s each).

The routing decision

One prompt, three routes

EXAMPLE PAIR 2 trace records · 512-token block reuse

In examples/mooncake-pair.jsonl, the matcher compares block hashes until the first divergence. Only complete 512-token blocks qualify for KV reuse; partial tails are always processed locally.

The two prompts share 12 blocks (6,144 tokens, 768 MiB). Choose a route below to trace which work stays local and which crosses the link.

Routing action

When a competing copy changes the winner

SYNTHETIC FIXTURE Forced alternatives · Observed simulated TTFT (not router scores)

Adding one independent 768 MiB copy produces 12 CSV-winner changes: 7 outright flips (3 to Wait, 4 to Recompute) + 5 shifts into exact ties (3 W/T, 2 W/R, tie-broken to Wait). Click any cell below to compare Wait, Recompute, and Transfer TTFTs side by side.

Constructed costs per cell (replayed 3 times from fresh state): tail + first decode = 10 ms, cold service = 100 ms, Worker B starts free. Exact ties are computed from raw nanoseconds (W=T, W=R; CSV tie-break order is Wait < Recompute < Transfer).

W Wait on A R Recompute cold on B T Transfer 768 MiB to B W=T / W=R Exact raw-ns tie Outright flip (7 cells: 3 to Wait, 4 to Recompute) Into exact tie (5 cells: 3 W/T, 2 W/R, tie-broken to Wait; 12 CSV changes total)

Idle link (no competing copy)

Contested link (+1 independent 768 MiB copy)

How compute and bandwidth move the boundary

ANALYTIC MODEL Vidur A100 table · Separate from synthetic map above

Using the pinned profiles/a100.csv table instead of hand costs: avoiding 48 prefill chunks (6,144 tokens) saves  ms, against an imposed A backlog of one cold 512-token prefill plus one decode ( ms). At 12.5 GiB/s, an equal competing copy doubles transfer time from 60 ms to 120 ms. Explore how scaling compute or link bandwidth shifts the decision boundary.

Selected A100 Boundary Comparison

Compute:
Bandwidth:
Link:

3x3 Sensitivity Matrix (click any cell)

Decision boundaries under an equal-copy assumption, not measured trace goodputs or scheduler queue simulations.

Findings across the study

SYNTHETIC FIXTURE
70 ms → 130 ms
Adding one competing 768 MiB copy at 12,800 MiB/s and 100 ms backlog flips the winner from Transfer to Recompute (100 ms).
PAIRED TRACE REPLAY
0.000 req/s delta
Aware minus nominal goodput tied on all 24 primary windows and all 104 held-out replication blocks across both Mooncake traces.
PAIRED TRACE REPLAY
+0.049 / +0.046/s
Scheduler-aware compute beats serial (Conv / Tool), far above menu widening (+0.00064 / +0.00513/s), yet still below +0.1/s.
DESIGNED A100 GRID
7 / 18 interior wins
Source-queue ladder saves 76.743 ms mean focal TTFT and 78.222 MiB/cell drain on elevated some cells, with 0 extra on-time requests.

The partial-copy challenge

Can a partial copy beat both endpoints?

SYNTHETIC FIXTURE Constructed costs (not A100) · Predict before reveal

Request 3 arrives at 2 ms with a 2,176-token prompt (4 full 512-token blocks plus a 128-token tail). Worker A holds all 4 blocks behind a 119 ms non-preemptible phase; Worker B holds 0 blocks behind a 40 ms phase.

Block size 512 tokens (64 MiB)
Idle link speed 20 ms / block (overlaps B)
Worker B compute 10 ms / uncopied + 10 ms tail
Worker A · 4 of 4 blocks resident
Running phase has 119 ms remaining (serial forecast: 130 ms TTFT).
Worker B · 0 of 4 blocks resident
Running phase has 40 ms remaining (ID 2 emits at +40.000 ms). Link copies 20 ms/block while B runs.
Predict before revealing: which measured cut on Worker B gives the earliest first token?

Request 1076

Where the serial forecast went wrong

TRACE COUNTERFACTUAL Post-selected teaching case (1x A100) · Nominal continuation

Tool/agent Request 1076 arrives with 7,173 tokens (14 full 512-token blocks + 5-token tail) at source tick 179,999 ms (reset clock 89,999 ms, 1x A100 nominal window). At the exact same tick, earlier arrival Request 1061 starts copying 2 different blocks (128 MiB) to Worker B. An A-bound transfer cannot join that batch and shares the 12.5 GiB/s link with it.

Worker A · 12 of 14 blocks resident (6,144 tokens)
Options: recompute 2 blocks locally (A/12), copy 1 block (A/13, budgeted menu only), or copy 2 blocks (A/14, nominal reference).
Worker B · 14 of 14 blocks resident (7,168 tokens)
Option: wait locally on B (B/14) for the 5-token tail + first decode. Request 1061 already started 128 MiB of independent blocks to B.
Predict before revealing: which forced placement gives Request 1076 the earliest observed first token?

The Mooncake traces

Did contention change goodput?

PAIRED TRACE REPLAY Qualified A100 subset · Separate denominators (never pooled across traces)

Every panel below preserves separate denominators for Conversation and Tool/agent traces. Filter to inspect one workload or compare both side by side.

Trace view:

Load sweep and the qualified subset

PAIRED TRACE REPLAY Primary 3 windows (180 s at 1x)

Across all 24 paired primary windows (3 spaced windows × 4 loads × 2 traces), Nominal and Aware ledgers are 100% identical (0.000 req/s difference everywhere). At 1x speed, only 0/274 conversation and 1/845 tool/agent nominal arrivals saw an independent competing copy.

A100 8,192-Token Qualification Scope Limit (Unlimited-History Audit)

Keeping only requests with input + output ≤ 8,192 retains 53.70% of conversation requests but only 14.95% of conversation's potentially reusable prefix tokens (compared to 61.78% for tool/agent). Excluded long contexts are neither donors nor consumers.

Held-out replication and the contention funnel

PAIRED TRACE REPLAY 26 held-out blocks (1,560 s at 1x)
History protocol:
Reset and continuous evaluate the same cohort IDs under different state histories; never pooled together.

All 104 Paired Block Deltas (Aware minus Nominal)

Zero shadow winner flips on nominal views is distinct from paired policy execution; here every single one of the 104 paired blocks also tied at exactly 0.000 req/s (0 wins, 104 ties, 0 losses).

Goodput, forecast error and scoring cost

PAIRED TRACE REPLAY Continuous 2x2x2 policy matrix · 26 cohorts (1,560 s)

Twelve single-factor paired contrasts (high minus low, holding the other two factors fixed). None cleared the registered +0.1 req/s practical threshold:

  • Scheduler-aware compute delivered the largest gains (+0.049 Conversation / +0.046 req/s Tool/agent at longest).
  • Budgeted menu netted +1 / +8 on-time requests (+0.00064 / +0.00513 req/s) and saved 2.375 / 6.188 GiB of cohort receipts (only 3/2,920 and 1/8,238 strict interior cuts).

12 Single-Factor Paired Goodput Contrasts vs. +0.1 req/s Threshold

Inspect all 12 single-factor paired contrasts (goodput deltas, gained/lost counts, receipt GiB)

TTFT Forecast Calibration (Serial vs. Scheduler-Aware)

SAME EXECUTED REFERENCE ACTION

Evaluated on the same executed serial/longest/nominal action without changing replay state. Tool/agent excludes 35 arrivals with no first token.

Laptop Scoring Cost (Fixed Snapshot, Microseconds)

WALL-CLOCK CPU BENCHMARKNot simulated time

Show full laptop scoring candidate & phase counts (all 12 policies × visible traces)

Placement regret across six reset arrivals

TRACE COUNTERFACTUAL 2 local placements each · Nominal continuation

Six pre-registered reset arrivals forced to each legal local worker, then continued under nominal routing. Lowering the focal arrival's TTFT can still reduce net on-time completions among other measured arrivals (see Tool/agent block 21: 86.881 ms faster focal TTFT cost 10 net other on-time responses).

The A100 grids

When does a partial copy beat every endpoint?

DESIGNED A100 GRID Controlled overlap regimes · Not trace prevalence

These controlled A100 workloads test where partial KV copies can beat all three endpoints (local reuse A/12, cold recompute B/0, and full copy B/12) and whether an independent wider-menu router captures them.

54-Cell Source-Queue Matrix: Globally Fastest Placement

DESIGNED A100 GRID 54 cells · 756 forced and 108 paired runs

Click any cell to inspect its 14-branch forced cut curve and paired policy audit. Dark green cells are the 7 practical global interior wins (≥ 20 ms faster than every endpoint).

A setup level:
A/12 Local reuse on A B/0 Cold recompute on B B/12 Full 12-block copy B/2, B/3, B/5, B/7 Practical interior win (≥ 20 ms)

14-Branch Forced Cut Curve (B/0..B/12 vs. A/12)

Horizontal purple line = A/12 local reuse. Endpoints B/0 (square) and B/12 (diamond) are marked explicitly against the interior minimum and the 1,000 ms TTFT target.

7 Captured Crossover Trade-offs & Slice Summary

INDEPENDENT PAIRED POLICIES Budgeted vs. longest (scheduler-aware / aware)

Focal TTFT Saved vs. Drain Traffic Saved (7 Changed Cells)

Replacing A/12 spends 128 MiB; replacing B/0 ties drain bytes; replacing B/12 saves 192 to 448 MiB through drain. All 7 faster probes still exceed 1,000 ms TTFT.

Primary Elevated-some Slice vs. Full 54-Cell Grid

Both registered benefit paths and all full-grid safety guards pass (0 rejections, 0 fallbacks, max neighbor p95 regression +2.111 ms ≤ 5 ms limit). Yet on-time goodput stays identical: 78/90 (1.733 req/s) on the primary slice and 243/270 (1.800 req/s) across all 54 cells.

Show all 9 level × overlap slice rows

Designed 288-Run A100 Policy Atlas

DESIGNED A100 GRID 288 runs · Separate denominator: 9 offered / 3 s window

Four link rates (0.5, 1, 2, 12.5 GiB/s) × three traffic regimes (no-injection, independent, joinable) × three family ordering seeds (11, 23, 47) × eight policies. Across 2,592 measured decisions, there were 0 strict interior cuts, 0 fallbacks, and 522 TTFT misses (all responses completed and passed TPOT).

Factor contrast:

Model & audit

From arrival to the event ledger

CONCEPTUAL ARCHITECTURE Not an audited trace run · Strict causal boundary

The simulator measures replay time on a deterministic event clock. The laptop scoring benchmark separately measures wall-clock CPU time. Neither routing nor estimation ever sees recorded output lengths or future arrivals.

One-Command Verification

LAPTOP REPRODUCTION COMMANDS No GPU, external Python packages, or network access after crate fetch

1. Primary reproduction & checks

cargo run --release --locked -- reproduce --config experiments/paper.toml
python3 experiments/scripts/check_comparison.py
python3 experiments/scripts/check_burst.py
python3 experiments/scripts/check_boundary.py

2. Rebuild this interactive demo (isolated, never touches target/paper)

python3 demo/build.py target/demo

Writes a standalone copy to target/demo/index.html from freshly reconciled audit JSONs without modifying tracked paper outputs.

3. Held-out replication, trace matrix, designed atlas, regret, scoring & overlap grids (atomic writes)

mkdir -p target/audit
cargo run --release --locked -- run-followup --config experiments/followup-v1.toml > target/audit/replication.pending.json && mv -f target/audit/replication.pending.json target/audit/replication.json
cargo run --release --locked -- run-trace-matrix --config experiments/followup-v1.toml > target/audit/trace-matrix.pending.json && mv -f target/audit/trace-matrix.pending.json target/audit/trace-matrix.json
cargo run --release --locked -- run-designed --config experiments/followup-v1.toml > target/audit/designed.pending.json && mv -f target/audit/designed.pending.json target/audit/designed.json
cargo run --release --locked -- run-placement-regret --config experiments/followup-v1.toml > target/audit/placement-regret.pending.json && mv -f target/audit/placement-regret.pending.json target/audit/placement-regret.json
cargo run --release --locked -- bench-scoring --config experiments/followup-v1.toml > target/audit/scoring.pending.json && mv -f target/audit/scoring.pending.json target/audit/scoring.json
cargo run --release --locked --example check_overlap -- --forced > target/audit/overlap-forced.pending.json && mv -f target/audit/overlap-forced.pending.json target/audit/overlap-forced.json
cargo run --release --locked --example check_overlap -- --source-forced > target/audit/overlap-source-forced.pending.json && mv -f target/audit/overlap-source-forced.pending.json target/audit/overlap-source-forced.json
cargo run --release --locked --example check_overlap -- --source-paired > target/audit/overlap-source-paired.pending.json && mv -f target/audit/overlap-source-paired.pending.json target/audit/overlap-source-paired.json

4. Live Q&A: inspect another qualified request ID (e.g. 1061, atomic write)

mkdir -p target/audit
target/release/kv-crossover inspect --config experiments/paper.toml \
  --trace toolagent --window-start-ms 120000 --load 1 --policy nominal \
  --request-id 1061 > target/audit/qa-1061.pending.json \
  && mv -f target/audit/qa-1061.pending.json target/audit/qa-1061.json

Offline Exports & Scope Limits

AUDIT EXPORTS Client-side Blob downloads · Works standalone offline

Download reconciled CSV tables and static comparison SVGs directly from the verified payload embedded inside this HTML file (no companion files or server required).

Honest Scope & Limitations
  • A100 8,192-token subset: Retains 53.70% of conversation requests and only 14.95% of conversation's unlimited-history reusable prefix tokens (77.63% / 61.78% for tool/agent). Does not predict contention among omitted long prompts.
  • Two symmetric single-A100 workers: Fixed 48 GiB KV budget each, 128-token prefill chunks, batch-8 rotating decode, one equal-sharing bidirectional link.
  • Coarse source timestamps: Released Mooncake traces have 1,180 distinct ticks spaced ~3 s apart; tied arrivals reflect trace quantization, not sub-millisecond production co-arrival.
  • No production telemetry: Wall-clock laptop scoring cost (microseconds on i5-12500H) is kept strictly separate from simulated event-clock service times.

Pinned SHA-256 Digest Manifest

DETERMINISTIC PROVENANCE Input, source and verified artifact SHA-256 digests
Source & input fingerprint (pinned inputs, Rust sources, demo build & embedded fonts):
9ddcc7b7c39022123348fcefc28af61f71838772f20b13b996e4d4d0bfaa397c
Verified artifact data digest (canonical extracted evidence payload & reconciled audit files):
2f45438502fa9d48c12aea6fb861ca1f9f2fbaeecbb6c41c5525bf03174ea666