← Inference From First Principles

GPU Utilization and Capacity Planning

What the GPU's utilisation counter says against what the work used, where memory limits turn out to be performance cliffs, and a capacity model built from load sweeps with confidence bands, repeated runs and a refusal to extrapolate.

The driver reported 98% GPU utilisation and 93% memory utilisation during a batch-64 decode. Yet the useful operations counted for that decode amounted to 1.4% of the measured matrix-multiplication ceiling, and the counted bytes amounted to 6.8% of the measured copy-bandwidth ceiling. A separate dense matrix-multiply loop reported 99% GPU utilisation while achieving 89.9% of the compute ceiling. These are not contradictory observations: the driver asks whether work was active during its sampling windows, while the roofline asks how much counted useful work was accomplished per second. Here similar near-100% readings accompanied very different execution efficiencies. The byte accounting omits intermediate cache copies, so the percentages are proxies based on a deliberately incomplete operation/traffic model, not hardware-counter measurements of all instructions and bytes.

Memory and load testing exposed different kinds of limits. A 341-sequence batch at context 256 had a PyTorch peak allocation of 12.27 GiB, exceeding the approximately 9.81 GiB reported free on a nominal 12 GiB GPU, but it completed without a CUDA out-of-memory exception and took 10.65 seconds for one decode step. The measured step-time cliff occurred earlier: at context 256, doubling the batch from 128 to 256 raised a step from 0.295 to 8.817 seconds while the reported peak allocation at batch 256 was 9.18 GiB. The measurements establish a severe performance cliff and successful allocation under this Windows/driver configuration; they do not directly establish that a particular amount of memory was paged to host RAM, because migration was not traced.

A separate load sweep initially appeared to certify 1.8 requests/s for at least 95% of requests satisfying a 2.0-second TTFT and 60-ms TPOT limit. Two new arrival-seed runs at that offered load achieved SLO shares of 0.777 and 0.938. At 2.5 requests/s, the original share was 0.877 and the new-seed shares were 0 and 0.277. Of 24 values compared with the original single-run bands, only two from new-arrival runs fell inside. These are few, finite traces, not an estimate of all future traffic, but they demonstrate why 130 correlated requests from one run cannot establish a reliable service capacity.

The chapter’s deliverable is a bounded, evidence-labelled capacity planning method, not one magic utilisation threshold. It derives per-token cache allocation, measures compute and memory ceilings, builds load-point estimates with within-run intervals, rejects queries outside the observed offered-load range, and tests both interpolation and repeatability. The important negative finding is part of the result: even a model that refuses extrapolation can be overconfident within its observed range if its uncertainty model treats queue-correlated observations as independent. The revised planning rules therefore distinguish single-run provisional thresholds, repeat-informed conservative planning bounds, and capacity qualified for a specified future arrival process. Only the first two are demonstrated here.

The experiment uses locally executed Qwen3-0.6B and the Latency, Throughput and Time to First Token single-process, statically batched server. One Windows desktop GPU is shared with other workloads; the traffic is synthetic; timestamps do not cross a network. No provider was called, no DCGM profiling stream was collected, and the multi-server plan is arithmetic rather than a measured deployment. These restrictions apply to every capacity claim below.

The question

A capacity number is meaningful only relative to a workload, an arrival process, a hardware/software configuration, and a service-level objective (SLO). Here the SLO is a joint per-request requirement: TTFT no greater than two seconds and TPOT no greater than 60 milliseconds, attained by at least 95% of requests. The chapter asks four practical questions. Which hardware counters reveal active work, and which reveal useful resource consumption? How much of the nominal device memory is usable before latency becomes unacceptable? How well do a small number of load points predict other loads and other arrival draws? And which uncertainties must remain unresolved before multiplying the capacity of one server by a server count? A useful answer can be a bracket or a refusal, rather than an unjustified point estimate.

Where this sits

Key-Value Caching supplies the symbolic KV-cache size; Memory Bandwidth and Compute Bottlenecks develops memory-bandwidth and operational-intensity reasoning. This chapter checks both against an actual Qwen3 configuration, a measured copy ceiling, and a small profiler trace. Latency, Throughput and Time to First Token provides the shared in-process serving loop and the initial Poisson load sweeps, including the CPU-affinity problem that affected decode latency. Cost per Million Tokens models financial cost at varying busy fractions, while the current chapter asks where a particular SLO stops being met. Correctness, Determinism and Reproducibility evaluates correctness: an economically attractive or fast system is still not useful when it produces wrong answers. These connections should not be mistaken for measurements on a common production serving engine.

Where the starter was wrong

The starter’s CapacityModel fits a line fixed by the ratio of saturation throughput to the maximum measured load. On its four toy points—offered loads 1, 2, 4, 8 and throughputs 10, 18, 30, 32—the formula predicts 8 at load 2 and 16 at load 4, compared with measured values of 18 and 30. Its headroom is an algebraic function of load, not an empirically chosen safety margin; it cannot express the queueing knee, any TTFT or TPOT threshold, run-to-run variability, or the difference between offered and completed requests. The starter’s refusal above its largest measured load is useful, but insufficient: an implementation can decline out-of-range queries and still provide badly calibrated intervals inside the range. The starter remains unchanged; the new collector, capacity model and validation exercises supply the missing distinctions.

The setup

The machine. The experiments used one NVIDIA RTX 2060 12 GB, driver 591.44, Windows 11, and an Intel i9-12900KF with the process pinned to logical CPUs 0–15 (the performance-core threads); the desktop and other applications could also use the GPU. The model was Qwen3-0.6B, revision c1899de289a04d12100db370d81485cdf75e47ca, using float16 weights and a dynamic KV cache. Its inspected configuration had 596,049,920 parameters, 28 layers, 16 query heads, eight KV heads and head dimension 128 with tied embeddings. Consequently, the logical KV cache per sequence position is 28 layers × key/value 2 × eight KV heads × 128 dimensions × two bytes = 114,688 bytes, before tensor alignment, temporary allocations, key/value expansion and cache copying. After loading the weights, torch.cuda.mem_get_info() reported approximately 9.81 GiB free; that observation is not a durable memory budget for other runs.

