← Inference From First Principles

Designing Meaningful Inference Benchmarks

A benchmark suite with a frozen workload manifest, full configurations, interleaved paired trials and machine-readable results, run on four configurations of a small server: what repeated trials, an A/A comparison and a choice of unit of replication do to the verdicts.

Four-request static batching looked decisively faster than a one-request server in one experiment and slower in another. Under the same light-load specification, a single paired trial put the batch-4 server’s median time to first token (TTFT) 85% below the baseline; another put it 253% above. Across five workload-seed blocks, the geometric mean of the paired TTFT ratios was 0.55, with a 95% Student-t interval on log ratios from 0.10 to 2.91. That interval supports neither a reliable gain nor a reliable loss. Under the heavy workload, however, every paired trial favoured batch 4: its median TTFT was 93–97% lower per trial, and its throughput was roughly 1.5–2.0 times the baseline’s. This is not a contradiction. The load determines whether a batching mechanism is being exercised and whether the measurement can distinguish its effect from queueing variation. These observations concern one local Qwen3-0.6B static-batching implementation, not an inference-engine leaderboard.

The statistical warning came from a second experiment: batch 4 was compared with an identical configuration under a different name (A/A). For 15 single-run A/A contrasts, a paired bootstrap treating requests as independent yielded intervals for the mean TTFT difference that excluded zero in 8 cases. Once the five trials within each workload were treated as the sampling units, none of the three corresponding intervals excluded zero. The 8/15 fraction is an observed diagnostic for these dependent queues, not a calibrated estimate of a procedure’s long-run Type I error rate; that would require many independently repeated A/A suites. Likewise, the fact that all three trial-level intervals include zero neither proves equivalence nor validates their nominal coverage.

The chapter’s implementation target is a repeatable benchmark suite: frozen workload specifications and request digests, complete recorded configurations, randomised and interleaved comparison blocks, trial-level paired statistics and machine-readable per-request traces. A 60-run suite covers three workloads, five trial seeds and four configurations of the Chapter 36 server. The current harness enforces several useful record-presence checks and withholds its primary verdict below five trials, but it is a research harness, not yet a fail-closed benchmark adjudicator: comparison functions do not themselves enforce all pairing, version and quality checks, and the quality report is descriptive rather than a required gate. Those distinctions matter if its outputs will become performance claims in Chapter 41. No provider, MLPerf submission or second serving engine was measured.

The question

A meaningful benchmark is an experiment with a target decision: better at what, on which workload, by how much, and with what chance of being misled? That requires freezing the workload and model; specifying arrival rates, latency endpoints and token denominators; recording which system ran which request; defining an independent replicate; and choosing the effect scale and decision rule before looking at the data. An observed interval that crosses zero is not a statement of equivalence. Nor is a five-trial confidence-interval half-width automatically the smallest effect an experiment has statistical power to detect. The chapter asks how to turn these distinctions into a reproducible workflow, not just another bar chart.

Where this sits

Chapter 36 provides the static-batching server, event timestamps, offered versus achieved rates and latency definitions. Chapter 38 shows why single-run uncertainty is unreliable near a queueing knee, and Chapter 39 supplies a numerical reproducibility manifest and the evidence that batching can change generated tokens. Chapter 37 adds costs conditional on assumptions. This chapter brings those components together as a controlled comparison protocol. Chapter 41 can then use that protocol, but only after the remaining checks—especially result identity, independent repeatability, semantic quality and workload selection—are made enforceable.

Where the starter was wrong

The starter’s run_trials calculates a deterministic latency, 0.1 + 0.01 × prompt characters, for two prompts and repeats the same numbers three times. Its six rows are not six independent trials; counting them that way shrinks the interval without adding information. It uses a normal critical value of 1.96 despite the tiny effective sample, supplies neither a system baseline nor matched requests, and records no workload hash, environment, warm-up policy, run order or correctness check. An example may teach mean-and-interval arithmetic while still being incapable of supporting a performance claim. The original starter and its tests are preserved; bench_core.py, bench_lab.py and bench_analysis.py form the separate experimental suite reviewed here.

What is frozen

Designing meaningful inference benchmarks

The workload. A WorkloadSpec identifies request count, discarded warm-up count, prompt composition, output-length range, arrival-process specification, rate, two SLO thresholds, base seed, cache-state declaration and generator name. The canonicalised specification is content-hashed; write_manifest also hashes the list of workload definitions, and read_manifest detects an edited field without a matching hash. The saved suite manifest has hash 3b0c7161424a16e2. Importantly, the per-run record contains the individual workload’s hash rather than that suite-wide manifest hash. Moreover, a hash protects consistency of recorded bytes; it does not independently identify the generator’s executable version, tokeniser assets or every runtime input. For a publication-grade record, preserve the manifest file itself, its hash, the implementation commit, the tokeniser revision and the command that generated the requests.

