Skip to main content

Accuracy & Validation

How Closely MLSys·im Predictions Match Real Hardware

MLSys·im is a first-order analytical model. It predicts performance from closed-form equations, not from cycle-accurate simulation or empirical measurement. This page documents where those predictions are accurate, where they diverge, and what drives the gap.

NoteWhat “first-order” means

A first-order model captures the dominant system behavior without modeling second-order effects such as cache hierarchy dynamics, memory fragmentation, NIC DMA contention, or driver overhead. Trust MLSys·im for bottleneck classification and relative comparisons. Absolute latency scales linearly with the caller-supplied efficiency \(\eta\) (see the calibrated benchmark anchors below), while production serving adds scheduler and paging overhead above idealized roofline bounds. Use MLSys·im to reason about bottlenecks and compare configurations, not to sign production SLA contracts.

For the formal treatment of roofline modeling and arithmetic intensity, see Vol I · Ch 11: Hardware Acceleration (Study sheet · Slides).


Design Philosophy

MLSys·im follows the same trade-off that Hennessy & Patterson’s MIPS simulator made for computer architecture: give up cycle accuracy to cover more kinds of system and to run faster. A gem5 simulation of a single LLaMA-70B inference step can take hours; MLSys·im solves it in milliseconds. The goal is not to replace empirical benchmarks but to enable rapid, principled reasoning about system design trade-offs before committing to expensive experiments.

This philosophy maps directly to the core analytical models in the Math Foundations page. Each model implements a specific approximation grounded in published research, with a characterized accuracy envelope documented below.


Validation Hardening Checklist

The implementation now enforces strict precision names, explicit unit-family validation, and exact distributed topology divisibility before solver math runs. The remaining validation work is about evidence quality rather than basic input safety:

  1. Golden textbook examples. Preserve representative chapter calculations as small, named regression tests with expected values and tolerances. This catches drift when formulas or registry specs change.
  2. Formula-by-formula solver review. For each solver, document the source equation, assumptions, units, and calibration constants next to a focused test fixture. Start with DistributedModel, ServingModel, TrainingMemoryModel, EconomicsModel, and SustainabilityModel.
  3. Registry provenance audit. Check every hardware, model, system, and infrastructure entry for source URL, SKU/variant specificity, verified date, and whether the value is measured, estimated, illustrative, or conventional.
  4. Empirical calibration refresh. Re-run the benchmark comparisons in empirical-calibration.md against current registry values and current published benchmark reports. Published benchmark scalar values live in Literature.Benchmarks; the code contract for reviewed sanity ranges lives in mlsysim.engine.empirical.
  5. Property and edge-case tests. Add invariants such as monotonic memory growth with sequence length, non-increasing feasible batch size with model size, non-negative latency components, and stable unit conversions across SI/binary byte units.
  6. CLI plan semantics cleanup. hardware.accelerators is the total accelerator count. Use node_count plus accelerators_per_node when the physical topology matters.
  7. Solver module decomposition. Solver implementations now live in engine/solvers/ by domain, while mlsysim.solvers is the stable public import path; the export list derives mechanically from engine/solvers/__init__.py, so the two cannot drift.

The Accuracy Hierarchy

MLSys·im predictions differ in how far they can be trusted. The table below ranks prediction types from most to least accurate.

Prediction Type Fidelity Scope Why
KV-cache sizing Exact (definitional) Definitional tensor byte formula, not approximated
Checkpoint sizing Exact (definitional) Direct calculation: \(N \times \text{bytes\_per\_param}\)
Training memory components Exact for state tensors; analytical for activations Weights, gradients, and optimizer states are direct byte counts; activation memory follows checkpointing coefficients
Bottleneck classification (compute vs. memory) Structural (away from \(I^*_{\text{eff}}\)) Determined by workload arithmetic intensity vs. the effective hardware ridge point \(\eta \cdot \text{Peak} / \text{BW}\)
Relative configuration ranking (which config is faster?) Order-preserving on shared hardware Shared constant-factor overheads cancel when comparing configurations on the same device
Scaling efficiency direction (how does MFU change with DP/TP/PP?) Analytical lower-bound cost Collective and pipeline models bound communication/bubble time; overlap and congestion shift absolute MFU
Single-node throughput (absolute latency) Linear in supplied \(\eta\) (see calibrated anchors below) Directly proportional to the caller-supplied efficiency parameter \(\eta\)
Serving replica count Analytical capacity + M/M/c bound Composes roofline, paged KV capacity, and M/M/c queueing; validate production SLAs empirically
TCO and carbon estimates Linear in supplied PUE, grid CI, and tariff Dominated by facility PUE, regional carbon intensity, and hardware depreciation inputs
ITL in production serving Optimistic roofline floor Omits KV-cache page-table indirection, scheduler jitter, and dequantization kernel overhead
TipThe golden rule