Measured operational ceilings. The roofline was calibrated with a CUDA device-to-device copy of 512 MiB, counting both the source read and destination write, and half-precision dense matrix multiplication. The best of 25 copies gave 283.8 GB/s (median 277.8 GB/s); the largest observed FP16 matrix result was 31.5 TFLOP/s at dimension 4,096 (29.3 TFLOP/s at 2,048 and 8,192). The resulting ridge point, 31.5 TFLOP/s divided by 283.8 GB/s, is approximately 111 FLOP/byte. A separate tiny-kernel loop measured about 5.8 microseconds of host issuance per operation. These are achieved microbenchmark ceilings for this setup, not architecture peaks, and the copy and matrix-multiply kernels have different access patterns from attention and cache maintenance. All subsequent roofline percentages inherit those choices and the incompleteness of the byte-count model.

Workloads and SLO selection. The load records comprise Latency, Throughput and Time to First Token’s batch-1 (0.4–2.5 requests/s) and batch-4 (0.4–3.6 requests/s) open-loop Poisson sweeps, with 130 requests retained after ten warm-up exclusions at each point; additional batch-4 runs use 48–96 output tokens rather than 16–48, plus a few same-seed and different-seed repetitions. Prompts are synthetic and approximately 60–450 tokens. The reference SLO requires TTFT ≤ 2.0 seconds and TPOT ≤ 0.060 seconds for the same request, for a target attainment share of 95%. The 2.0-second limit was selected after the Latency, Throughput and Time to First Token curves were examined; it is an illustrative, exploratory target, not an independently pre-registered acceptance criterion. A separate 0.5-second TTFT SLO provides sensitivity analysis. The book must not relabel either outcome as prospectively qualified production capacity.

What the counter says

The nvidia-smi help text describes utilization.gpu as the fraction of a recent sampling period for which one or more kernels were executing, and utilization.memory as the fraction for which global-device-memory access was occurring. These are activity-time measurements: neither is equivalent to SM occupancy, fraction of peak arithmetic, memory-throughput saturation, or available serving capacity. The sampling window and implementation are hardware/driver-dependent; the local tool collected coarse GPU and memory activity, not a full execution trace. NVIDIA DCGM exposes finer activity, occupancy and bandwidth-related indicators on supported hardware, but those profiling fields were not available through the installed setup. We therefore use driver activity, counted FLOPs/bytes divided by measured time, and queue/SLO behaviour as distinct observations, not interchangeable definitions of utilisation.

For the six scenarios, a background nvidia-smi sampler observed the card at roughly 100-ms intervals during timed periods; the decode workloads, prefill and matrix multiplications were warmed before measurement. Useful-work rates are derived from the model’s counted operations—approximately two operations per parameter per token plus attention—and counted traffic—one read of FP16 weights and one read of logical KV state. The count omits DynamicCache concatenation, key/value-head expansion, and other intermediate traffic; consequently the displayed bandwidth is a lower estimate of actual byte movement, while the derived operational intensity and roofline share are model-dependent approximations. Sampled driver activity and rate-based estimates should not be interpreted as an independent hardware-counter verification of each other.

Situation Driver GPU / memory activity Tokens/s (if applicable) Counted arithmetic (TFLOP/s; fraction of measured ceiling) Counted bandwidth (GB/s; fraction of measured ceiling) Fraction of calculated roofline bound
idle, desktop active 26% / 6% — — — —
decode, batch 1 48% / 23% 31 0.04 (0.1%) 39 (13.8%) 13.8%
decode, batch 8 91% / 74% 222 0.29 (0.9%) 44 (15.4%) 15.4%
decode, batch 64 98% / 93% 361 0.46 (1.4%) 19 (6.8%) 6.8%
prefill, eight 512-token prompts 99% / 78% 7,631 9.55 (30.3%) 3 (1.1%) 30.3%
dense matrix-multiply loop 99% / 53% — 28.3 (89.9%) 21 (7.3%) 89.9%

The arithmetic and bandwidth columns are calculated from the chapter’s useful-work accounting, not direct SM/DRAM throughput counters. The copy and GEMM microbenchmarks establish denominators, not architectural maxima. Batch-64 here was measured in this chapter’s counter experiment and must not be conflated with Cost per Million Tokens’s distinct 326-token/s phase measurement.

Interpreting the numbers. Even when no chapter workload was running, desktop activity produced a 26% GPU reading. At batch 1 the modeled operational intensity was close to one FLOP per byte, far below the approximately 111-FLOP/byte ridge; it falls on the memory-sloped side of this simplified roofline. Yet the measured step was approximately 31.8 ms and Latency, Throughput and Time to First Token independently found a strong CPU-core/launch-rate effect, so it would be misleading to diagnose the observed wall time as caused solely by DRAM bandwidth. At batch 8 driver activity rose to 91% and the estimated roofline share was about 15%. At batch 64 the counters reached 98% GPU and 93% memory activity but the fraction of counted useful work relative to the modeled roofline fell to 6.8%. High sampled activity is therefore not evidence that more arrivals would meet the SLO, nor proof that bandwidth is already fully exploited.