For trial number t, WorkloadSpec.trial_seed(t) produces a derived seed, from which the generator constructs prompts, target output lengths and Poisson arrival offsets. All systems in the same workload–trial block therefore receive the same planned requests and arrivals. request_digest hashes each request’s prompt-token digest, prompt length, requested output length and scheduled offset. In the 15 saved blocks, the recorded digests agree across systems; this is a successful post-run consistency check. It is not a cryptographic proof that every execution saw an identical external state or that no warm-up/cache state carried over. The analysis currently computes its comparison after grouping by workload, system and trial; it should refuse comparison whenever the request digests, workload hashes, required configurations or environment identities disagree, rather than merely printing a separate warning.

The system. SystemConfig requires nine named parameters: engine identity, maximum batch, maximum wait, dtype, attention implementation, decoding procedure, CPU pinning, model identifier and model revision. In this suite b1 is the batch-1 baseline, b4 is batch 4 without intentional fill wait, b4w uses batch 4 and a maximum 0.3-second wait, and b4-copy has the same parameter hash as b4. All run the same underlying model, though each label has its own Engine instance. The validator checks that required keys exist; it does not yet establish that their values are valid, compare a stored hash against a trusted configuration registry, or bind them to a precise source commit. Those are necessary additions before calling it full configuration enforcement.

The environment. Each run records a Chapter 39-derived manifest with the Python, PyTorch, CUDA, GPU, driver, model and library information available to the process. validate_result rejects a record missing six core environment fields (python, torch, gpu, driver, transformers, os), but does not require every Chapter 39 manifest field or independently attest that recorded values are true. comparability_checks found one environment representation across the 60 saved records after excluding request-specific fields. That establishes consistency within the recorded fields, not cross-machine reproducibility or freedom from changes in GPU clocks, background load, thermal state or shared-desktop activity.

The schedule. For every workload and trial, make_schedule permutes the four system labels and records their within-block positions. The original suite contains 3 workloads × 5 trial numbers × 4 systems = 60 sequential runs. Matching requests within blocks controls one source of workload variation; random order helps prevent one system from always benefiting from first or last position. However, the executions are sequential and share one GPU, so background load, thermal history, cache allocator state and drift remain possible. Randomisation is a design defence, not evidence that each block was stable. A stronger study would record clocks and temperatures, balance orders across more blocks, and rerun full blocks on separate sessions or days.

The result. Each run is stored as one JSONL record with schema version, suite and workload labels, per-workload hash, system name and parameter values, trial/position/seed, request digest, run start, per-request scheduled/submitted/token/finish timestamps and generated tokens, plus an aggregate summary. validate_result checks required fields, schema version, presence of the environment and configuration subset, completion and token/timestamp list lengths. It does not yet check monotonic timestamps, unique request identities, consistency between summaries and raw events, agreement with the frozen manifest, or a complete block of expected systems. Therefore the raw JSONL is inspectable evidence, while the schema validator remains a minimal structural filter rather than a full audit of correctness.

The suite

Three deliberately different workloads were run open-loop with Poisson-scheduled arrivals. They are not representative samples of production traffic: the rate, prompt construction and requested output lengths were chosen for the local demonstration, and the comparison is conditional on those choices. Open-loop scheduling also needs its precise origin and completion-window rules recorded to avoid conflating requests that were offered with requests that completed.

Workload Measured requests (+ discarded warm-up) Offered Poisson rate Requested output lengths Interpretation for batch 1
light 24 (+4) 0.5 requests/s 16–48 tokens Below its single-request capacity in the frozen configuration
heavy 54 (+6) 1.8 requests/s 16–48 tokens Above its single-request capacity; deliberately stresses queueing
long 30 (+4) 0.7 requests/s 48–96 tokens Longer outputs overload the batch-1 loop at a lower offered rate

These are three selected workload points, not samples from a known deployment traffic distribution. Requested output lengths are fixed by the generator; the engine suppresses end-of-sequence termination for the comparison.

