Optimization is a diagnosis problem. Quantization reduces compute and memory work but spends a quality budget. Speculation uses spare decode compute to improve inter-token latency (ITL) and tokens per second (TPS). Caching avoids repeated prefill and improves time to first token (TTFT). Parallelism makes models fit or changes latency and throughput across devices. Disaggregation separates compute-bound prefill from memory-bound decode at sufficient scale. Measure the bottleneck, apply the narrowest suitable lever, and retest the whole system because techniques can reinforce or obstruct one another.
Why it matters
Useful constraints create specialization: fixed formats, repeated prefixes, known topology, or separate worker roles let the runtime avoid general work. Real traffic varies, so these constraints must be monitored and adjusted rather than configured once.
Traffic volume changes what is economical. Cache-aware routing, many-way model parallelism, and independent prefill-decode pools need enough concurrent work to keep additional hardware and coordination useful.
Levers share resources. A smaller key-value cache can ease transfer and increase cache residency; speculation competes with large batches for compute; cross-node parallelism can replace a memory problem with a communication problem. Design and test the complete configuration rather than enabling features independently.
Most techniques preserve model semantics, but post-training quantization can change output quality. Performance validation therefore needs a paired quality baseline, especially when lowering precision in recurrently reused attention state.
Mental model
Think in four budgets: compute, memory capacity and bandwidth, communication, and acceptable quality change. Each technique moves pressure between budgets. Quantization stores and moves fewer bits while risking numerical error; speculation spends compute to reduce decode iterations; caching spends memory to avoid prefill; parallelism spends communication to gain capacity or concurrency; disaggregation spends hardware and transfer bandwidth to specialize phases. A good configuration removes the dominant constraint without making the receiving budget dominant.
Choose a lever from the bottleneck
A measured bottleneck branches toward Quantization for compute or memory pressure, Speculation for idle decode compute, Caching for repeated prefixes, Parallelism for device capacity or latency, and Disaggregation for high-volume prefill-decode interference.
Measured bottleneckProfile phase, resource, traffic, and quality budget
QuantizationReduce value width and memory footprint
SpeculationSpend idle compute to accept multiple tokens
CachingReuse prior key-value work
ParallelismShard model work across devices
DisaggregationSeparate prefill and decode worker pools
Measured bottleneck → Quantization: Compute or memory pressure
Measured bottleneck → Parallelism: Capacity or per-user latency
Measured bottleneck → Disaggregation: Phase interference at scale
Suppose measurement shows compute-bound prefill, bandwidth-bound decode, and too little key-value cache headroom after weights and buffers. A precision change can reduce matrix cost, bytes moved, and cache footprint, but do not lower the whole model at once. First convert less-sensitive linear weights and compare perplexity, public benchmarks, and product evaluations with the original model; then add activations; consider key-value state only when long context or disaggregation is actually limited by cache capacity or transfer. Keep input-output layers, outlier-heavy regions, and attention math at higher precision when needed so recurrent errors do not compound token by token. At each stage measure time to first token, tokens per second, memory, throughput, and quality. The goal is not the fewest bits, but the lowest latency and cost while the quality difference remains within repeated-run noise.
For an interactive coding workload, put the stable system prompt, tool definitions, and repository context before the current edit and new question so prefix caching can skip substantial prefill. Route follow-up requests for the same user or codebase toward a replica with the hot cache, but cap affinity so one replica does not overload. During low-batch decode, repetitive code may yield long accepted n-gram drafts and fewer target-model forward passes. As concurrency and batch consume spare compute, shorten or disable speculation while prefix reuse still saves prefill. Track skipped input tokens, cache hits, draft acceptance, accepted tokens per iteration, and net inter-token latency separately; the techniques act on different phases and should not share one on-off switch or be judged only by total throughput.
When a model exceeds one GPU, include weights, runtime workspace, activations, target batch, and longest-context cache headroom before choosing a parallel label. Tensor parallelism (TP) splits tensors within every layer so GPUs share weight reads and matrix multiplication; fast intra-node links can lower per-user latency, but each layer synchronizes and scaling reverses when communication exceeds saved work. Expert parallelism (EP) places intact experts on devices and routes tokens without a TP-style all-reduce after every layer, so mixture of experts (MoE) throughput can scale farther, including across nodes. Pipeline parallelism (PP) assigns intact layer stages across nodes, introducing sequential bubbles; it is mainly a capacity solution when a dense model cannot otherwise fit. Prove each added device with parallel efficiency and interconnect traces. If the model fits comfortably in one node, another replica is often simpler and serves more independent requests.
Disaggregation becomes plausible when a large, heavily used model receives enough long uncached inputs for compute-bound prefill to disturb memory-bound decode. Send each request first to a decode-side cache check: handle full hits or short prefill locally, and send only long misses to the prefill pool. Prefill workers can use compute-oriented GPU count, TP, and batch settings; after producing the first token and key-value blocks, they transfer state over the chosen interconnect to decode workers tuned for bandwidth, cache capacity, and subsequent tokens. The pool ratio is an operating variable, not fixed one-to-one. A growing prefill queue asks for more front-end capacity; high decode occupancy or eviction asks for memory; slow transfer may require cache quantization, nearer topology, or a higher local-prefill threshold; light traffic may warrant collapsing the split to avoid idle GPUs.
Roll out one lever behind a controlled traffic slice and retain the unoptimized path plus fast rollback. Segment results by input and output length, cache hit or miss, batch, concurrency, hardware, and topology; a mean can hide long-context regressions or mistake a low-load gain for peak capacity. Gates should cover percentile latency, system throughput, GPU memory, unit cost, errors, and quality. Quantization also needs product evaluation, speculation needs acceptance across temperatures, and caching needs tokens skipped rather than hit rate alone. Observe a full peak cycle before increasing traffic. Keep triggers that disable the technique when its premise disappears: high batch stops speculation, a quality breach restores original precision, and an overloaded hot replica reduces cache affinity.
Treat the prefill-to-decode worker ratio as a workload-dependent setting. Long inputs and prefill-heavy traffic need more prefill capacity, while decode-heavy traffic needs more decode capacity. Monitor the prefill queue and decode key-value cache, and change the ratio at runtime as traffic changes instead of fixing one prefill engine to one decode engine. For short inputs or cache hits, conditional disaggregation can keep prefill on the decode engine. At lower traffic, horizontal replicas can be more efficient than disaggregation, whose extra GPUs, queue, and cache transfer add cost.
Document the causal chain for every lever: the measured phase and resource bottleneck, enabling traffic condition, budget receiving pressure, expected user or cost benefit, new failure mode, quality gate, disable threshold, and rollback. For example, 'low-batch decode has spare compute, so enable short-draft speculation and disable it when acceptance or net ITL falls below the gate' is more operable than 'enable EAGLE.' This record turns a configuration into an observable policy and makes the revalidation scope visible when another optimization changes the same compute, memory, or communication budget.
Core ideas
Quantization
Lower precision can accelerate prefill on faster low-precision compute and decode by reducing bytes moved. Start with less-sensitive weights and activations, consider key-value cache carefully, and protect attention operations and sensitive layers unless evaluation proves safety.
Format and granularity
Floating-point exponent range helps preserve outliers. Finer-grained scaling better follows local distributions but stores and applies more scale factors. January 2026 edition snapshot: 8-bit floating-point (FP8) class formats were the flexible production default; Blackwell-specific microscaling and 4-bit floating-point (FP4) paths required current hardware and software validation.
Speculation
A speculator proposes draft tokens, the target validates them in parallel, and an accepted prefix plus one target token advances decode. It improves TPS and ITL, not TTFT. Benefit depends on draft cost, proposed length, acceptance rate, temperature, domain, and spare compute at the active batch.
Speculation methods
Draft-target pairs the model with a much smaller draft model and is easy to start but adds the most model overhead. Medusa adds draft heads to the target. EAGLE trains a small hidden-state-conditioned draft model for broader use. N-gram speculation reuses input sequences and excels for repetitive code, while Lookahead Decoding builds candidates during inference at extra compute cost.
Key-value reuse
Every engine retains key-value state within a request; prefix caching reuses it across requests but skips prefill only from the beginning of an identical token sequence until the first difference. Put stable context first, novel content later, and route related requests toward the replica that owns their hot cache. Non-prefix reuse requires positional correction and selective recomputation, so it remains a specialized path.
Topology-aware parallelism
Tensor parallelism (TP) splits work within layers and favors low latency on fast intra-node links. Expert parallelism (EP) keeps experts intact and can improve mixture of experts (MoE) throughput across more devices. Pipeline parallelism (PP) moves stages between nodes but adds sequential bubbles.
Disaggregation
Separate prefill workers compute the first token and key-value state, transfer that state, and let decode workers generate subsequent tokens. Conditional routing keeps cache hits or short inputs local so transfer is paid only when specialization is useful. January 2026 edition snapshot: the book suggested considering it around 100 million to 1 billion tokens per day, models of roughly 100 billion parameters or more, and prefill-heavy traffic with long inputs.
How it works
Profile production-shaped traffic by prefill, decode, cache behavior, batch, and topology. Preserve latency, throughput, cost, and quality baselines before enabling a technique.
For quantization, choose component and format separately, calibrate post-training conversion, then compare perplexity, public task scores, and product-specific evaluation against original precision. Reduce scope or raise precision when the delta exceeds noise.
For speculation, tune draft method and length against acceptance and cost. Disable or shorten speculation when batch saturation removes spare compute; favor n-gram reuse for repetitive code-like output and trained draft heads for broader workloads when available.
For caching, canonicalize stable prefixes, allocate device memory deliberately, place colder blocks in host or storage tiers, and route on both load and prefix affinity. Test long contexts that can make attention state the main memory consumer.
For parallelism, size weights plus runtime and cache headroom, then map synchronization to links. Use TP within a fast node by default; consider EP for high-throughput MoE serving; cross nodes with lower-communication strategies only when necessary.
For disaggregation, route through a decode-side cache check, send long uncached work to prefill workers, transfer key-value blocks, and scale prefill and decode pools independently. Watch both the prefill queue and decode cache capacity.
Cache, parallelism, and disaggregation flow
A request flows from Cache-aware router to Decode cache check; a miss passes to Parallel prefill workers, the KV transfer crosses to Parallel decode workers, and generated tokens return through the response stream.
Cache-aware routerPrefers a replica with matching prefix state
Decode cache checkHandles a hit or short prefill locally
Parallel prefill workersCompute first token and key-value state
KV transferMoves cache over the selected interconnect
Parallel decode workersGenerate remaining tokens
Response streamReturns accepted output tokens
Cache-aware router → Decode cache check: Route by load and prefix
Decode cache check → Parallel prefill workers: Miss or long uncached input
Parallel prefill workers → KV transfer: First token plus cache
KV transfer → Parallel decode workers: Cross worker boundary
Compare repeated runs with the original precision and product-specific tasks.
Draft acceptance
accepted tokens per iteration
Interpret with draft generation cost, sequence length, temperature, and batch.
Prefix cache effectiveness
hit rate and tokens skipped
Hit rate alone hides whether matches save two tokens or thousands.
Cache residency by tier
GB and eviction rate
Track hot device state, offloaded state, transfer latency, and churn.
Parallel efficiency
speedup per added GPU
Separate compute gain from synchronization and interconnect cost.
Disaggregated balance
prefill queue and decode occupancy
A growing queue or exhausted decode cache signals the worker ratio is wrong.
Trade-offs
Speed versus quality risk
Narrower formats move and compute less data, while sensitive components and recurrent attention state can compound numerical error. Selective higher precision is often better than an all-or-nothing policy.
Per-user speed versus throughput
Speculation can reduce decode iterations at low batch, but its verification work consumes compute that larger batches would use for more requests.
Cache hit versus load balance
Affinity routing preserves hot prefixes but can overload a popular replica. Global lower-tier storage improves durability and reach, yet remains slower than a local device hit.
Latency versus communication
More devices add capacity and may reduce per-request work, but every synchronization or token route crosses a slower boundary. Extra nodes may be more efficient as replicas.
Specialization versus complexity
Independent phase tuning and scaling can reduce interference at high volume, while queues, transfers, extra replicas, and cache pressure make small deployments slower or more expensive.
Engineering checklist
Name the saturated phase and resource before choosing a lever; do not optimize from a feature checklist.