The six-step profiler sample supplies a plausible implementation-level explanation, not a causal attribution of every wasted cycle. In the batch-64 trace, the reported self device time was dominated by copies (32%), elementwise multiplication (17%), batched matrix multiplication (13%) and concatenation (10%); the dense matrix-multiply category represented only about 3%. DynamicCache grows tensors, and the library performs head expansion and other intermediate work omitted from the analytical byte model. Profiling itself perturbs the runtime, and these categories may overlap conceptually with higher-level operations. The observation is nonetheless actionable: before deciding that the GPU has no capacity left, measure cache traffic and attention kernels with a profiler, then re-run the serving SLO experiment after changing the implementation. A faster kernel is a hypothesis about useful capacity until the queue and end-to-end metrics improve.

The utilisation counter is not broken; it answers a narrower question. Near-100% GPU activity can coexist with poor useful throughput, and an idle/desktop baseline is not zero. Reading a roofline requires both an explicit definition of useful operations and a credible byte count; this chapter’s count is intentionally partial. For capacity planning, retain at least four categories of evidence: (1) coarse driver activity, (2) attained FLOPs and memory traffic from appropriately scoped profiling or calibrated models, (3) memory headroom and step-time growth, and (4) per-request TTFT, TPOT and joint SLO attainment under scheduled arrivals. The fourth—not a target GPU-utilisation percentage—defines the certified serving load. Roofline classification and queueing diagnosis are complementary; neither substitutes for the other.

Memory is a cliff, not a wall

Memory is a cliff, not a wall

The cache formula provides an auditable logical-state estimate, not the allocator peak. For a context of L positions per sequence, the model needs L × 114,688 bytes of float16 KV state: 29,360,128 bytes at 256 tokens (28 MiB), 117,440,512 bytes at 1,024 (112 MiB), 469,762,048 bytes at 4,096 (448 MiB) and 1,879,048,192 bytes at 16,384 (1.75 GiB). Dividing the approximately 9.81 GiB free after model loading by those ideal allocations predicts maximum batches of 358, 89, 22 and 5, respectively. These are upper bounds from cache-state arithmetic, assuming the free-memory snapshot remains available and omitting temporary matrices, duplicated KV state, allocator fragmentation and any reserve required to maintain latency. They are not admissions limits.

The memory experiment searched for the largest tested batch whose PyTorch peak allocation attributable to the trial did not exceed free memory reported after loading. The observed limits were 272, 68, 17 and 4 sequences at contexts 256, 1,024, 4,096 and 16,384: about 76–80% of the naive KV-only maxima. Logical KV accounted for roughly 76% of the recorded peak, consistent with substantial temporary state. The separate beyond-limit trials completed with peaks of 12.27–13.70 GiB and individual decode steps of 10.65–14.57 seconds, without raising torch.cuda.OutOfMemoryError in this setup. The measurements do not include page-fault, residency or host-transfer traces, so successful over-budget allocation and severe slowdown are compatible with Windows GPU-memory virtualization but do not establish the precise paging mechanism. torch.cuda.max_memory_allocated() also records PyTorch allocations, not all processes’ residency or a device-wide physical limit.

Context tokens KV-only batch ceiling from available memory Largest tested batch with trial peak ≤ initially free memory Peak at tested batch (GiB) One decode step at tested batch (s) Larger probe: batch / peak (GiB) / step (s)
256 358 272 9.78 9.58 341 / 12.27 / 10.65
1,024 89 68 9.73 9.29 86 / 12.30 / 12.55
4,096 22 17 9.70 9.14 22 / 12.56 / 12.92
16,384 5 4 9.13 8.54 6 / 13.70 / 14.57

These rows are memory-fit probes, not usable-throughput limits. Every reported step at the largest within-free-memory batch already took several seconds, and the “larger probe” is not a production configuration.

A second, performance-oriented search was therefore necessary. The nominal memory-fit points already took 8.54–9.58 seconds per decode step—unacceptable for the fast-token workloads in this book even before adding queueing. The cliff experiment varied batch size at fixed context and recorded cache state, allocator peak and step time, to find where marginal concurrency stops buying throughput. Its measurements are sparse doublings, so the exact transition load is not identified; the next qualification experiment should bisect the transition under a predeclared step-time or TPOT limit, repeating runs and recording memory residency/transfer counters.

Context 256: batch sequences Logical KV cache (GiB) Trial peak (GiB) Decode step (ms) Microseconds per cached position in batch Idealised copy-bandwidth floor (ms)
1 0.03 0.05 27.6 107.8 4.3
8 0.22 0.29 29.3 14.3 5.0
32 0.88 1.15 80.8 9.9 7.5
64 1.75 2.30 151.4 9.2 10.8
128 3.50 4.59 294.6 9.0 17.4
256 7.00 9.18 8,816.8 134.5 30.7

The final column divides one counted read of weights plus KV state by the measured 283.8-GB/s copy ceiling. It is a deliberately optimistic bandwidth floor and omits additional cache movement, launch, allocation and attention work.

Between batches 32 and 128 at context 256, decode time per cached position was approximately 9–10 microseconds and step time rose from 80.8 to 294.6 ms. Doubling to 256 raised the step to 8,816.8 ms, about 30 times slower, even though the trial peak (9.18 GiB) was below the initial 9.81-GiB free snapshot. Similar step-time discontinuities occurred at large cache footprints in the other context sweeps. This is strong evidence of a severe memory/implementation performance transition; it is not proof of a particular cause, because the test did not collect physical-residency, migration, allocator-fragmentation or kernel-by-kernel time at that cliff. At 128 sequences, the optimistic bandwidth-only floor was 17.4 ms versus a measured 294.6 ms, showing that a one-read cache model badly underpredicts this framework’s step. The supported operational conclusion is narrower but important: for this implementation the acceptable concurrency limit lies below 256 at context 256, and the 128–256 interval requires a finer search against an explicit TPOT/SLO target. Do not equate a successful allocation with usable serving capacity.