Trust MLSys·im for direction and classification. Be cautious with absolute numbers. The model identifies which resource is the bottleneck and which configuration is better. It does not promise the exact millisecond.


Validation Against Published Benchmarks

The table below compares MLSys·im solver predictions against the published benchmark anchors in Literature.Benchmarks and mlsysim.engine.empirical.

Workload Hardware Predicted Measured Error Source
ResNet-50 Train (BS=256) NVIDIA A100 3,297 img/s 3,200 img/s +3.0% NVIDIA DeepLearningExamples
ResNet-50 Train (BS=256) NVIDIA H100 5,225 img/s 5,000 img/s +4.5% MLPerf Training v3.1
ResNet-50 Inf (INT8, BS=256) NVIDIA H100 120,105 img/s 89,470 img/s +34.2% MLPerf Inference v5.0
Llama-3 8B ITL (BS=1, 2K ctx) NVIDIA H100 4.9 ms/tok 3--10 ms/tok within band NVIDIA NIM / TensorRT-LLM
GPT-3 175B Training FLOPs 6PD rule 3.15e+23 3.14e+23 +0.3% Brown et al. (2020)
WarningITL underprediction is expected

MLSys·im predicts the roofline lower bound for inter-token latency (for example 4.9 ms/tok at batch 1 and 7.4 ms/tok at batch 32 on H100). It does not model quantization kernel overhead, KV-cache paging latency (PagedAttention), or batch scheduling overhead in production serving systems. Real ITL is typically 1.5–2× the roofline bound. Use ITL predictions as the theoretical floor, not as a production estimate.

For the full treatment of serving-system overheads (continuous batching, PagedAttention, SLO compliance), see Vol II · Ch 10: Serving at Scale (Study sheet · Slides).

Interpreting the error column

All errors are relative to the measured value: \(\text{Error} = (\text{Predicted} - \text{Measured}) / \text{Measured}\). For latency, a positive error means MLSys·im overpredicts latency (conservative), and a negative error means it underpredicts (optimistic). Overprediction on latency is safer for capacity planning; underprediction is dangerous for SLA commitments.


Where MLSys·im is Most Accurate

Bottleneck classification (roofline)

The model is most reliable for determining which resource limits performance. When a workload sits well away from the effective crossover intensity \(I^*_{\text{eff}}(\eta) = \eta \cdot \text{Peak} / \text{BW}\), classifying it as memory-bound vs. compute-bound is structurally robust even if exact latency differs.

The underlying roofline model is documented in the Hardware Acceleration slides (Vol I, Ch 11) and applied to H100 workloads in the Compute Infrastructure slides (Vol II, Ch 2).

Scaling efficiency direction (distributed training)

The model predicts how scaling efficiency shifts as the DP/TP/PP configuration varies. Relative configuration rankings remain informative even when overlap or congestion shifts absolute MFU, because Ring AllReduce implements the bandwidth-optimal collective lower bound of Patarasuk & Yuan (2009) while Tree AllReduce captures the logarithmic-startup regime for small messages.

See the Distributed Training slides (Vol II, Ch 6) for the 3D parallelism framework and scaling efficiency analysis.

KV-cache and checkpoint sizing

The KV-cache formula (\(\text{KV} = 2 \times L \times H_{\text{kv}} \times d_{\text{head}} \times S \times B \times \text{bpe}\)) is definitional, not approximated. It computes the exact number of bytes the K and V tensors occupy. Similarly, checkpoint sizing (\(N \times \text{bytes\_per\_param}\)) is a direct count. Memory feasibility checks (feasible: True/False) are accurate because they compare against the same HBM capacity reported in manufacturer datasheets.

Training memory breakdown

TrainingMemoryModel separates weights, gradients, optimizer state, activations, and communication buffers. The first three terms are direct byte counts from the model size, precision, optimizer, and ZeRO stage. Activations are the approximate term: they depend on the selected checkpointing strategy and use coefficients from transformer activation-recomputation analysis [1]. Treat the model as a memory feasibility and attribution tool: it identifies which term is responsible for pressure, and empirical framework profiling can then refine the activation term for a specific implementation.

Serving capacity planning