A request is counted as meeting the SLO when TTFT is at most 2.0 seconds and its measured TPOT is at most 60 milliseconds. This threshold is a research choice, not an application-derived product requirement. An early suite version used 1.0 request/s for the light workload and 2.4 request/s for the heavy workload. After one trial, these proved unhelpful—the baseline was near saturation and batch 4 was near its steep queueing region—so the experiment was stopped, the rates were changed to 0.5 and 1.8, and the saved 60-run suite uses the replacement manifest. Record that decision as exploratory workload tuning: it was informed by observed performance. The subsequent five trials are useful evidence for the tuned workloads, but they are not a held-out, preregistered confirmation of an untouched design. A final comparative claim should freeze the design first and qualify on fresh seeds.

The reported statistics are the median and 90th percentile of TTFT, the median TPOT and end-to-end time, output tokens per elapsed window-second, and the fraction of requests satisfying both SLO components. TTFT is timed inside this single-process serving loop, not across a production network. The study does not report p99: with 24–54 measured requests, a 99th-percentile estimate is determined almost entirely by the one or two slowest observations and is unstable. It is not always literally the maximum—that depends on the percentile estimator. A benchmark report should state whether latency distributions are summarised per request or per run, the warm-up exclusions, window boundaries, zero/failure treatment, and whether requested versus actually generated tokens enter each denominator.

The statistics

What counts as a replicate. The analysis treats an entire workload–trial block as its unit: one newly drawn prompt-and-arrival sequence, run against every configuration. Individual requests within a run are dependent because they queue behind the same bursts and share the same execution state. The trials use different derived seeds, which supplies repeated arrival realisations, but that alone does not guarantee independence from the shared machine, time-of-day drift, sequential ordering or reused engine state. The paired comparison is therefore more defensible than resampling individual requests as independent observations, yet still limited to five blocks on one desktop. For final qualification, replicate blocks across independent sessions, capture machine state and consider block bootstrap or other dependence-aware analysis.

What counts as a pair. Within each trial the systems receive the same planned prompts, target lengths and arrival offsets. paired_summary subtracts the two trial-level summary metrics, constructs a Student-t interval for the mean paired difference, reports an interval for the geometric mean ratio by taking logs, calculates an exact sign-flip p-value, and gives a percentile bootstrap interval over the paired trials. These procedures answer different questions: the arithmetic mean difference measures a change in seconds or tokens/s; the geometric mean ratio measures a typical multiplicative change. For five nonzero pairs, a two-sided exact sign-flip enumeration has 32 assignments and its smallest attainable p-value is 2/32 = 0.0625, so it cannot reject at 0.05. The intervals are model-based summaries with just four degrees of freedom; they are not an escape from the small number of independent trials. A formal sign-flip inference also requires a justified sign-symmetry or randomisation assumption, not merely the existence of matched requests.

What constitutes a verdict. For a specified metric and a chosen primary effect scale, the current code labels a Student-t interval wholly on the favourable side of zero better, wholly on the unfavourable side worse, and one spanning zero no difference detected. If a symmetric equivalence margin was supplied and the interval lies inside it, it labels the comparison equivalent within a margin; fewer than five trials produce no verdict. This equivalence label is a useful descriptive rule but is not automatically a calibrated equivalence test: the margin must be predeclared on the same scale and the statistical procedure must be justified (for example, two one-sided tests with the appropriate confidence level). Five is a configured reporting threshold, not a sufficient sample size in general. Quality acceptance, multiplicity and test-family policy are not yet incorporated into this verdict function.

The scale was not frozen. The arithmetic difference treats a one-second increase identically no matter the original latency; a ratio treats a doubling similarly at different latency levels. Both may be worth reporting, but they are different estimands. The study chose its difference-scale interval before the run and introduced a separate log-ratio verdict after inspecting an early disagreement. That comparison must remain labelled post hoc and exploratory. Report the difference-scale rule as the primary analysis of these saved trials, the ratio as a sensitivity analysis, and freeze the choice of primary scale, family of metrics, desired effect and acceptable quality before a new confirmatory suite. Avoid selecting whichever scale gives a favourable story.

Results

For b4 versus b1, the table combines two different summaries across five paired trial blocks. Entries such as 1.16 s to 0.28 s are arithmetic means of the two systems’ per-trial medians; the quoted ratio 0.55 (0.10 to 2.91) is the geometric mean of five within-trial ratios and its t interval on log ratios. Their division need not equal the listed ratio: 0.28/1.16 is approximately 0.24, not 0.55. This is expected when trial latencies vary greatly, but the distinction must be named to prevent the table from appearing inconsistent. Percent changes in the later single-run table are a third, trial-by-trial view.