A production inference runtime may impose more explicit budgets. vLLM’s optimisation documentation describes preemption/recomputation under KV-cache pressure, configured GPU-memory use and caps on active sequences or batched tokens; implementation and defaults vary with version and settings. Those are external documented mechanisms, not behaviours observed in the Chapter 38 loop. The comparison suggests concrete next tests—bounded admission, continuous batching, preallocated/paged KV storage, and matched-load TTFT/TPOT measurements—but it does not establish that any particular runtime will avoid the measured cliff without its own qualification.

A capacity model from a load sweep

A capacity model from a load sweep

CapacityModel is constructed from one controlled run per offered load: an achieved request rate, a vector of TTFT and TPOT values, and the share of requests satisfying the joint per-request SLO. The reported TTFT p50/p99 intervals come from a request-level bootstrap; the attainment-share interval uses Wilson’s binomial method. These intervals quantify sampling variation only under their statistical assumptions. They do not measure run-to-run variability of the arrival sequence, uncertainty in server configuration or external interference. The 95% bands therefore must be described as single-run, assumption-dependent intervals, rather than predictive guarantees for a subsequent run. The later replicate tests explicitly challenge that assumption.

The model exposes three related but different operations; none is a substitute for a prospective validation run.

  • predict(metric, offered_load) returns a saved estimate at a measured load and a clearly flagged, linear interpolation of estimate and band edges between adjacent measured loads. It raises ExtrapolationError outside the measured offered-load interval or when a named metric is missing; interpolation is a numerical convenience, not a calibrated probabilistic prediction interval.
  • capacity(target_share) scans measured load points in ascending order and records the last contiguous load whose lower Wilson bound is at least the target and the first load whose upper bound is below it. Those are evidence-labelled bracketing markers; the current implementation does not prove that SLO attainment is monotonic between observations or that a threshold exists between them under future arrival draws. In particular, “no certified load” means not established by this sweep, not necessarily “true capacity is below the lowest load.”
  • plan(arrivals, target_share, headroom) divides a proposed arrival rate by the contiguous certified marker after holding back user-selected headroom and rounds up. It assumes identical, non-interfering servers and even arrival distribution, none of which were tested. The current code also needs an explicit guard when the planned per-server load falls below the lowest measured load, plus checks for degenerate zero-arrival inputs; its predict guard does not automatically protect plan.

The recorded batch-4 single-run points below use offered, not achieved, requests/s for the horizontal axis. The target is 95% of individual requests with TTFT ≤ 2.0 s and TPOT ≤ 60 ms. Values in parentheses are request-level Wilson or bootstrap 95% intervals conditional on the one observed run. The critical question is whether new runs maintain those levels, not merely whether the original point estimate exceeds 0.95.

Offered requests/s Achieved requests/s TTFT p50 (s) TTFT p99 (s), bootstrap interval SLO attainment share, Wilson interval
0.4 0.40 0.14 1.60 (1.16–1.77) 1.00 (0.97–1.00)
1.2 1.17 0.47 1.45 (1.29–1.65) 1.00 (0.97–1.00)
1.8 1.75 0.64 1.76 (1.49–1.81) 1.00 (0.97–1.00)
2.5 2.42 1.08 3.13 (2.84–3.24) 0.88 (0.81–0.92)
2.9 2.77 1.73 4.99 (4.65–5.82) 0.59 (0.51–0.67)
3.6 2.85 7.58 10.13 (9.61–10.46) 0.03 (0.01–0.08)

The values are unchanged from the saved primary runs, rounded for readability. Independent arrival-seed repeats are analysed separately and do not inherit these per-request intervals.

From this single-run model, the highest continuously qualifying measured load was 1.8 requests/s, and the first observed load whose Wilson upper bound missed 95% was 2.5 requests/s. Calling 1.8–2.5 a provisional bracket in this sweep is reasonable; claiming it as a 95%-reliable population-capacity interval is not. The Latency, Throughput and Time to First Token batch-4 capacity burst reached 3.213 requests/s, whereas the heaviest Poisson run achieved 2.852; neither throughput maximum is itself an SLO-qualified capacity. Moreover, the batch-4 1.8-request/s point failed the joint target in two later independent arrival draws. This negative replication result is central: operational planning must use repeated-run evidence, not the primary curve alone.

Other workload/SLO choices demonstrate why the object of estimation matters. For batch 1, the lowest measured load, 0.4 requests/s, had 98.46% observed attainment but a Wilson lower endpoint of about 94.56%, so the model could not mark even this load as meeting a 95% confidence rule; a later 0.8-request/s point was much worse. The correct finding is insufficient evidence of any qualifying load in the swept range; to locate a lower threshold, extend the sweep below 0.4 and repeat it. Under the stricter 0.5-second TTFT SLO, the batch-4 curve likewise lacked a qualifying measured load. With 48–96-token output lengths, the same batch-4 server was much slower and did not qualify at its lowest tested offered load, while achieved throughput plateaued around 1.24–1.29 requests/s rather than about 2.85 for the shorter outputs. Those results establish sensitivity to work and SLO definitions, not portable capacity for another server or prompt mix.

What the bands cover

A run with 130 retained requests is not 130 independent observations of queue delay. Requests in one backlog episode share scheduling history, and the duration, burst structure, CPU launch rate and contention all affect the series. A Wilson interval for independent Bernoulli trials and an ordinary request-resampling bootstrap for p99 therefore have no guaranteed 95% coverage for a future whole run. The numerical intervals in the preceding table are accurate outputs of the specified methods; their interpretation is limited. A production qualification should repeat entire, independently seeded scheduled-arrival runs, include deliberate CPU/GPU interference checks, and use a run-level or carefully justified dependent-time-series uncertainty method rather than treating each request as a replicate.

