Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.A certificate for your model
After training, you want to say something like: “I’m 95% sure this classifier’s real error rate is below 2%.” That sentence is a generalization bound. Some bounds use data the model never saw (a test set); others use only the training data plus a measure of how complex the model is. A bound that comes out above 100% is vacuous: true, but useless.
Safety cases for learned components need defensible error statements, not just “it looked good on our data”. Knowing which bound applies, what assumptions it needs (independent data, an untouched test set) and how tight it is lets you make honest claims and plan how much test data to collect.
- 1. The most direct way to certify a model's error is…
- 2. A bound that says 'error ≤ 1.7' is…
- 3. More test data makes a test-set bound…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Test-set bounds
If a fixed classifier makes k errors on n fresh test examples, then with probability ≥ 1 − δ:
- Hoeffding: ;
- exact binomial (Clopper–Pearson): R is at most the largest p with .
With zero errors the exact bound is , the rule of three (≈ 3/n at 95%). For n = 500: 0.0060, against Hoeffding’s 0.055. The catch: the test set must not have influenced training or model selection.
Training-set bounds
These use the training data plus a capacity term: finite class (b2-2), VC (b2-3), Rademacher and margin (b2-4), compression, and PAC-Bayes (b2-8). All have the form
- 1. With 0 errors on 300 test points, the 95% rule-of-three bound is about…
- 2. Exact binomial vs Hoeffding at low error rates:
- 3. A test-set bound is invalid if…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Sample-compression bounds
If the learned hypothesis can be rebuilt from just k of the m training examples, and it is correct on the other m − k, then with probability ≥ 1 − δ:
(Littlestone and Warmuth, 1986; Floyd and Warmuth, 1995). The perceptron is rebuilt from the examples it updated on. Novikoff’s theorem caps those updates at for margin γ, so few updates mean a strong guarantee, whatever the dimension. SVMs compress to their support vectors.
Tight vs vacuous
| bound | depends on | tight when |
|---|---|---|
| test set | n_test, test errors | always (if the test data is untouched) |
| VC | dimension d, m | m ≫ d |
| Rademacher / margin | norms, achieved margin | large margin relative to data radius |
| compression | k, m | hypothesis determined by few examples |
| PAC-Bayes | KL(posterior ‖ prior) | posterior close to prior, flat minima |
Reading bounds responsibly
- They’re upper bounds, often loose by a constant factor even when “non-vacuous”. Use them for comparisons and scaling.
- Every quantity tuned on data must be paid for. That includes the margin γ, the model class and hyperparameters; pay with a union bound.
- Everything assumes i.i.d. data. A new deployment environment breaks every bound.
- 1. A perceptron's compression set is…
- 2. Novikoff bounds perceptron updates by…
- 3. Tuning γ on the training data and then quoting the margin bound requires…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Zero-error test-set bound
If the true error is p, then P(no errors in n) = . The set of p with is , and since , this is . ∎
Compression bound (sketch)
Fix k and a k-subset I. The hypothesis built from I doesn’t depend on the other m − k examples, so if its error is > ε it is consistent with all of them with probability . Take a union over the subsets and over k ≤ m (cost ln m). ∎
Why the test set must be untouched
The test-set bound treats the classifier as fixed before the test data is drawn. If you pick among several classifiers using the test set, you are back in the finite-class setting and must pay ln(#candidates).
Exercise 3.1: test-set width at scale
With n = 10 000 test examples and δ = 0.05, Hoeffding’s width is . Certifying ±1% needs about 15 000 examples.
- 1. 1 − δ^(1/n) is at most…
- 2. The compression bound's union is over…
- 3. Hoeffding width for n = 10 000, δ = 0.05:
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Four certificates for one classifier
Test-set bounds. Both bounds cover the true error at least 95% of the time in 4000 simulated test sets (n = 500). With 0 test errors: Hoeffding 0.0547, exact binomial 0.0060. With 25 errors (5%): Hoeffding 0.1047, exact 0.0691.
One perceptron, four certificates. Separable data in d = 50 dimensions with margin γ = 0.1, m = 4000. The perceptron converged after k = 41 updates (Novikoff allows up to 100). Its own achieved margin is only 0.0028, and its test error is 0.0001.
| certificate (δ = 0.05) | value |
|---|---|
| sample compression (k = 41) | 0.089 |
| VC (d + 1 = 51) | 0.79 |
| Rademacher margin (perceptron’s own margin 0.0028) | 11.2 (vacuous) |
| 1000-example held-out set, 0 errors (exact) | 0.003 |
The margin bound fails because the perceptron stops as soon as it separates the data, with a near-zero margin; maximizing the margin (SVM) is what makes margin bounds useful. A modest untouched test set beats every training-set bound.
Bounds in AI, robotics and aerospace
- Verification and validation: test-set certificates with exact binomial bounds are the workhorse for statistical claims about learned components; rare-event validation needs huge n or importance sampling.
- Model choice: compression and margin views explain why sparse, large-margin models generalize.
- Research: non-vacuous bounds for deep networks via PAC-Bayes and compression (b2-8).
- Conformal prediction: distribution-free coverage guarantees for prediction sets, built on the same exchangeability as test-set bounds.
References
- J. Langford (2005). “Tutorial on practical prediction theory for classification.” JMLR, 6.
- N. Littlestone, M. Warmuth (1986). “Relating data compression and learnability.” Technical report, UC Santa Cruz.
- S. Floyd, M. Warmuth (1995). “Sample compression, learnability, and the Vapnik–Chervonenkis dimension.” Machine Learning, 21.
- A. Novikoff (1962). “On convergence proofs on perceptrons.” Symposium on the Mathematical Theory of Automata.
- C. Clopper, E. Pearson (1934). “The use of confidence or fiducial limits illustrated in the case of the binomial.” Biometrika, 26.