Metric Light Heavy Long
TTFT p50: mean of per-trial medians; geometric paired ratio (95% log-t interval) 1.16 s to 0.28 s; 0.55 (0.10 to 2.91) 14.9 s to 0.74 s; 0.05 (0.04 to 0.07) 18.2 s to 1.18 s; 0.07 (0.04 to 0.10)
End-to-end p50: same summaries 2.84 s to 1.87 s; 0.76 (0.45 to 1.28) 15.9 s to 1.61 s; 0.10 (0.08 to 0.13) 20.3 s to 3.35 s; 0.17 (0.12 to 0.24)
Output tokens/s: same summaries 13.9 to 14.4; 1.03 (0.98 to 1.09) 29.9 to 54.3; 1.81 (1.54 to 2.12) 29.4 to 49.3; 1.65 (1.27 to 2.14)
Share meeting both SLO components: mean shares; paired difference (95% t interval) 0.59 to 0.70; +0.11 (−0.19 to +0.41) 0.01 to 0.97; +0.96 (+0.92 to +1.01) 0.01 to 0.73; +0.73 (+0.67 to +0.79)
Primary difference-scale verdict, four metrics above No difference detected Better for b4 Better for b4

At heavy and long loads the batch-1 baseline is above its practical capacity for these requested output lengths, so batch 4 enjoys a clear advantage in this particular paired suite. This is not evidence that any batching system will dominate another at any heavy load. At light load, five short trial blocks include both pronounced improvements and regressions; the paired log-ratio interval crosses one, and the difference-scale intervals cross zero. The proper conclusion is that this suite was uninformative about a reliable light-load difference, not that the systems are equal. The heavy/long SLO-difference t intervals can exceed +1 (the heavy upper bound is +1.01) because an unconstrained normal/t interval is not restricted to the mathematical range of a share difference; that is a limitation of the approximation, not a physically attainable effect.

What one trial would have said. These are the minimum, mean and maximum within-trial percentage changes of b4 versus b1, each computed relative to its own baseline trial. They are not the geometric ratios in the preceding table or ratios of the five system means. A single trial can be useful diagnostically; it cannot establish an across-arrival-process effect from one draw.

Trial-level relative change in b4 versus b1 Light: min / mean / max Heavy: min / mean / max Long: min / mean / max
TTFT p50 −85%, +9%, +253% −97%, −95%, −93% −96%, −93%, −89%
End-to-end p50 −56%, −18%, +29% −92%, −90%, −87% −89%, −82%, −77%
Output tokens/s 0%, +3%, +10% +54%, +82%, +102% +30%, +68%, +129%

Light-load TTFT effects ranged from an 85% improvement to a 253% regression; one paired block even had the opposite sign to most others. Heavy and long comparisons consistently favoured b4 in these five observed blocks. The reported 472, 10 and 51 trials for a 10%-of-baseline TTFT difference are obtained by plugging the sample standard deviation of five paired differences into a t-interval half-width formula and asking for a future half-width of at most 10% of the observed baseline mean. They are precision-planning estimates, not power-based sample sizes and not statements that 10% will be detected. Statistical power additionally depends on an alternative effect, test procedure, type-I error, desired power and the future trial distribution; selecting among many metrics also needs a multiplicity policy. The half-widths currently observed are approximately 1.6, 2.5 and 8.0 seconds for the mean paired TTFT differences in light, heavy and long conditions, respectively. With only five trials, these planning numbers can move substantially when new trials arrive.

The A/A comparison

The A/A comparison: is the benchmark stable?

An A/A control compares two labels backed by the same system configuration, in this case b4 and b4-copy (identical parameter hashes, separate engine instances). Its expected systematic performance difference is zero under interchangeable conditions; sequential runs can still differ because of load, scheduling, clock changes or other run-state variation. The next table is the geometric mean of five paired b4-copy/b4 ratios and the corresponding log-t intervals. It characterises observed background variability for these workloads, not a universal noise floor or proof that the two labels’ execution environments are always interchangeable.

b4-copy / b4: geometric paired ratio (95% log-t interval) Light Heavy Long
TTFT p50 1.41 (0.40–4.97) 0.95 (0.76–1.18) 0.86 (0.62–1.19)
End-to-end p50 1.18 (0.68–2.03) 1.02 (0.93–1.11) 1.01 (0.84–1.20)
Output tokens/s 1.01 (0.97–1.04) 0.99 (0.98–1.01) 0.98 (0.96–1.01)