ServingCapacityModel is a composition model. It uses ServingModel for TTFT/ITL, ContinuousBatchingModel for per-replica token capacity, and TailLatencyModel for queueing pressure. This is useful for first-pass sizing and sensitivity sweeps: if QPS doubles, or generated length doubles, the model shows how many replicas are implied. Capacity depends on the request-length assumption. By default every request fills max_seq_len, the conservative case; passing mean_request_tokens sizes paged allocation for a workload of shorter, exponentially distributed requests (KV Allocation and Batch Capacity). Do not use the result as a production SLA guarantee. Production serving must still be validated with the target scheduler, traffic mix, batching policy, and percentile measurement.

MoE routing imbalance

MoERoutingModel captures a single effect: hot experts make a top-k MoE behave as though more experts are active, increasing effective active parameters and expert-parallel all-to-all traffic. The routing_imbalance_factor is intentionally exposed. Use 1.0 for balanced routing, then sweep higher values to understand sensitivity. A real router’s load distribution should be measured from token counts per expert and fed back into this parameter.

Carbon and TCO estimates

Sustainability and economics estimates are usually dominated by a few explicit assumptions: PUE, energy price, regional carbon intensity, cluster occupancy, and amortization period. The main source of error is often the assumed PUE (power usage effectiveness), which varies from ~1.12 (hyperscaler) to ~1.58 (coal-region enterprise). The carbon accounting methodology aligns with the lifecycle framework in the Sustainable AI slides (Vol II, Ch 15).


Where MLSys·im Diverges From Measurement

Source of Divergence Direction / Mechanism When It Matters
efficiency=0.5 default Scales compute time as \(1/\eta\) Any compute-bound roofline prediction
No general L1/L2 cache model Absorbed into \(\eta\) (except FlashAttention SRAM IO) Small batches (1–4) and cache-resident models
No NVLink contention model Optimistic collective bandwidth Cross-switch tensor parallelism (TP > 4)
Standard GPipe / 1F1B bubble Conservative vs. zero-bubble schedules Interleaved or zero-bubble pipeline runtimes
No dequantization kernel tax Optimistic W4A16 / INT8 latency floor Weight-only quantized serving
Contiguous vs. paged KV waste 61.8–79.6% unused reservation in contiguous pre-allocation [2] Comparing static reservation against PagedAttention

The efficiency parameter (η)

MLSys·im uses efficiency (η, default 0.5) as a single scalar representing the sustained fraction of peak hardware throughput. This is the primary caller-controlled input for absolute latency. The table below summarizes starting-point bands used in modeling examples.

Workload Type Starting-Point η Band Provenance / Scope
Training (fp16/bf16, Megatron-LM / PaLM) 0.30--0.50 Cited in Literature.Training (MfuLow–MfuHigh): Shoeybi et al. (2019), Chowdhery et al. (2022)
Inference (fp16, batched serving) 0.25--0.40 Upper bound from Literature.Training.MfuInferenceBatched (Pope et al., 2023)
Inference (int8, quantized) 0.20–0.40 Illustrative modeling range (measure on target kernel)
Edge inference (TFLite, ONNX RT) 0.15–0.30 Illustrative MCU/edge modeling range (measure on target runtime)

The default efficiency=0.5 (0.5) models a well-optimized training job on datacenter hardware (sustained reference MFU is 0.40). For inference, pass efficiency=0.35 for more conservative estimates. For edge devices, use efficiency=0.2. All solvers whose compute term depends on η expose it as a parameter; defaults are starting points from the literature and benchmarks, not hidden constants.

Cross-check η against cited bands in the Literature Zoo (Literature.Training.MfuHigh, Literature.Training.MfuInferenceBatched) and engine knobs in mlsysim.engine.calibration.REFERENCE_MFU_SUSTAINED.

For a rigorous treatment of precision engineering and its impact on performance, see the Performance Engineering slides (Vol II, Ch 9).

What is not modeled