To test this distinction, the chapter reused the batch-4 server at offered loads 1.8, 2.5 and 2.9 requests/s and the batch-1 server at 0.8. For batch 4, one repeated observation used the same arrival and workload seeds as the original, and two used different arrival seeds; for batch 1, only two new-seed runs were recorded. The workload generation procedure otherwise remained fixed. A same-seed run is not identical execution—host placement, clocks, GPU contention and scheduling may differ—and new seeds introduce a different queueing history. The experiment isolates neither source perfectly; its purpose is to check whether the original within-run intervals cover values produced by these alternate real executions.

Server / offered load Original p99 TTFT and SLO share Same arrival seed: p99 / share Different arrival seeds: p99 / share
batch 4 / 1.8 req/s 1.76 s / 1.00 1.56 s / 1.00 3.83 s / 0.78; 2.23 s / 0.94
batch 4 / 2.5 req/s 3.13 s / 0.88 4.78 s / 0.80 7.85 s / 0.00; 5.54 s / 0.28
batch 4 / 2.9 req/s 4.99 s / 0.59 5.88 s / 0.41 8.15 s / 0.17; 8.70 s / 0.22
batch 1 / 0.8 req/s 9.72 s / 0.40 not recorded 7.56 s / 0.51; 7.53 s / 0.37

Rounded observations from saved finite 130-request runs; different arrival seeds do not imply independently controlled hardware conditions.

The replication results are much stronger evidence against single-run calibration than against any particular scheduling mechanism. At batch 4 and 1.8 requests/s, the same-seed repeat remained inside the original p99 TTFT band, but both different-seed repeats missed it and attained only 77.69% and 93.85% SLO compliance. At batch 4 and 2.5 requests/s, even the same-seed repeat’s p99 was 4.78 s versus the original 3.13; new-seed repeats produced 7.85 and 5.54 s. Of the 24 comparisons of p50, p99 and SLO share against the original bands for different-seed runs, only 2 were inside; of nine same-seed comparisons, 3 were inside. This does not reveal the population failure rate from so few repetitions. It does reject the comforting inference that an apparently tight request-level confidence band predicts a new run, especially near a queueing knee. Changes in achieved throughput, initial state and GPU/CPU contention may have contributed alongside arrival burstiness.

widen_with_replicates replaces each selected metric’s central value with the median across the original value and the available repeated-run values, and expands the displayed range to include both the primary run’s original band and the observed replicate extremes. It is a conservative envelope of observations, not a newly calibrated 95% confidence or prediction interval. Under that rule the batch-4 SLO-share envelopes are 1.00 (0.78–1.00) at 1.8, 0.80 (0.00–0.92) at 2.5 and 0.41 (0.17–0.67) at 2.9. The resulting code-level continuously qualifying marker is 1.7 requests/s, compared with 1.8 in the original model. Crucially, 1.7 was not independently repeated in this experiment: the widening changed the 1.8-point verdict and left the original 1.7 point unchanged. It would be incorrect to call 1.7 a replicated, 95%-assured service capacity. A better next experiment repeats around 1.4–1.8 and reports a run-level acceptance criterion.

Interpolation is an empirical risk, even inside the range. Between two sampled loads, the implementation linearly interpolates the metric value and both band endpoints. Leave-one-out checks compare a withheld interior point with the interpolation from its immediate neighbours. For the original batch-4 model, five of seven TTFT-p99 estimates landed inside their interpolated ranges, versus seven of seven for the widened observational envelopes; attainment shares were inside at five of seven under either treatment. Batch 1 was worse (one of three for TTFT p99), and the longer-output model was worse still (one of three TTFT-p99 and zero of three attainment-share checks). These counts are tiny, adjacent points are correlated through the sweep design, and a widened envelope can improve inclusion mechanically without improving probabilistic calibration. The sharp curvature near the knee makes local interpolation particularly fragile. Treat interpolated values as exploratory diagnostics, not evidence for an unmeasured SLO-certified load.

Rejecting extrapolation

predict refuses a query below the smallest or above the largest offered load observed, and the saved checks exercise both directions for the batch-1, batch-4 and stricter-SLO models. This is a valuable fail-closed interface behaviour, but it does not mean every load inside the sweep is supported equally well: interpolation can miss the observed curve, and no single-run interval gives a guarantee about future arrivals. For a planning decision, an unsupported load should trigger an additional measurement, not an extrapolating fallback or a silent choice of the closest point.

The consequences of extrapolating the lower-load throughput regime are visible in the saved examples. A straight line fitted to the first two batch-1 points predicted achieved rates of 1.18, 1.76 and 2.45 requests/s at offered loads 1.2, 1.8 and 2.5, while the measurements were 0.93, 0.92 and 0.90: overestimates of 27%, 91% and 173%. For batch 4, a line fitted to loads through 1.2 requests/s tracked several subsequent points within 2% before overstating the achieved rate at 3.6 (3.50 predicted versus 2.85 measured). A saturation knee is therefore easy to miss with benign low-rate data. The experiment establishes failure of these particular linear extrapolations, not a universal error bound for all extrapolation models.

The prohibition must also apply below the measured range, and to derived planning outputs. A lower offered load may well satisfy a strict SLO, but the current data cannot locate the threshold if the sweep starts too high. Moreover, the code’s capacity verdict currently states that failure to certify the lowest observed point means capacity is below that point; strictly it means the experiment did not certify it. A follow-up implementation should distinguish NOT_CERTIFIED, OBSERVED_FAILING and BELOW_MEASURED_RANGE without inferring population capacity from an inconclusive Wilson bound. The plan operation should independently verify that its computed per-server load is within a tested operating region; predict’s extrapolation guard does not cover that path.

