Margin-Based Generalization
Why large margins generalize, whatever the dimension.
An RBF-kernel SVM separates its data with a hyperplane in an infinite-dimensional feature space, where hyperplanes have infinite VC dimension. It generalizes anyway. The explanation is the margin: for norm-bounded linear predictors, what controls generalization is the ratio of the data's radius to the margin, , and the dimension never enters.
What you’ll learn
- Prove the perceptron's mistake bound and explain how it yields generalization guarantees.
- Show that norm-bounded linear predictors have Rademacher complexity at most , in any dimension and in any RKHS.
- Prove the margin bound with the ramp loss and the contraction lemma, and make it uniform over .
- Define the fat-shattering dimension, prove for linear functions in the simplest case, and relate it to learnability.
- Assess what margin theory explains about SVMs, gradient descent and deep networks, as of the mid-2020s.
Counting parameters fails; margins do not
Half-spaces in have VC dimension , so the VC bound on the gap between training and test error scales like for examples, and says nothing once . Kernel SVMs live in that regime by design: the RBF kernel's feature space is infinite-dimensional. A different quantity is needed, and the oldest argument already finds it. Labels are throughout, and, as in Mohri et al. and Shalev-Shwartz & Ben-David, denotes the number of training examples (the of the other lessons).
After the -th mistake, the projection on has grown by at least per mistake:
A mistake means , so the squared norm grows by at most per mistake:
Combine with Cauchy–Schwarz, :
The perceptron needs only inner products, since is a sum of mistaken examples, so it runs with any kernel, and the bound holds in the feature space with . Mistake bounds become generalization bounds. Cycling through a separable training set until no mistakes remain gives a classifier determined by at most of the examples, a sample compression scheme (Stability, Compression & PAC-Bayes). Freund and Schapire (1999) turned the mistake bound into generalization bounds of order for the voted perceptron, and extended the mistake bound to inseparable data, replacing by where measures how far the data fall short of margin .
Inputs have norm at most and are separable with margin by a unit vector. At most how many mistakes can the perceptron make, in a space of dimension one million?
Show the answer
100 mistakes
, whatever the dimension. The ratio acts as an effective dimension; the theory below shows it controls generalization for SVMs too.
Rademacher complexity of linear predictors
Recall from Rademacher Complexity that for a class of real functions and a sample , the empirical Rademacher complexity is with independent uniform signs : how well the class can correlate with noise. Take the norm-bounded linear class in a Hilbert space.
The supremum of a linear function over a ball is attained in the direction of the vector it is applied to (Cauchy–Schwarz):
Jensen's inequality moves the expectation inside the square root, and the cross terms vanish because for :
With , the trace is at most :
No dimension appears. For the RBF kernel, for every input, so and the complexity is simply : everything rides on the norm of in feature space, the inverse of the margin. The data-dependent form can be computed from the Gram matrix of the actual sample (Bartlett & Mendelson, 2002).
The margin bound
The 0–1 loss of a score is not Lipschitz, so Rademacher bounds cannot use it directly. Interpose the ramp loss at margin level :
a function of the margin . It is -Lipschitz, and it is sandwiched between the 0–1 loss and the margin loss that also counts correct predictions with margin below . Write .
For a class of -valued functions, with probability at least , uniformly over (symmetrization plus McDiarmid; see Rademacher Complexity):
Apply it to . Talagrand's contraction lemma (Ledoux & Talagrand, 1991) strips the -Lipschitz ramp, and the label disappears because has the same distribution as :
Sandwich: the 0–1 risk is at most , and the empirical ramp loss is at most . Substituting gives the theorem.
What it says about SVMs. For a hard-margin SVM in canonical form, every training point has and the geometric margin is . Taking the level and (legitimate with the uniform version), the empirical term vanishes and the complexity term is : the effective dimension is , the same quantity as in the perceptron bound. For soft margins, the hinge loss dominates the ramp at level 1, so
and the soft-margin objective, average hinge loss plus a penalty on , is a regularized surrogate for the right-hand side. This is the structural-risk-minimization reading of the SVM; making it rigorous for a margin that is only known after seeing the data was the contribution of Shawe-Taylor, Bartlett, Williamson and Anthony (1998).
A classifier has and zero margin errors. How many training examples make the complexity term at most ?
Show the answer
160000 examples
requires , so . The worst-case constants make margin bounds conservative, but the scaling, examples, is independent of the dimension.
Fat-shattering and the scale of learnability
Suppose -shatters with and all witnesses . For each pattern pick its and sum the inequalities:
This holds for every , so it holds on average over uniformly random signs, where the same computation as for the Rademacher complexity applies:
General witnesses need an extra combinatorial step, but the bound survives (Bartlett & Shawe-Taylor, 1999).
Fat-shattering plays the role for real-valued classes that the VC dimension plays for binary ones: a class of -valued functions has uniform convergence of empirical means, at every accuracy and for every distribution, exactly when is finite for every (Alon, Ben-David, Cesa-Bianchi & Haussler, 1997).
Bartlett (1998) used these tools for neural networks, in a paper whose title states its conclusion: the size of the weights is more important than the size of the network. For networks whose units have weight vectors of bounded norm, the misclassification probability is bounded by the fraction of training points with margin below plus a term that depends on the weight bound, the margin, the depth and (only logarithmically) the input dimension, but not on the number of weights. A huge network trained to have small weights and large margins can generalize, which parameter counting cannot explain.
What margins explain today
Tightness for SVMs. The classic bounds have been refined repeatedly; Grønlund, Kamma and Larsen (2020) improved the margin-based upper bound for SVMs and proved a nearly matching lower bound, so the margin story for linear classifiers is close to settled.
Implicit maximum margins. Margins also appear without being asked for. Soudry, Hoffer, Nacson, Gunasekar and Srebro (2018) proved that gradient descent on the logistic loss over linearly separable data, with no regularization at all, converges in direction to the hard-margin SVM solution, though only at rate . Margin theory thus applies to plain unregularized training; The Implicit Bias of Gradient Descent develops this.
Deep networks. Bartlett, Foster and Telgarsky (2017) proved margin bounds for neural networks that scale with a "spectral complexity", the product of the layers' spectral norms times a correction factor, and found it correlated with excess risk when training on true versus random labels. Numerically, such norm-based bounds are typically vacuous for large networks, and whether they capture why networks generalize is unsettled. Dziugaite and Roy (2017) obtained the first nonvacuous bounds for deep stochastic networks by directly optimizing a PAC-Bayes bound, and a large empirical study of over 40 complexity measures across more than 10,000 networks (Jiang et al., 2020) found surprising failures among them.
For an RBF-kernel SVM, every feature vector has norm . What, then, controls the complexity term of its margin bound?
- The dimension of the input space
- Nothing: the bound is the same for every RBF SVM
- The number of support vectors only
- The norm in feature space, the inverse of the margin, relative to
Show the answer
D. The norm in feature space, the inverse of the margin, relative to
With the complexity term is at margin level 1. Settings that need a large to fit the data, such as a very large , have a small feature-space margin and a weak bound, even though the dimension of the feature space never changes.
Key takeaways
- The perceptron makes at most mistakes on data separable with margin , in any dimension; kernelized, it inherits the bound with .
- Norm-bounded linear predictors have Rademacher complexity at most : dimension-free.
- Margin bound: with probability , , by the ramp loss and contraction; uniform over at a cost. The SVM objective is a regularized surrogate for it.
- Fat-shattering is the scale-sensitive VC dimension; linear functions have , and finiteness at every scale characterizes uniform convergence (Alon et al., 1997).
- Margins also explain the implicit bias of gradient descent on separable data, but whether margin-type bounds explain deep networks' generalization is unsettled.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Inputs satisfy and some unit vector separates them with margin . What does Novikoff's theorem guarantee?
- At most 10 perceptron mistakes
- At most 100 perceptron mistakes, on any ordering of any such sequence
- At most 100 mistakes, but only in dimension 100 or less
- Convergence, with no bound on the number of mistakes
Show the answer
B. At most 100 perceptron mistakes, on any ordering of any such sequence
. The bound holds for every order of presentation and every dimension; the margin and the radius are all that matter.
A linear class has , inputs satisfy , and the sample has points in dimension . What bound holds for its empirical Rademacher complexity?
- About
Show the answer
A.
. The dimension plays no role; a VC-style term would be vacuous here.
Why does the margin-bound proof use the ramp loss instead of the 0–1 loss directly?
- Because the ramp loss is convex
- Because the 0–1 loss is not bounded
- Because SVMs minimize the ramp loss
- Because the ramp loss is -Lipschitz, so the contraction lemma reduces its complexity to that of the linear scores, while it still upper-bounds the 0–1 loss
Show the answer
D. Because the ramp loss is -Lipschitz, so the contraction lemma reduces its complexity to that of the linear scores, while it still upper-bounds the 0–1 loss
Contraction needs a Lipschitz function of the score; the 0–1 loss jumps at . The ramp is -Lipschitz in the margin , lies above and below , which turns the complexity of into the term.
Linear functions with act on inputs with . At scale , at most how many points can they -shatter?
- 4
- Infinitely many, in infinite dimensions
- 16
Show the answer
D. 16
, in any dimension, even an infinite-dimensional feature space. Requiring a margin caps how many patterns can be realized.
Further reading
- A. B. J. Novikoff, "On convergence proofs on perceptrons" (1962).
- P. L. Bartlett, "The sample complexity of pattern classification with neural networks: the size of the weights is more important than the size of the network," IEEE Transactions on Information Theory 44(2), 525–536 (1998).
- N. Alon, S. Ben-David, N. Cesa-Bianchi & D. Haussler, "Scale-sensitive dimensions, uniform convergence, and learnability," Journal of the ACM 44(4), 615–631 (1997).
- P. L. Bartlett & S. Mendelson, "Rademacher and Gaussian complexities: risk bounds and structural results," Journal of Machine Learning Research 3, 463–482 (2002).
- M. Mohri, A. Rostamizadeh & A. Talwalkar, Foundations of Machine Learning, 2nd ed. (MIT Press, 2018), chapters 5 and 6; S. Shalev-Shwartz & S. Ben-David, Understanding Machine Learning (Cambridge University Press, 2014), chapters 15 and 26.