Across six metrics and three workloads, the 18 primary A/A comparisons reported no difference detected. The three ratio rows shown above all include one, but an A/A result that fails to find a difference is not evidence of equivalence. The intervals indicate how uncertain those five-block estimates are: light-load TTFT spans approximately 0.40 to 4.97, while heavy-load TTFT spans 0.76 to 1.18. Calling these widths a universal minimum detectable effect would require a pre-specified power calculation and a larger replication study. In one illustrative light-load block, identical configurations had median TTFTs of 0.31 s and 1.41 s and substantially different SLO attainment. The practical lesson is to qualify the benchmark against its own A/A variability before trusting a small claimed improvement.

Pseudo-replication, observed rather than calibrated. For each of 15 A/A blocks, the script formed a paired vector of per-request TTFT differences and bootstrapped its mean while treating those requests as independent. Eight resulting percentile intervals excluded zero (four light, two heavy and two long). At the trial level, a t interval across the five mean differences in each workload excluded zero for none of the three workloads. A queue induces serially dependent waits, so resampling individual requests is not a valid substitute for fresh trial blocks. The 8/15 count is not a 53% estimate of the long-run false-positive probability of a nominal 5% procedure: the comparisons come from one suite, are not independent across all design choices and do not form a repeated null calibration. To estimate false-positive coverage, rerun many independent A/A suites, preserving the whole block and collection protocol as the resampling unit. This distinction strengthens the negative lesson without claiming more than the evidence demonstrates.

A rule decided before the data

The third configuration, b4w, permits the batch-4 server to wait up to 0.3 seconds for more requests. On the light workload it increased the arithmetic mean of per-trial median TTFT from 0.28 to 0.89 seconds. All five paired log ratios favoured b4 over b4w; their geometric mean was 3.11, with a log-t interval of 1.44–6.69. But the preselected absolute-difference analysis estimated +0.62 seconds with a t interval of −0.09 to +1.31, which does not exclude zero. The exact two-sided sign-flip result was 0.0625. Thus the difference-scale primary verdict is no difference detected, while the ratio-scale result is a post hoc exploratory indication of a multiplicative penalty. Heavy and long workload ratios were 1.15 (0.87–1.52) and 1.15 (0.95–1.39), with throughput around 0.99 and 0.98 times the plain b4 configuration in this suite. None of these comparisons independently validates an unconditional cost of a fixed 0.3-second hold.

The tension between absolute and relative effects is a design finding, not permission to choose whichever inference looks stronger. If the product requirement is a maximum added TTFT of 0.3 seconds, an absolute-scale test and a predeclared equivalence or non-inferiority margin make sense. If the requirement is percentage latency, choose the log-ratio scale before collecting the confirmation data. In this chapter the primary difference rule was chosen before the suite; the ratio rule was added after inspecting an early disagreement. Both results belong in the report, with the latter explicitly labelled exploratory. The next qualification should freeze an effect scale, a family of primary metrics, false-positive controls and a quality threshold before running held-out seeds.

The quality gate

The quality gate

A benchmark must measure the quality of what it accelerates. This suite compared generated token IDs request by request with the b1 baseline; mean exact-token agreement over five trials ranged from 94.7% to 100%, depending on system and workload. For b4 it was 100% on light, approximately 98.9% on heavy and 95.3% on long. These divergences are compatible with Chapter 39’s batch-shape sensitivity, but this suite does not prove batch shape caused every difference. More importantly, the comparison is a diagnostic, not an enforced quality gate: quality() reports agreement, whereas paired_summary() can still label a system faster when some outputs differ. Exact-token agreement is not semantic or factual correctness; a different token string can be equivalent, and identical errors remain errors. Production qualification should state an independent task-level quality metric and an acceptable non-inferiority margin, validate identical request IDs and expected outputs, and refuse to rank speed until that criterion is met. MLPerf’s Closed division constrains model identity for comparability; it does not turn this suite’s token-identity proxy into an MLPerf-style accuracy test.

Order and drift

The four systems were shuffled within each workload–trial block. The saved position analysis reported mean relative deviations in median TTFT of +0.4%, −14.0%, +7.6% and +6.0% across positions 1–4. Those descriptive aggregates contain only 15 runs per position and do not adjust for every interaction between workload, system, time and background state. They neither demonstrate nor rule out a causal order effect. Randomisation reduces systematic confounding but is not a substitute for balanced ordering, repeated blocks across sessions, GPU clock/temperature logging or thermal reset checks. When the expected effect is small, a sequence-dependent drift can be of the same magnitude as the supposed improvement.

What the sources do

