Unit 11 of 11 · about 5 hours · measure

Prefix reuse, memory pressure and fairness measured against outcomes

A cache-hit counter measures avoided work, not user success. Retaining prefixes or favoring hot requests can improve that counter while reducing admission headroom or delaying other tenants.

You'll be able to

  • Compare reuse off/on under fixed arrivals, token streams, memory budgets and output contracts.
  • Explain TTFT and goodput changes using skipped prefill, lookup, queueing, pressure and eviction traces.
  • Retain a benefit region and a high-hit-rate region with no better outcome, including per-tenant fairness evidence.

Covers

Prefix reuse TTFT and goodput measurementEviction, fairness and memory-pressure measurementHit rate versus application outcome
1

Read

In this order, only the parts listed

0 of 2 done

  1. RadixAttention: scheduling, outcomes and ablationsSGLang: Efficient Execution of Structured Language Model Programs

    arXiv:2312.07104v2, Section 3, Cache-aware scheduling and starvation caveat; Sections 6.1 to 6.3, metrics, short/long multi-turn chat and Figure 8 ablations

    Read the cache experiments, not constrained decoding or API speculation. The offline hit-rate theorem is not an online fairness or goodput guarantee; the paper's older baselines are not your current-engine comparison.

  2. Hands-On LLM Serving and Optimization: cold versus retained prefixesHands-On LLM Serving and Optimization - Prefix Caching and Advanced KV Caching

    Chapter 6, Prefix Caching, Use Cases and Best Practices, printed pp. 226 to 228; Chapter 7, Hands-on LMCache, Run benchmarks and Performance analysis, printed pp. 264 to 266

    Use the cold/warm and pressure comparisons as experiment designs. Do not adopt the Chapter 6 claim of almost no drawback as a guarantee, or change prompt order merely to raise hits without rechecking quality.

2

Focus on

  • Define hit rate as reused prompt tokens divided by eligible prompt tokens and state the denominator. Separate active shared pages from retained evictable pages, and keep cold and warmed trials distinct.
  • Use the earlier validated load generator. Define client TTFT as arrival/submission to first nonempty generated output, including queueing; define goodput as quality-accepted requests meeting the declared latency targets per measurement time.
  • Reused prefix KV skips its repeated forward computation. New suffix queries and decode steps still attend to valid prefix state, so a token-hit fraction is not a proportional latency reduction.
  • Keep cache policy and scheduler order separate in ablations. Record per-request and per-tenant waiting, admission, rejection, eviction and preemption alongside latency tails and memory; longest-prefix-first can starve cold traffic.
Common mistakes · 3
  • Using a high hit rate as the optimization target. Long decode, lookup cost or a hot replica's queue can dominate the saved prefill.
  • Comparing warm reuse with a cold baseline while also changing arrival rate or output length. Name the cache-state treatment and change only the intended mechanism.
  • Hiding cold-tenant rejection or cancellation in aggregate throughput. Count unsuccessful work and report per-tenant outcomes, not only completed hot requests.
3

Try it yourself

Closed-book, before checking anything

Replay the same servelab manifest with reuse off/on, first using a labeled deterministic CPU model with explicit prefill, decode, lookup and transfer costs. Vary reuse and output length separately, then add pressure and two-tenant skew; retain one benefit region and one high-hit region where lookup, queueing or memory policy prevents better goodput. On your GPU, repeat one bounded pair using a fitting model and the earlier endpoint harness; otherwise retain the simulation and label its timing assumptions. Keep arrivals, prompts, output limits, sampling, quality/SLO rules and pool budget fixed within each pair, with raw request and page traces.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why can 90 percent prompt-token reuse fail to give a tenfold TTFT improvement?Answer

    TTFT also includes queueing, tokenization, lookup, remaining attention, sampling and streaming. The remaining suffix still attends to the prefix, and cost need not scale linearly with newly computed tokens.

  2. 2.Can retained prefix data reduce capacity without changing physical pool size?Answer

    Yes, if the policy pins it or reserves too much space for retention. Immediately evictable pages need not reduce hard admission capacity, but reclaiming them still has policy and management costs.

  3. 3.What evidence separates reuse benefit from cache-aware scheduling benefit?Answer

    Hold scheduler order fixed while toggling reuse, then hold reuse fixed while changing order. Preserve the same arrivals and outputs and compare raw waiting and execution traces.

  4. 4.When is a high-hit negative result valid evidence?Answer

    When outputs and workload controls pass, the hit denominator is clear, and traces identify the overhead or remaining bottleneck that prevents better latency or goodput. Simulation must be labeled, not presented as device measurement.

You're done when

You can explain a controlled benefit and a high-hit non-improvement from request/page traces, reconcile memory with the allocator ledger and report cold-tenant outcomes without overstating simulated evidence.

Only when you can do this without notes.

Leads to

Notes

Resources · 2 for this unit, 12 more in the section

Also in this section