A plan

A capacity plan

Planning arithmetic starts with a selected per-server planning marker, not a proven universal capacity: server count = ceiling(arrival rate / (marker × (1 − headroom))). Using the replicate-enlarged batch-4 model’s marker of 1.7 requests/s, this yields two servers for 2 requests/s at 30% reserved headroom, four for 4 requests/s, seven for 8 requests/s and ten for 8 requests/s at 50% headroom (the original single-run 1.8 marker would suggest nine). All are scenario calculations, not cluster sizing guarantees. They assume uniform routing, independent resource limits, healthy identical servers, the same workload, and stable arrival statistics. The 1.7 marker itself has not been verified by independent arrival-seed repeats at that load. For any proposed placement, test both the planned per-server arrival rate and the distribution of bursts across servers.

Only one GPU was available, so the chapter does not test two workers, a load balancer, model replicas competing for memory, failure redistribution, or the network between a client and the service. A 30–50% headroom choice is a policy parameter, not an estimated protection against a specified quantile of bursts. MLPerf Inference is a useful methodological reference because its documented scenarios define workload generation, latency criteria and system-under-test boundaries; the benchmark rules vary by version, and this book did not run MLPerf or obtain compliant results. The research of DistServe similarly frames capacity in terms of requests meeting paired TTFT/TPOT requirements, but its architecture and performance claims are external findings. The next qualification stage requires full-run repeats, a predetermined acceptance rule and direct cluster measurements—not a larger number obtained by multiplication.

What the numbers do not show

Hardware, workload and runtime are deliberately narrow. The main sweeps use one small model, one static-batching Python loop and synthetic prompts around 60–450 tokens with 16–48 output tokens. The longer-output condition tests one additional distribution, not general robustness to length, mixture, priority, cancellation, prefix reuse or user think time. The roofline tests and serving sweeps also use different execution paths. The figures should never be carried into a production forecast without measuring the intended model, server implementation, workload and request pattern.

The bands are not future-run guarantees. A request-level Wilson or bootstrap interval is not automatically calibrated under queue-induced dependence. The added repeat envelopes report what was observed across a handful of runs and have no stated frequentist coverage. The 95% target and the 95% statistical interval are distinct: a point estimate of 100% attained in 130 requests can still have a Wilson lower bound around 97.1%, while another arrival draw may be materially worse. Repeated independent runs, run-level intervals or justified dependent-data methods, and explicitly tested environmental perturbations remain essential.

The reference SLO was selected retrospectively. The two-second TTFT threshold was chosen after examining Latency, Throughput and Time to First Token’s curves; it is not an independent preregistered product objective. Its measured brackets are exploratory and especially vulnerable to choosing a convenient threshold after seeing the data. Future experiments should freeze workload distributions, the SLO, acceptance probabilities and a repeat count before collecting the confirmation runs.

The roofline is an analytical approximation, not a full traffic trace. FLOPs and bytes were counted from the model and a one-read estimate for weights/KV. The measured copy and GEMM ceilings are workload-dependent; the omitted DynamicCache reallocations, head expansion and intermediate buffers affect actual intensity and memory pressure. The inference that this modeled point falls on the memory-sloped roofline is useful; a stronger diagnosis would require kernel-level profiling, more complete traffic counts and measurements after optimizing the cache path.

The memory failure mechanism was not instrumented. On this Windows driver, some CUDA operations completed despite PyTorch peak allocations above the initially free memory and suffered enormous step times. The chapter did not directly observe device-to-host page migrations, system RAM bandwidth, process-level residency or allocation-eviction events. Do not generalize its overcommit behaviour to Linux, different GPUs, different drivers or CUDA allocators; another setup may raise OOM. The practical admissibility condition is a safe latency and memory margin, not the absence of a thrown exception.

Real serving systems were not benchmarked here. vLLM preemption, cache budgets and scheduling features come from version-dependent documentation. DCGM profiling indicators, MLPerf LoadGen runs and a multi-GPU cluster were not exercised. The experiments demonstrate how to ask and bound capacity questions for one educational server, not that a production engine will attain the same rates or eliminate all performance cliffs.

Inference Lab increment

examples/ch38/capacity_core.py supplies LoadPoint, load_point, Wilson and request-bootstrap intervals, CapacityModel.predict, .capacity, .plan and .leave_one_out, alongside ExtrapolationError, widen_with_replicates, replicate_check, linear-extrapolation diagnostics and RooflinePoint. Read these contracts alongside their limitations: the intervals presume independent requests; widening produces an empirical envelope; capacity can overstate what “not certified” says; and plan has no independent guard on its implied per-server query load. These are explicit candidates for a subsequent engineering patch, not repairs made by this manuscript-only edit file.

examples/ch38/capacity_lab.py contains ceilings, signals, memory, cliff, long and replicates, with a coarse nvidia-smi sampler, PyTorch memory accounting and optional profiler traces. The memory probe runs very large allocations and deliberately crosses the initially reported free-memory budget; rerun it only on an appropriate test machine with other GPU workloads stopped and with a timeout/recovery plan. It does not log physical paging events, and its cliff results are sparse step-time samples rather than a full sweep of safe serving concurrency.

examples/ch38/capacity_analysis.py builds the load-point models from frozen Latency, Throughput and Time to First Token runs and the chapter’s long-output and replicate traces, constructs the evidence tables, checks same- and different-seed repetition, tests leave-one-out interpolation and explicit extrapolation refusals, and compares the starter formula. The saved JSON and raw traces establish the reported observations; rebuilding these derived outputs does not rerun the GPU or establish new statistical coverage.

To reconstruct the analysis from saved evidence (without GPU experiments or provider calls):

python research/ch38/build_results.py