External sources provide useful design analogues, not additional results from this GPU. MLCommons’ MLPerf Inference v6.1 publishes workloads with defined scenarios, model-quality requirements, load-generation rules and system disclosures; its Closed and Open divisions answer different comparison questions. Its exact compliance and quality rules are the authority for MLPerf claims, and no MLPerf workload or submission was run here. The current vLLM benchmark documentation distinguishes client-observed TTFT, ITL and TPOT and warns that repeated requests can exploit prefix caches left warm from previous benchmark calls; its advice is to vary seeds or reset caches when studying uncached throughput. The local Engine does not retain a reusable cross-request prefix cache, so that particular hazard is outside the experiment, but the general lesson—freeze or measure cache state—remains. DeepInfer’s pinned benchmark guide describes measurement windows and JSONL reporting, with its own profiler overhead observations; none were reproduced here. Hoefler and Belli’s SC15 paper critiques performance claims confounded by measurement noise. Complementary work by Bouthillier et al. (MLSys 2021), Henderson et al. (AAAI 2018) and Colas et al. (2018) addresses benchmark variance, reproducibility and power. These references justify the questions the lab asks; only the saved local suite supports its quantitative results.

What the numbers do not show

Small, selected workloads. Each trial comprises only 24, 30 or 54 measured requests, with short prompts and requested outputs, and the rate choices were tuned after a preliminary run. The light workload did not resolve the b4/b1 difference; larger request counts per independent trial might reduce within-run noise, but could also change queueing and does not automatically replace more independent trials. The study does not quantify how the conclusions generalise to different prompt mixes, service-level targets, context lengths or production arrivals.

Five trial blocks, not an adequate universal sample size. Primary t intervals rely on five paired block-level values and approximate normality of their mean; the sign-flip enumeration cannot give a two-sided p-value below 0.0625 in that sample. Both the variability estimates and the projected trial counts are unstable. The study did not pre-register an inference family, power target or multiplicity correction, and the final workload specification was chosen after an exploratory run. Independent held-out repeats are required for a confirmation-grade claim.

One shared machine and sequential runs. The study uses one RTX 2060, one driver and software stack, and a desktop with other workloads. Within-block order is randomised; session-to-session drift, thermals, operating-system scheduling and long-term environment variation were not independently quantified. A machine manifest records settings, not the instantaneous performance state of the accelerator.

One serving implementation, four configurations. The benchmark changes batch limit and batch-fill wait in Chapter 36’s manual static-batching loop. b4-copy is a separate instance of the same configuration, not an independent codebase. No result in this chapter establishes that these findings carry over to vLLM, SGLang, TensorRT-LLM or a distributed deployment. Any future engine comparison needs matched model/tokeniser settings, verified work conservation and admission rules, and a semantic-quality gate.

No cache, closed-loop control, long context or failure stress. The study uses open-loop Poisson arrivals and short context/output specifications; it does not exercise persisted prefix-cache reuse, production network streaming, disconnections, partial failures, retries, tool calls or multiple GPUs. The absence of a reusable cache in this server does not demonstrate that a different engine’s cache can be ignored. Quality under load and admission behaviour should be tested separately from throughput.

Exact token agreement is not correctness. The current quality() function measures identical generated token sequences to the baseline on matching request IDs, and reports disagreements. It does not judge semantic equivalence, factual correctness, valid structured output, safety policy or task success; nor is its result required by the speed-comparison functions before they issue a verdict. A real quality gate must specify a graded task corpus, a tolerance/non-inferiority rule, evaluation provenance and a failure status that prevents performance promotion when the task-quality standard is not met.

Inference Lab increment

examples/ch40/bench_core.py defines WorkloadSpec, workload-manifest hashing, per-trial request digests, SystemConfig, a randomised blocked schedule, JSONL record shape checks, Student-t intervals, exact sign-flip enumeration, trial bootstrap, geometric mean ratios and the primary verdict function. Its minimum_detectable_difference field is currently the observed t-interval half-width, not a power-based minimum detectable effect. Its record validation checks required fields, not full causal comparability or semantic correctness. These two implementation gaps should be corrected or explicitly renamed before the chapter becomes a gate for the capstone.

examples/ch40/bench_lab.py provides the three reproducibly generated Poisson workloads, the four static-batching configurations, request and completion summaries, manifest command and recorded execution schedule. It reuses Chapter 36’s server and Chapter 39’s environment manifest, warms the engines and writes each run as a JSON line. The measured evidence is the saved 60-run suite; the implementation has not been extended in this editorial revision to enforce a fresh-run output directory, full-run completeness, independent run state, manifest/commit binding or a hard quality gate.

