Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Choosing a car
A faster car costs more to buy and to run, and each extra bit of speed costs more than the last. A delivery company picks its vans by how much a faster delivery is worth to its customers, how many deliveries it makes, and the speed limits it must respect, not by the fastest van on the market. Choosing a model is the same: the best model is the one whose extra accuracy is worth its extra cost and still meets the latency limit.
Most profitable: width 128, profit $39.30 per million requests. Raise the value of accuracy and the choice moves up the curve; tighten the latency objective and it moves down.
In Exercise 2, width 512 cost four times as much as width 128 and gained only 2.3 points of accuracy; when a million correct predictions were worth $5, width 8 was the best choice, at $5,000 width 512, and with a 4 ms latency objective width 128.
- 1. Larger models usually…
- 2. The right model size depends on…
- 3. A latency objective can rule out…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Operating point: a configuration (model, precision, hardware) with its accuracy, latency and cost.
- Pareto frontier: the configurations not dominated by any other that is at least as good in every objective and better in one.
- Diminishing returns: accuracy grows roughly logarithmically or as a power law in model size, data and compute (scaling laws).
- Value model: profit per request = value of a correct prediction × accuracy − serving cost; constraints such as a p99 objective cut the feasible set.
- Efficiency techniques: reduced precision (float16, int8), distillation (training a small student on a large teacher’s outputs), pruning, and caching and cascades (topic N4-4).
- Total cost of ownership: training and retraining, serving, engineering and monitoring; their balance changes with traffic.
- Compute-optimal training: for a fixed training budget, balance data and model size.
- 1. A configuration is Pareto-optimal when…
- 2. Distillation trains a small model on…
- 3. Total cost of ownership includes…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A family of models
Exercise 1.
- Task: a nonlinear binary problem in 10 dimensions with 5% label noise; 3,000 training and 4,000 test examples.
- Models: random Fourier features of width 4 to 512 with a ridge-regression readout, trained in closed form.
- Each request scores 4,000 candidates; operations per example 32 × width.
- Hardware model: 20 GFLOP/s effective on a $2.50 per hour GPU at 60% utilisation; p99 latency = 1 ms + twice the compute time.
Practice.
- Plot the frontier of accuracy against latency and cost before choosing a model.
- Put a value on accuracy, even a rough one, and include training and maintenance in the cost.
- Try efficiency techniques first: reduced precision and distillation often move the whole frontier.
- Respect the latency objective at the tail, not the mean.
- Revisit the choice when traffic, prices or the value of accuracy change.
def choose(models, value, slo_ms):
feasible = [m for m in models if m.p99_ms <= slo_ms]
return max(feasible, key=lambda m: value * m.accuracy - m.cost_per_request)- 1. When accuracy becomes more valuable, the best width…
- 2. Reduced precision usually…
- 3. At low traffic, total cost is dominated by…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Marginal analysis. With profit per request V·a(W) − c(W), a wider model is worth it when the marginal gain V·Δa exceeds the marginal cost Δc. Cost grows linearly in width while accuracy grows roughly logarithmically, so Δa per doubling shrinks while Δc per doubling doubles: there is an interior optimum, and it moves to larger widths in proportion to log V.
Constraints. A latency objective removes the configurations above it; the optimum is then either the unconstrained one or the largest feasible configuration. Constraints often bind for valuable tasks, which is why efficiency work (precision, distillation) matters most where accuracy is most valuable.
Pareto dominance. If configuration B is at least as accurate as A and cheaper, A should never be chosen whatever the value of accuracy. Reduced-precision variants that keep accuracy within noise of full precision at a fraction of the cost dominate full precision, removing it from the frontier.
Amortization. Training costs T once; serving costs c(W) per request for Q requests. Total cost T(W) + Q·c(W): at small Q the training term decides, at large Q the serving term. The best model therefore depends on the volume it will serve.
Data and model size. Test error decreases with both data n and capacity W, with diminishing returns in each. Under a budget n·W = B, the optimum balances the two; scaling laws for neural networks (Kaplan and colleagues, 2020; Hoffmann and colleagues, 2022) found that data and parameters should grow roughly together.
- 1. A wider model is worth it when…
- 2. A configuration dominated in accuracy and cost…
- 3. Hoffmann and colleagues (2022) found that data and parameters should…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Which model size is most profitable as the value of accuracy and the latency objective change?
History.
- Multi-objective optimization and Pareto efficiency go back to V. Pareto (1906) and were formalized in engineering design in the 20th century.
- G. Hinton, O. Vinyals and J. Dean (2015) popularized knowledge distillation; C. Buciluǎ, R. Caruana and A. Niculescu-Mizil (2006) had compressed ensembles into single models.
- A. Rahimi and B. Recht (2007) introduced random Fourier features, a simple family whose capacity is set by one number.
- J. Kaplan and colleagues (2020) and J. Hoffmann and colleagues (2022) measured scaling laws linking accuracy to model size, data and compute.
- Efficiency benchmarks such as MLPerf Inference (2019) report accuracy together with latency and throughput.
Exercise 2.
- Widths 4 to 512; each trained on 3,000 examples and tested on 4,000.
- Profit per million requests = value of a million correct predictions × accuracy − cost; values $5, $50 and $5,000; with no latency objective and with p99 under 4 ms.
Seed 0:
| width | test accuracy | p50 ms | p99 ms | $ per million |
|---|---|---|---|---|
| 4 | 0.7110 | 1.03 | 1.05 | 0.030 |
| 8 | 0.7340 | 1.05 | 1.10 | 0.059 |
| 16 | 0.7442 | 1.10 | 1.20 | 0.119 |
| 32 | 0.7450 | 1.20 | 1.41 | 0.237 |
| 64 | 0.7823 | 1.41 | 1.82 | 0.474 |
| 128 | 0.8050 | 1.82 | 2.64 | 0.948 |
| 256 | 0.8135 | 2.64 | 4.28 | 1.896 |
| 512 | 0.8283 | 4.28 | 7.55 | 3.793 |
Most profitable width (seed 0): $5: 8; $50: 128; $5,000: 512; $5,000 with p99 under 4 ms: 128. Seed 1 gave the same choices. In seed 2 widths 256 and 512 were no more accurate than 128 on the test set (0.8203 and 0.8213 against 0.8225), so 128 was best at $5,000 too.
Findings.
- Accuracy rose by 9.4 points from width 4 to 128 but only 2.3 points from 128 to 512, while cost rose fourfold over the second range.
- The best width grew with the value of accuracy, from 8 at $5 to 128 at $50 and 512 at $5,000 (seeds 0 and 1).
- The 4 ms latency objective capped the choice at width 128 in every seed; at high widths, differences of a point are within test-set noise, so the choice should rest on more than one evaluation.
Trade-offs in practice
- Model cards and launch reviews report accuracy together with latency percentiles and cost per thousand requests on the target hardware.
- Families of models (small, base, large; distilled and quantized variants) let teams pick a point per product surface: a fast model for autocomplete, a large one for offline batch jobs.
- Large language model providers price tiers by size, and routers send each request to the cheapest model expected to answer it well.
- Satellite and edge systems face hard power and latency budgets onboard, which often decide the model before accuracy does; heavier models run on the ground.
References
- A. Rahimi and B. Recht (2007). “Random features for large-scale kernel machines.” NeurIPS.
- C. Buciluǎ, R. Caruana and A. Niculescu-Mizil (2006). “Model compression.” KDD.
- G. Hinton, O. Vinyals and J. Dean (2015). “Distilling the knowledge in a neural network.” arXiv.
- J. Kaplan and colleagues (2020). “Scaling laws for neural language models.” arXiv.
- J. Hoffmann and colleagues (2022). “Training compute-optimal large language models.” NeurIPS.
- V. J. Reddi and colleagues (2020). “MLPerf inference benchmark.” ISCA.