To run the signals experiment below requires the recorded CUDA/PyTorch environment and suitable exclusive or controlled use of the local GPU. It collects the roofline/activity scenarios, not the complete load sweep, memory probes or repetitions; those require their separate subcommands and an explicit recording of seeds, environment and run durations. The original chapter’s approximately 25-minute estimate referred only to some workload experiments and is not a guarantee for a complete reproduction.

python examples/ch38/capacity_lab.py signals --out research/ch38/measurements/signals.json

The resulting engineering rule is: interpret GPU utilisation as sampled activity, not available serving capacity; define useful work and byte accounting before drawing a roofline; treat a memory-allocation success as weaker than acceptable latency; measure offered load under an explicit workload and joint SLO; repeat complete runs with new arrival seeds; label Wilson/bootstrap bands as within-run only; refuse out-of-range queries; and label server-count arithmetic as hypothetical until a cluster passes the same acceptance tests. The important deliverable is not a single requests-per-second number. It is a defensible reason to accept, bound or decline a capacity claim.

What you should now be able to do

  • Explain what coarse GPU and memory activity sample and why they cannot by themselves establish arithmetic efficiency, memory-bandwidth efficiency or SLO capacity.
  • Derive the ridge point and modeled operational intensity from measured microbenchmark ceilings and counted work, while identifying cache-copy traffic omitted from the model.
  • Calculate float16 KV bytes per position and show why allocator peak and usable batch limits are smaller than a cache-only memory quotient.
  • Distinguish the observed large-batch performance cliff from the unmeasured hypothesis that paging caused it.
  • Build load points using offered rate, achieved rate, TTFT, TPOT and joint SLO attainment, and distinguish single-run Wilson/bootstrap intervals from replication uncertainty.
  • Explain how a continuous single-run certified marker and a replicate-widened observational marker differ from a prospectively validated service capacity.
  • Interpret leave-one-out interpolation and out-of-range refusals without treating either as a future-load guarantee.
  • Produce a conditional server-count calculation, identifying when the computation itself points below the measured per-server load range or assumes untested load balancing.

Key terms

  • Driver GPU utilisation: fraction of a sample window during which one or more GPU kernels ran, not fraction of peak throughput.
  • Driver memory utilisation: sampled activity of GPU memory access, not bytes/s divided by the hardware bandwidth limit.
  • Operational intensity: modeled FLOPs divided by modeled bytes moved; must name omitted traffic.
  • Roofline bound: the lesser of achieved/calibrated compute ceiling and modeled intensity times achieved/calibrated bandwidth ceiling.
  • Ridge point: the FLOP/byte ratio where the model’s compute and memory ceilings intersect.
  • Logical KV-cache bytes per position: layers × key/value × KV heads × head dimension × element size, excluding allocator overhead.
  • Performance cliff: a sharp step-time increase that can occur before, at or beyond nominal free-memory exhaustion.
  • Load point: one controlled run at a named offered rate with recorded achieved rate and request-level outcomes.
  • Within-run band: interval computed from that run’s requests under the method’s dependence assumptions.
  • Replicate envelope: range enlarged to include a few repeated-run observations; not a confidence interval.
  • Provisional certified marker: highest contiguous measured offered rate whose chosen lower attainment bound meets a target under the current evidence procedure.
  • SLO bracket: observed passing and failing markers, not a guaranteed population threshold.
  • Headroom: user-selected fraction of planning load withheld, requiring independent validation against burst statistics.

Reader exercises

  1. Locate the cliff: search between batches 128 and 256 at context 256 with several repeated, synchronized steps, recording latency, allocator peak, actual residency and page-migration indicators where supported. State a predeclared step-time limit and stop before the desktop becomes unusable.
  2. Test the mechanism: use a preallocated/paged KV cache and a more efficient attention kernel on the same hardware; separately measure copies, DRAM activity, device-memory residency and end-to-end TTFT/TPOT, with controlled CPU affinity.
  3. Resolve the uncertified low end: extend the batch-1 offered-load sweep below 0.4 requests/s, with independent-seed repeats, until a predefined run-level acceptance procedure succeeds or a resource/time budget is reached.
  4. Prospectively verify 1.7: run multiple independent arrival seeds around batch-4 rates 1.4–1.8 requests/s, with the 95%-attainment threshold and confirmation rule frozen in advance. Compare the repeat-level result with both the original and widened markers.
  5. Admit within limits: implement an explicit cache/latency-driven batch cap in the educational loop and repeat the long-output and baseline workload sweeps; quantify reduced tail latency and any lost throughput.
  6. Test scaling rather than assume it: deploy two independent servers on two GPUs behind a load balancer, measure per-server distribution, cross-server interference and failure redistribution, then compare achieved goodput with the arithmetic plan.
  7. Instrument a supported GPU: collect DCGM/other appropriate profiling counters for the six scenarios and reconcile counted memory movement with actual traffic, making sure instrumentation overhead is recorded.
  8. Repair the planning gates: make capacity() distinguish insufficient certification from demonstrated failure; make plan() reject or qualify computed loads below the minimum tested load, zero arrival and unsupported workload/SLO combinations. Supply regression tests.
  9. Check interval coverage: use independent full-run replications and an explicit run-level coverage metric; compare this with the ordinary per-request Wilson and bootstrap intervals under correlated queueing.