examples/ch40/bench_analysis.py computes paired comparisons, single-trial sensitivity, the A/A diagnostic, token identity, environment/workload checks, order summaries and interval-precision projections. In the current code comparisons() groups run records and passes summary arrays to paired_summary(); comparability_checks() is a separate report, rather than a prerequisite the comparison refuses to bypass. The next implementation should fail closed on incomplete blocks, duplicate trial records, mismatched request digests, workload/configuration drift, impossible event sequences and failed quality checks. A report should include the primary effect scale, trial count, observed confidence interval, predeclared margin, multiplicity family and exploratory/confirmatory status.

To rebuild the published summaries from the frozen suite artifacts (without running the GPU):

python research/ch40/build_results.py

To reproduce the procedure on a suitable local CUDA machine, first preserve the current manifest and raw data, then run into a new output path. The CLI defaults to appending JSON lines and does not itself ensure that an existing file is empty; rerunning into the same path could create duplicate trial records and make by_cell() silently retain one of them. The following is the original command for the suite, not a guarantee of identical hardware results:

python examples/ch40/bench_lab.py run

The lab’s reusable rule is: state a workload and task-quality target first; freeze the implementation, manifest and chosen primary statistic; run matched requests in independently repeated and randomised blocks; retain raw per-request traces; expose A/A variation; report uncertainty at the correct unit; distinguish an interval-width precision estimate from a power calculation; and refuse a performance recommendation if comparability or quality has not passed. A measured gain is about a particular workload and SLO, not a timeless property of a batch size. For Chapter 41, implement the refusal checks in code before using these numbers to choose an engine or advertise a speedup.

What you should now be able to do

  • Specify the population of requests, offered-load process, output distribution, SLO and exact observation points before comparing systems.
  • Hash and preserve workload definitions, generated request digests, source revision, model/tokeniser assets, configuration values and complete raw results.
  • Explain why one independent trial block, not one queued request, is the relevant replicate for this analysis, and show how an A/A control detects an unsuitable resampling method.
  • Design a paired blocked schedule and distinguish the variation it controls from drift, persistent state and the effects of sequential execution it does not.
  • Read a Student-t interval on trial differences, a log-ratio interval and an exact sign-flip result without treating them as interchangeable decisions.
  • Distinguish a confidence-interval half-width from a statistical-power-based minimum detectable effect; use the latter only after specifying power and an effect size.
  • Explain why a non-significant comparison is not evidence of equivalence, and how a predeclared equivalence margin is tested.
  • Check output identity and independent task quality before crediting throughput, and label exploratory choices and held-out confirmation separately.

Key terms

  • Workload manifest: the versioned, content-hashed specification of planned prompts, arrivals, output lengths, cache state and SLOs; it is not the same thing as the runtime record.
  • Trial (block): a generated arrival-and-request realisation on which all systems are run; the principal replication unit here.
  • Paired comparison: a system contrast on the same workload realisation, using one difference or ratio per independent block.
  • A/A control: an identically configured comparison used to characterise measured run-to-run variability, not to prove that any individual run is noiseless.
  • Request digest: a hash of the planned requests and offsets, used to check pairing; it does not attest execution state.
  • Confidence-interval half-width: a measure of the precision of an estimated mean under statistical assumptions.
  • Minimum detectable effect: a pre-specified effect magnitude an experiment is powered to detect at chosen error rates; not necessarily the interval half-width.
  • Equivalence margin: a predeclared range of effects treated as practically negligible, tested on a specified scale.
  • Pseudo-replication: treating dependent observations as independent replicates, which can produce misleadingly narrow intervals.
  • Quality gate: an enforced condition that blocks promotion when the new system has not met a task-level quality requirement; reporting token agreement alone is not this gate.
  • Exploratory versus confirmatory: whether effect scales, workloads and hypotheses were adapted after viewing outcomes or frozen before an independent qualification run.