MLSys·im deliberately omits the following effects. Each omission is a design decision, not an oversight:

  1. General L1/L2 cache hierarchy behavior. While EfficiencyModel explicitly computes the Dao et al. (2022) SRAM tiling IO-complexity ceiling for FlashAttention, general L1/L2 cache hit dynamics across arbitrary non-attention kernels can materially shift small-batch latency and remain absorbed into \(\eta\).

  2. NVLink contention under tensor parallelism. Within a single NVSwitch domain, point-to-point bandwidth is symmetric; across multi-switch or inter-node boundaries, fabric contention adds overhead that idealized link bandwidth does not capture.

  3. Pipeline schedule variants. MLSys·im implements the standard GPipe / 1F1B bubble formula: \(\text{bubble} = (P - 1) / (V \cdot M + P - 1)\). Zero-bubble schedules can reduce pipeline stalls beyond what the standard formula predicts.

  4. Weight-only dequantization kernel overhead. HardwareNode.compute.precision_flops models distinct Tensor Core peak throughput per precision (FP32, TF32, FP16, FP8, INT8) and CompressionModel accounts for group-quantization scale metadata (e.g., 4.125 bits/weight at group_size=128). However, software dequantization overhead in weight-only W4A16 kernels (where weights load in INT4 but matmuls run in FP16) remains absorbed into \(\eta\).

  5. KV allocation dynamics. ServingModel sizes the KV cache densely for a known sequence length. ContinuousBatchingModel compares max-length reservation with paged allocation under an assumed exponential request-length distribution, sized at peak occupancy. It does not model how reserved slots fill over a request’s lifetime, external fragmentation in exact-size or power-of-two contiguous allocators, preemption and swapping, or paged-attention kernel latency. Kwon et al. measure 96.3% of vLLM’s KV memory holding token states, against 20.4% to 38.2% for contiguous pre-allocation [2].


When to Use MLSys·im (and When Not To)

  • Comparing hardware for a known workload (“H100 vs. MI300X for Llama-3 70B?”)
  • Choosing parallelism strategy (“DP=8 or TP=4×PP=2?”)
  • Estimating memory feasibility (“Does Llama-3 405B fit in 8×H100 HBM at FP16?”)
  • Budgeting TCO and carbon before procurement decisions
  • Teaching the Iron Law, roofline model, and systems reasoning
  • Rapid prototyping system designs before committing to cluster time
  • Production SLA guarantees (use empirical benchmarks instead)
  • Kernel-level optimization (use PyTorch Profiler or NSight Compute)
  • Quantized model accuracy (MLSys·im models throughput, not model quality)
  • Exact millisecond SLA contracts without empirical validation on target hardware
  • Novel hardware with no published specs in the Silicon Zoo

Curriculum Reference

The theory behind MLSys·im’s analytical models is covered across canonical textbook chapters, study sheets, and lecture decks (see the Cross-Volume Textbook Map for all chapters).

Validation Domain MLSys·im Solver Textbook · Study Sheet · Slides
Roofline model, arithmetic intensity, bottleneck classification SingleNodeModel Vol I · Ch 11: Hardware Acceleration (Study sheet · Slides)
Statistical rigor, MLPerf methodology, benchmark anti-patterns All solvers Vol I · Ch 12: Benchmarking (Study sheet · Slides)
H100 roofline landscape, GPU specs, TCO analysis SingleNodeModel, EconomicsModel Vol II · Ch 2: Compute Infrastructure (Study sheet · Slides)
4D parallelism, scaling efficiency, communication overhead DistributedModel Vol II · Ch 6: Distributed Training (Study sheet · Slides)
Serving latency, KV-cache, continuous batching, SLO compliance ServingModel, ServingCapacityModel Vol II · Ch 10: Serving at Scale (Study sheet · Slides)
Precision engineering, operator fusion, FlashAttention SRAM IO SingleNodeModel, EfficiencyModel Vol II · Ch 9: Fleet Efficiency (Study sheet · Slides)
Energy, carbon lifecycle, PUE, WUE SustainabilityModel Vol II · Ch 15: Sustainable AI (Study sheet · Slides)

Citing Sources

The hardware specifications in the Silicon Zoo are sourced from official manufacturer datasheets. See metadata.provenance on each YAML entry under mlsysim/hardware/data/*/*.yaml (and shared citations in mlsysim/core/provenance_catalog.py) for the primary source document and verification date.

For the MLPerf comparison data on this page, see Literature.Benchmarks (mlsysim/literature/data/benchmarks.yaml), citing MLPerf Training v3.1 and MLPerf Inference v5.0 Datacenter Results (MLCommons).


To report a significant discrepancy between MLSys·im predictions and measured hardware results, open an issue with the workload, hardware, and measured numbers. Discrepancies often reveal bugs or missing constants in the model.

Back to top

References

[1]
V. A. Korthikanti et al., “Reducing activation recomputation in large transformer models,” Proceedings of Machine Learning and Systems, vol. 5, 2023, Available: https://proceedings.mlsys.org/paper_files/paper/2023/hash/80083951326cf5b35e5100260d64ed81-Abstract-mlsys2023.html
[2]
W. Kwon et al., “Efficient memory management for large language model serving with PagedAttention,” in Proceedings of the 29th symposium on operating systems principles, ACM, 2023, pp. 611–626. doi: 10.1145/3600006.3613165.