References

  • Roofline: An Insightful Visual Performance Model for Multicore Architectures — Williams, Waterman and Patterson, Communications of the ACM 52(4), 2009. Original roofline formulation linking attainable operations/s to computational intensity and memory traffic. The chapter builds its own measured-ceiling approximation; it does not reproduce the paper’s hardware experiments. The Berkeley technical-report record provides an earlier version.
  • DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving — Zhong et al., OSDI 2024. Research grounding for capacity defined by joint TTFT/TPOT SLO attainment. DistServe’s performance gains and architecture were not reproduced.
  • The Tail at Scale — Dean and Barroso, Communications of the ACM 56(2), 2013. Motivation for evaluating tail latency rather than inferring user experience from averages. Its distributed-system examples were not reproduced.
  • Batch Size Effects in the Analysis of Simulation Output — Schmeiser, Operations Research 30(3), 1982. Background on inference from correlated observations and why batching/independent repetitions matter; the chapter does not implement or validate this paper’s methods.
  • NVIDIA Data Center GPU Manager — official, version-sensitive documentation for more detailed profiling metrics; no DCGM profiling measurement was obtained here.
  • nvidia-smi --help-query-gpu — local help text read from driver 591.44 for activity-counter definitions, October 2026.
  • MLPerf Inference Datacenter — MLCommons benchmark programme and load-generating scenarios; the applicable version-specific submission rules are the source of authority. No MLPerf run was made.
  • vLLM Optimization and Tuning — evolving project documentation for cache pressure, preemption and runtime configuration; vLLM itself was not run.
  • Qwen3-0.6B — model used, Apache-2.0, pinned revision c1899de289a04d12100db370d81485cdf75e47ca.

Evidence in this chapter

Claim Evidence classification and qualification
Batch-64 decode reported 98% GPU / 93% memory activity, 1.4% of the calibrated arithmetic ceiling and 6.8% of the modeled roofline bound; matrix multiply reached approximately 90% of the arithmetic ceiling Local measured counters/timings plus modeled FLOPs and deliberately incomplete bytes; not DCGM instruction or memory-traffic counts
The measured ridge was approximately 111 FLOP/byte from 31.5 TFLOP/s and 283.8 GB/s Local calibration; microbenchmark-dependent ceilings, not advertised hardware peak
At batch 64, self device time was dominated by copies, elementwise operations, batched matmul and concatenation Local short profiler trace; percentages are relative and instrumentation perturbed timing
Logical KV cache required 114,688 bytes per token position; trial peak within free memory was reached at 76–80% of the KV-only batch prediction Configuration arithmetic and local PyTorch memory measurements; not a universal per-sequence capacity
Beyond-initially-free-memory test allocations completed without OOM and took 10–15 s per step Local observation on this Windows/driver configuration; direct page migration was NOT_MEASURED
A cache-size doubling near the high-load regime produced a 15–30× step-time cliff Local sparse experiments; location/mechanism require finer sweep and memory tracing
Under the retrospectively selected 2.0-s TTFT and 60-ms TPOT SLO, the primary batch-4 run’s single-run criterion selected 1.8 requests/s and first failed at 2.5 Local saved 130-request primary runs; within-run Wilson/bootstrap assumptions and SLO-selection bias apply
Only 2 of 24 different-arrival replicate values fell inside primary run bands; repeated SLO shares at batch-4 1.8 were 0.78 and 0.94 Local independent-arrival-seed comparisons, not a validated population confidence interval
Replicate envelope shifted the code-level certified marker from 1.8 to 1.7 requests/s Derived from observed repeats at 1.8, 2.5, 2.9; 1.7 itself was not replicated
Low-load linear extrapolation overstated saturated achieved request rate by up to 173% Local held-out-rate checks of the specified linear model; not a universal extrapolation error bound
Batch 1, strict SLO and long outputs had no statistically certified load in their tested range Local qualification outcome; not proof that true capacity lies below the lowest tested load
Server-count calculations with specified headroom Derived arithmetic assuming identical independent servers and even routing; multi-GPU scaling NOT_RUN
DCGM, MLPerf, vLLM and DistServe behaviour External documentation or research, NOT_REPRODUCED; other servers, cluster scaling, actual paging telemetry NOT_RUN

Implementation status

  • Manuscript: content/books/inference/38-chapter.md (this manuscript-only edit set).
  • Executable components: examples/ch38/capacity.py (original starter, unchanged), examples/ch38/capacity_core.py (load-point statistics, interpolation, provisional bracket and planner), examples/ch38/capacity_lab.py (ceilings, signals, memory tests, sparse cache-growth timing, extended output workload and repeats), examples/ch38/capacity_analysis.py (frozen-trace analyses).
  • Tests: tests/test_ch38_capacity.py (original) and tests/test_ch38_capacity_lab.py (20 recorded tests covering Wilson/request bootstrap arithmetic, bounds, model interpolation/refusals, starter comparison, roofline/cache arithmetic and analysis from Latency, Throughput and Time to First Token runs). Test count is as recorded by the chapter; no new tests were executed for this editorial revision.
  • Evidence: research/ch38/sources.md, research/ch38/results.json, research/ch38/raw/, research/ch38/measurements/, research/ch38/build_results.py and research/evidence-register.md.
  • New implementation gates identified by this review: handle missing TPOT as invalid rather than silently SLO-passing where appropriate; distinguish insufficient certification from observed failure; guard out-of-range plan() outputs; add full-run repeat-level inference; record physical GPU-memory residency if claiming paging.
  • Test entry point in the repository: python -m unittest discover -s tests -v. No GitHub edits, local GPU runs, hosted requests, or new financial measurements were performed by these prose changes.

This chapter remains an openly labelled, publication-directed draft (draft = false in its front matter). Its demonstrated contribution is a measurement and refusal discipline for one local inference stack: the counter is not capacity; the cache-only calculation is not an admission limit; a passing primary load trace is not repeated-run SLO qualification. The revised manuscript reports the existing observations and flags the engineering corrections they motivate, without claiming that code was patched or additional experiments were run. Correctness, Determinism and Reproducibility continues from performance qualification to correctness qualification.