Reader exercises

  1. Run a fresh, independent 30-block light-workload suite with a frozen effect scale. Compare the resulting block-level interval with the five-block interval; do not interpret the earlier 472-trial precision projection as guaranteed detection power.
  2. Add a closed-loop workload and clearly define offered and achieved throughput, then check whether the A/A differences change.
  3. Predeclare an absolute TTFT effect and a 10% ratio effect, the desired power and a family of primary metrics; compute a sample size for each and compare it with the current interval-width estimate.
  4. Add a prefix cache, vary the requests’ shared prefixes and cache state, and demonstrate the warm-cache confound discussed in the vLLM documentation.
  5. Define an equivalence margin before collecting new blocks and implement a correctly calibrated equivalence test, rather than deciding equivalence from a non-significant difference.
  6. Compare a block bootstrap with the current t interval on paired trials; independently repeat the entire A/A suite enough times to estimate coverage under a null.
  7. Add Chapter 37’s cost model to the benchmark and report cost per correct output with transparent energy and financial assumptions.
  8. Make comparisons() refuse mismatched request digests, duplicate/missing trial blocks, incomplete configuration, invalid timestamp ordering or an unmet semantic-quality target. Write regression tests showing each refusal.
  9. Run identical configuration blocks on separate days, record GPU power/clocks/temperature and compare between-day variation with within-block variation.
  10. Repeat the benchmark on a second engine using the same model/tokeniser and a held-out workload, with quality non-inferiority as a prerequisite for a speed ranking.

References

Evidence in this chapter

Claim Category and qualification
On the light workload b4/b1 TTFT geometric paired ratio was 0.55 (95% interval 0.10–2.91), and individual paired trials ranged from −85% to +253% Book result: five local blocks, 24 measured requests each; no reliable light-load difference established
On heavy and long workloads b4/b1 TTFT ratios were approximately 0.05 and 0.07; throughput ratios approximately 1.81 and 1.65 Book result for the two selected workloads; baseline overloaded; not an engine-independent speedup
b4 and b4-copy gave no detected difference across 18 A/A comparisons Book result: failure to detect a difference, not proof of equivalence or calibrated false-positive control
Request-resampling A/A intervals excluded zero in 8/15 blocks; trial-level intervals in 0/3 workloads Book diagnostic of pseudo-replication in this suite; 8/15 is not a long-run Type I error estimate
A light-load b4w/b4 log-ratio interval favoured plain b4, while the preselected absolute-difference interval crossed zero Book result, with the log-ratio verdict added after initial inspection
Projected 472, 10 and 51 TTFT trials for a 10%-of-baseline target Derived precision-planning estimates from five paired differences; not power calculations
Exact token agreement with b1 was approximately 95–100% Book result: token-identity diagnostic; semantic/task quality was not tested and no hard quality gate enforced
A manifest, request digest and block schedule were recorded Book implementation evidence; result validation does not yet enforce all cross-record comparability checks
MLPerf scenario/quality disciplines, vLLM cache warning, DeepInfer benchmark practice, Hoefler–Belli and variance/power research Externally reported; none of the external serving engines or research experiments was reproduced
A second inference engine, cache reuse, network serving, independent held-out confirmation, production task accuracy, power or paid spend NOT_RUN

Implementation status

  • Manuscript: content/books/inference/40-chapter.md (editorially revised from the uploaded original; not yet applied to the GitHub working tree).
  • Examples: examples/ch40/benchmark.py (unchanged starter), examples/ch40/bench_core.py (manifests, run records, intervals, paired summaries), examples/ch40/bench_lab.py (static-batching suite) and examples/ch40/bench_analysis.py (paired results, A/A, diagnostics).
  • Tests: tests/test_ch40_benchmark.py (starter) and tests/test_ch40_benchmark_lab.py (31 existing tests, as reported by the project: statistics, manifest/configuration validation, basic result schema, schedule, A/A, quality reporting and comparisons). Editorial changes do not add or execute tests.
  • Frozen evidence: research/ch40/sources.md, research/ch40/workloads.json, research/ch40/results.json, research/ch40/raw/results.jsonl.gz, research/ch40/build_results.py and research/evidence-register.md.
  • Rebuild saved analysis: python research/ch40/build_results.py. Full test invocation: python -m unittest discover -s tests -v.
  • Priority code gates before a capstone performance claim: (1) require suite/workload manifest identity and source revision; (2) reject incomplete or duplicate blocks and mismatched paired requests; (3) validate per-request timing and recompute summaries; (4) rename the interval half-width and add a true power analysis; (5) predefine metric scales/margins; (6) require held-out semantic/task-quality acceptance before ranking speed.

This chapter is a documented local benchmark demonstration, not a production throughput ranking, a formal equivalence result or an MLPerf submission. It establishes that workload selection and unit-of-replication choice changed what this small suite could conclude. The next step is to implement the currently descriptive checks as fail-closed qualification gates and repeat a frozen design on held-out blocks. Only then should Chapter 41 treat the resulting performance comparison as decision-grade evidence.