Support Vector Machines and Maximum Margin

Imagine a straight line separating red and blue points on a plane. Many possible lines work. Which one should a learning algorithm pick? Does the choice matter when new points arrive? The Perceptron Algorithm stops as soon as it finds any separating line. It stops even if that line grazes a training point. Support vector machines (SVMs) instead ask a sharper question. Among all separators, which one leaves the widest possible cushion of empty space? This cushion sits on both sides of the line. This question matters because the width of that cushion is called the margin. The margin controls how confidently the classifier generalizes to unseen data. A separator that barely squeaks by the training points is fragile. A small perturbation of a test point can flip its predicted label. A separator with a wide margin is robust. Classical learning theory shows that maximizing the margin tightens generalization bounds. These bounds are independent of the dimensionality of the feature space. This is the geometric intuition that makes SVMs one of the most theoretically grounded classifiers in the standard toolkit. It sits alongside Logistic Regression and the Sigmoid. The big picture is this: maximizing margin is not a heuristic bolted onto classification. It is exactly equivalent to a clean, convex quadratic optimization problem with linear constraints. This means the hard-margin SVM has a unique solution, when one exists. It can be solved efficiently and reliably. It also comes with an elegant dual formulation that reveals which training points actually matter. Those points are called support vectors. They alone determine the decision boundary. This article develops the hard-margin SVM from first principles. It shows how to formalize "widest cushion" as a quadratic program. It explains why the optimal solution depends on only a handful of points. It also shows how the geometry connects to the Lagrangian dual. It closes by foreshadowing two extensions. These extensions make SVMs practical for real, noisy data: Soft Margins and Hinge Loss for non-separable data, and Kernels and the Kernel Trick for nonlinear boundaries.

Key takeaways
  • The hard-margin SVM finds the linear separator that maximizes the distance to the nearest training point on either side.
  • Maximizing margin is equivalent to minimizing ∥w∥2\|w\|^2 subject to every point being correctly classified with margin at least 1.
  • This is a convex quadratic program (QP) with a unique global optimum, unlike the perceptron's arbitrary solution.
  • The Lagrangian dual shows the optimal ww is a weighted sum of only the "support vectors" — points that touch the margin boundary.
  • Support vectors are exactly the points with nonzero dual variables, a consequence of the Karush-Kuhn-Tucker (KKT) complementary slackness conditions.
  • The hard-margin formulation assumes linear separability; relaxing that assumption leads directly to soft margins and, via the dual's dot products, to kernels.
The core insight

Among all hyperplanes that separate two classes, the SVM picks the unique one maximizing the minimum distance from any training point to the boundary, and this geometric criterion is exactly a convex quadratic program.

The idea

A linear classifier partitions input space Rd\mathbb{R}^d with a hyperplane {x:w⊤x+b=0}\{x : w^\top x + b = 0\}, predicting y^=sign(w⊤x+b)\hat{y} = \text{sign}(w^\top x + b). For linearly separable training data {(xi,yi)}i=1n\{(x_i, y_i)\}_{i=1}^n with yi∈{−1,+1}y_i \in \{-1, +1\}, infinitely many hyperplanes achieve zero training error. The geometric margin of a hyperplane with respect to a point xix_i is the signed perpendicular distance from xix_i to the hyperplane,

γi=yi(w⊤xi+b)∥w∥.\gamma_i = \frac{y_i (w^\top x_i + b)}{\|w\|}.

The margin of the hyperplane with respect to the whole dataset is γ=min⁡iγi\gamma = \min_i \gamma_i, the distance to the closest point of either class. The maximum margin classifier is the hyperplane (w,b)(w, b) that maximizes γ\gamma subject to every point being correctly classified, i.e. γi≥γ\gamma_i \ge \gamma for all ii. This optimization has a scaling redundancy: multiplying ww and bb by any positive constant leaves the hyperplane and every γi\gamma_i unchanged, since both numerator and denominator scale together. We remove this redundancy with a canonical scaling: choose the scale of (w,b)(w, b) so that the closest points satisfy yi(w⊤xi+b)=1y_i(w^\top x_i + b) = 1 exactly. Under this normalization the margin is simply γ=1/∥w∥\gamma = 1/\|w\|, and the constraint "every point classified correctly with margin at least γ\gamma" becomes the clean linear constraint

yi(w⊤xi+b)≥1for all i.y_i (w^\top x_i + b) \ge 1 \quad \text{for all } i.

Maximizing 1/∥w∥1/\|w\| is the same as minimizing ∥w∥\|w\|, or more conveniently for calculus, minimizing 12∥w∥2\frac{1}{2}\|w\|^2. This is the hard-margin SVM primal problem:

min⁡w,b 12∥w∥2subject toyi(w⊤xi+b)≥1,  i=1,…,n.\min_{w, b} \ \frac{1}{2}\|w\|^2 \quad \text{subject to} \quad y_i(w^\top x_i + b) \ge 1, \ \ i = 1, \dots, n.

It is called "hard margin" because it requires perfect linear separability, zero tolerance for violation. The objective is a convex quadratic function and the constraints are linear (affine) in (w,b)(w, b), so this is a convex quadratic program: a well-understood class of problems with a unique global minimum whenever the feasible region is nonempty, and efficient polynomial-time algorithms to solve it.

How it works

Step 1 — formalize as a QP. As derived above, the primal is a convex QP in d+1d+1 variables (w∈Rdw \in \mathbb{R}^d, b∈Rb \in \mathbb{R}) with nn linear inequality constraints. Any general-purpose QP solver can, in principle, solve this directly.

Step 2 — form the Lagrangian. Introduce one multiplier αi≥0\alpha_i \ge 0 per constraint:

L(w,b,α)=12∥w∥2−∑i=1nαi[yi(w⊤xi+b)−1].L(w, b, \alpha) = \frac{1}{2}\|w\|^2 - \sum_{i=1}^n \alpha_i \left[ y_i(w^\top x_i + b) - 1 \right].

Step 3 — derive the dual by stationarity. At the optimum, the gradient of LL with respect to the primal variables vanishes:

∂L∂w=w−∑iαiyixi=0   ⟹   w=∑i=1nαiyixi,\frac{\partial L}{\partial w} = w - \sum_i \alpha_i y_i x_i = 0 \ \implies\ w = \sum_{i=1}^n \alpha_i y_i x_i,
∂L∂b=−∑iαiyi=0   ⟹   ∑i=1nαiyi=0.\frac{\partial L}{\partial b} = -\sum_i \alpha_i y_i = 0 \ \implies\ \sum_{i=1}^n \alpha_i y_i = 0.

Substituting these back into LL eliminates ww and bb, giving the dual problem, a QP purely in α\alpha:

max⁡α≥0 ∑i=1nαi−12∑i=1n∑j=1nαiαjyiyj xi⊤xjsubject to∑iαiyi=0.\max_{\alpha \ge 0} \ \sum_{i=1}^n \alpha_i - \frac{1}{2}\sum_{i=1}^n\sum_{j=1}^n \alpha_i \alpha_j y_i y_j\, x_i^\top x_j \quad \text{subject to} \quad \sum_i \alpha_i y_i = 0.

The dual depends on the data only through inner products xi⊤xjx_i^\top x_j — the observation that later enables the kernel trick.

Step 4 — solve the dual, identify support vectors. The dual has nn variables and box-type nonnegativity constraints, which is often easier to solve numerically than the primal, especially via decomposition methods (e.g. SMO) that update a small subset of αi\alpha_i at a time. At the solution, KKT complementary slackness requires

αi[yi(w⊤xi+b)−1]=0for every i.\alpha_i \left[ y_i(w^\top x_i + b) - 1 \right] = 0 \quad \text{for every } i.

So either αi=0\alpha_i = 0, or the constraint is tight: yi(w⊤xi+b)=1y_i(w^\top x_i + b) = 1, meaning xix_i sits exactly on the margin boundary. Points with αi=0\alpha_i = 0 contribute nothing to w=∑iαiyixiw = \sum_i \alpha_i y_i x_i. The points with αi>0\alpha_i > 0 are the support vectors — they alone determine the separating hyperplane.

Step 5 — recover ww and bb. Compute ww from the formula above, then recover bb using any support vector xsx_s (or averaging over all of them for numerical stability):

b=ys−w⊤xs.b = y_s - w^\top x_s.

Step 6 — classify new points. For a new input xx, predict

y^=sign(∑i∈SVαiyi xi⊤x+b).\hat{y} = \text{sign}\left( \sum_{i \in \text{SV}} \alpha_i y_i\, x_i^\top x + b \right).

``` Algorithm HardMarginSVM(X, y): Input: data points X = {x_1, ..., x_n}, labels y_i in {-1, +1} Output: weight vector w, bias b, support vector set SV

# Step 1: build and solve the dual QP maximize sum_i alpha_i

  • 0.5 sum_i sum_j alpha_i alpha_j y_i y_j * dot(x_i, x_j)

subject to alpha_i >= 0 for all i sum_i alpha_i * y_i == 0 alpha = SolveQP(...) # e.g. via SMO or an interior-point QP solver

# Step 2: recover primal solution w = sum_i alpha_i y_i x_i SV = { i : alpha_i > tolerance } # support vectors

# Step 3: recover bias using any (or all) support vectors b = average over i in SV of ( y_i - dot(w, x_i) ) return w, b, SV Function Predict(x, w, b): return sign( dot(w, x) + b ) ``` The pseudocode's key correctness point is in the recovery step: because complementary slackness forces yi(w⊤xi+b)=1y_i(w^\top x_i + b) = 1 exactly for every support vector, any support vector gives the same bb up to solver numerical error, and averaging over all of them reduces that error.

Figure
Maximum margin hyperplane with support vectors circled
decision boundary w·x+b=0 margin: w·x+b=+1 margin: w·x+b=-1 margin = 1/‖w‖ feature dimension 1 feature dimension 2 class +1 class -1

Complexity & correctness

Space complexity. Storing the data is O(nd)O(nd). The dual QP requires the Gram matrix Kij=xi⊤xjK_{ij} = x_i^\top x_j, an n×nn \times n matrix, costing O(n2)O(n^2) space if materialized in full (many practical solvers avoid storing it fully, computing entries on demand or caching a working subset).

Time complexity. Computing the full Gram matrix costs O(n2d)O(n^2 d). Solving a general QP with nn variables via interior-point methods costs roughly O(n3)O(n^3) in the worst case (dominated by linear algebra on an n×nn \times n system per iteration, with O(log⁡(1/ϵ))O(\log(1/\epsilon)) iterations for ϵ\epsilon-accuracy). In practice, specialized decomposition algorithms like Sequential Minimal Optimization (SMO) update two αi\alpha_i at a time in closed form, avoiding any large matrix factorization; empirically this scales closer to O(n2)O(n^2) to O(n3)O(n^3) depending on how many points end up as support vectors and how tightly the classes are packed, but no better worst-case polynomial bound is generally guaranteed for QP solvers on adversarial inputs. Prediction, after training, costs O(∣SV∣⋅d)O(|SV| \cdot d) per test point, where ∣SV∣≤n|SV| \le n is the number of support vectors — often much smaller than nn, which is why sparsity matters.

Why the QP is the right formulation (correctness of the reduction). We must justify that "maximize the margin subject to correct classification" really is equivalent to the QP written above. Fix any hyperplane through the origin's normal direction w/∥w∥w/\|w\|. Rescaling (w,b)(w,b) by a positive constant does not change the hyperplane or the margin γi=yi(w⊤xi+b)/∥w∥\gamma_i = y_i(w^\top x_i + b)/\|w\|, since both numerator and denominator scale identically — this is precisely the freedom used to fix the canonical scale min⁡iyi(w⊤xi+b)=1\min_i y_i(w^\top x_i+b) = 1. Once that scale is fixed, γ=min⁡iγi=1/∥w∥\gamma = \min_i \gamma_i = 1/\|w\| exactly, so maximizing γ\gamma is equivalent to minimizing ∥w∥\|w\|, subject to the constraint that no point violates the unit-margin condition. This establishes the primal QP is not an approximation of the margin-maximization problem — it is the margin-maximization problem, after a valid reparametrization.

Why strong duality holds (correctness of the dual). The primal is a convex QP (convex quadratic objective, affine constraints), and it is strictly feasible whenever the data is linearly separable (Slater's condition holds trivially since the constraints are affine, not just convex). Convexity plus Slater's condition guarantees zero duality gap: the primal optimum equals the dual optimum, and any point satisfying the KKT conditions is simultaneously primal- and dual-optimal. This is why solving the dual — often computationally more convenient because its constraints are simpler (nonnegativity plus one linear equality, versus nn general linear inequalities in the primal) — yields the exact same classifier as solving the primal directly.

Why the solution is unique. The primal objective 12∥w∥2\frac{1}{2}\|w\|^2 is strictly convex in ww (its Hessian is the identity matrix, positive definite), so if a feasible solution exists, the optimal w∗w^* is unique. The optimal b∗b^* is also uniquely pinned down by the requirement that at least one point from each class touch the margin boundary (this follows from the KKT stationarity condition ∑iαiyi=0\sum_i \alpha_i y_i = 0 forcing support vectors from both classes to be active at the optimum, assuming both classes are nonempty). This uniqueness is a genuine advantage over the perceptron, whose final hyperplane depends on initialization and the order examples are visited.

Honest tradeoffs. The hard-margin formulation is only well-defined when the data is linearly separable — if even one point cannot be separated, the feasible region is empty and the QP has no solution. This is a serious practical limitation, motivating the soft-margin relaxation. Even when separable, the hard-margin solution can be extremely sensitive to a single noisy or mislabeled point near the boundary, since that point may become the sole determinant of a razor-thin margin. Nonlinear class boundaries also cannot be captured by a linear hyperplane at all — a limitation removed by mapping into higher-dimensional feature spaces via kernels.

Worked example

Consider four 2D points, a small enough dataset to solve by hand and verify against the geometric intuition.

Pointxxyy (label)
x1x_1(2,2)(2, 2)+1+1
x2x_2(3,1)(3, 1)+1+1
x3x_3(0,0)(0, 0)−1-1
x4x_4(1,0)(1, 0)−1-1

By inspection, the classes are separated roughly along the direction (1,1)(1,1). Guess that the optimal boundary is orthogonal to w∝(1,1)w \propto (1,1). Try the canonical form w=(a,a)w = (a, a) for some a>0a > 0, bb to be determined. The candidate support vectors — the closest points across the gap — appear to be x3=(0,0)x_3 = (0,0) (label −1-1) and x1=(2,2)x_1=(2,2) (label +1+1), with x2,x4x_2, x_4 farther from a boundary in this direction. Impose the canonical scaling equalities on the two candidate support vectors:

y1(w⊤x1+b)=1  ⟹  (2a+2a+b)=1  ⟹  4a+b=1y_1(w^\top x_1 + b) = 1 \implies (2a + 2a + b) = 1 \implies 4a + b = 1
y3(w⊤x3+b)=1  ⟹  −(0+0+b)=1  ⟹  b=−1y_3(w^\top x_3 + b) = 1 \implies -(0 + 0 + b) = 1 \implies b = -1

Solving: 4a−1=1  ⟹  a=0.54a - 1 = 1 \implies a = 0.5. So w=(0.5,0.5)w = (0.5, 0.5), b=−1b = -1.

Check all four constraints yi(w⊤xi+b)≥1y_i(w^\top x_i + b) \ge 1:

Pointw⊤xi+bw^\top x_i + byi(w⊤xi+b)y_i(w^\top x_i+b)Satisfies ≥1\ge 1?
x1=(2,2)x_1=(2,2)0.5(2)+0.5(2)−1=10.5(2)+0.5(2)-1 = 11⋅1=11 \cdot 1 = 1tight (SV)
x2=(3,1)x_2=(3,1)0.5(3)+0.5(1)−1=10.5(3)+0.5(1)-1 = 11⋅1=11 \cdot 1 = 1tight (SV)
x3=(0,0)x_3=(0,0)0.5(0)+0.5(0)−1=−10.5(0)+0.5(0)-1 = -1(−1)(−1)=1(-1)(-1) = 1tight (SV)
x4=(1,0)x_4=(1,0)0.5(1)+0.5(0)−1=−0.50.5(1)+0.5(0)-1 = -0.5(−1)(−0.5)=0.5(-1)(-0.5) = 0.5violated!

The initial guess was wrong: x4x_4 violates the margin constraint, so (a=0.5,b=−1)(a=0.5, b=-1) is not feasible, meaning it cannot be optimal. This is instructive: x2x_2 turned out tight too, so the true support vectors likely include x4x_4 and x2x_2, not x1x_1 and x3x_3. Redo with x2=(3,1)x_2=(3,1) (label +1+1) and x4=(1,0)x_4=(1,0) (label −1-1) as the binding pair, again with w=(a,a)w=(a,a):

y2(w⊤x2+b)=1  ⟹  (3a+a+b)=1  ⟹  4a+b=1y_2(w^\top x_2 + b) = 1 \implies (3a + a + b) = 1 \implies 4a + b = 1
y4(w⊤x4+b)=1  ⟹  −(a+b)=1  ⟹  a+b=−1y_4(w^\top x_4 + b) = 1 \implies -(a + b) = 1 \implies a + b = -1

Subtracting: 3a=2  ⟹  a=2/33a = 2 \implies a = 2/3, then b=−1−2/3=−5/3b = -1 - 2/3 = -5/3. So w=(2/3,2/3)w = (2/3, 2/3), b=−5/3b = -5/3. Verify all four constraints:

Pointw⊤xi+bw^\top x_i + byi(⋅)y_i(\cdot)Status
x1=(2,2)x_1=(2,2)4/3+4/3−5/3=14/3+4/3-5/3 = 111tight
x2=(3,1)x_2=(3,1)2+2/3−5/3=12+2/3-5/3 = 111tight (SV)
x3=(0,0)x_3=(0,0)−5/3≈−1.67-5/3 \approx -1.671.671.67slack
x4=(1,0)x_4=(1,0)2/3−5/3=−12/3-5/3 = -111tight (SV)

All four constraints now hold with equality or slack (≥1\ge 1 in every row). Both x1x_1 and x2x_2 are tight on the +1+1 side; only x4x_4 is tight on the −1-1 side — three support vectors total, and x3x_3 (with slack 1.67>11.67 > 1) is not a support vector, correctly reflecting that it sits well inside its class region. The margin is γ=1/∥w∥=1/(22/3)=3/(22)≈1.06\gamma = 1/\|w\| = 1/(2\sqrt2/3) = 3/(2\sqrt2) \approx 1.06. This trace shows why guessing support vectors from a picture can mislead you, and why the KKT feasibility check is not optional — it is the actual certificate of correctness for a candidate solution.

Common pitfalls & traps

PitfallWhy it happensFix
Assuming any margin-touching point is a support vector without checking dual feasibilityGeometric intuition about "closest points" can be wrong in higher dimensions or with unequal class geometrySolve the QP (or verify KKT conditions) rather than eyeballing the closest pair
Running hard-margin SVM on non-separable dataThe QP's feasible region is empty, so solvers either fail or report unbounded/infeasibleCheck separability first, or default to the soft-margin formulation (Soft Margins and Hinge Loss)
Forgetting the canonical scaling when interpreting ∥w∥\|w\|Without fixing min⁡iyi(w⊤xi+b)=1\min_i y_i(w^\top x_i+b)=1, ∥w∥\|w\| has no meaningful relationship to marginAlways verify the tightest constraints equal exactly 1 before reading off γ=1/∥w∥\gamma = 1/\|w\|
Computing bb from an arbitrary point instead of a support vectorNon-support-vector points satisfy the constraint with slack, giving a wrong bbRecover bb only from points where αi>0\alpha_i > 0, ideally averaged
Treating the dual's inner products as "just an implementation detail"Missing that this structural fact is what later enables kernelsRecognize xi⊤xjx_i^\top x_j as the sole point of contact between data and optimization — replaceable by any kernel
Believing wide margin always means better test accuracyMargin bounds generalization risk but a single mislabeled outlier can shrink the achievable margin arbitrarilyPair margin maximization with the soft-margin slack variables for robustness

Pioneers & history

The maximum-margin idea traces back to Ronald Fisher's and Frank Rosenblatt's era of linear discriminants, but its rigorous convex-optimization formulation and the "support vector" terminology originate with Vladimir Vapnik and collaborators, developed alongside the broader statistical learning theory that explains why margin maximization improves generalization.

Origins · 1 minVladimir Vapnik and how this was discovered
VV
Vladimir Vapnik
1936–present · Soviet and later Bell Labs/AT&T researcher who co-founded statistical learning theory and, with Alexey Chervonenkis, developed the VC dimension framework that explains why maximizing margin controls generalization error

History
1963
Vapnik and Chervonenkis begin developing statistical learning theory and the generalized portrait algorithm, an early linear maximum-margin classifier.
1974
Vapnik and Chervonenkis formalize VC dimension, providing the theoretical basis for margin-based generalization bounds.
1992
Boser, Guyon, and Vapnik introduce the kernelized maximum margin classifier, combining the margin idea with the kernel trick.
1995
Cortes and Vapnik publish the soft-margin SVM with hinge loss, making the method practical for non-separable, noisy real-world data.
1998-2000
s: SVMs become a dominant method for text classification, bioinformatics, and image recognition before the rise of deep learning.

Where this matters

Support vector machines were, for roughly fifteen years, the default high-performance classifier for tabular and moderate-dimensional data before deep learning displaced them for perceptual tasks. They remain heavily used today in domains where the number of features can be large relative to the number of samples, or where interpretability and theoretical guarantees matter — bioinformatics (gene expression classification), text categorization, and any pipeline emphasizing convex, reproducible optimization over stochastic non-convex training. Production machine learning libraries such as scikit-learn's `SVC`, and specialized solvers like LIBSVM and LIBLINEAR, implement exactly the dual QP and SMO-style decomposition described here, and remain standard baselines against which newer classifiers are benchmarked. The margin-maximization principle itself resurfaces well beyond classic SVMs: margin-based generalization bounds inform the analysis of deep neural network robustness, and the geometric idea of maximizing distance to a decision boundary underlies adversarial robustness research, where practitioners explicitly try to widen the margin of a neural classifier against adversarial perturbations. The dual formulation's dependence on inner products alone is the direct ancestor of every kernel method used today, from Gaussian process regression to kernelized PCA.

Ask the tutor: How does introducing slack variables in the soft-margin SVM change the dual problem, and why does that let us handle non-separable and noisy data gracefully?

How is the SVM different from logistic regression if both are linear classifiers?

Both learn a linear decision boundary w⊤x+bw^\top x + b, but they optimize different objectives. Logistic Regression and the Sigmoid minimizes log-loss over probabilistic outputs, smoothly penalizing every point based on how far it is from the boundary in either direction. The hard-margin SVM instead maximizes geometric distance to the boundary, ignoring points beyond the margin entirely once they're correctly classified with enough slack. This is why SVMs produce sparse solutions (only support vectors matter) while logistic regression's solution generally depends on every training point. In practice, the soft-margin SVM's hinge loss sits conceptually between these two extremes.

What happens if the data is not linearly separable — does the hard-margin SVM still work?

No. The hard-margin primal QP requires every point to satisfy yi(w⊤xi+b)≥1y_i(w^\top x_i+b)\ge 1 simultaneously, and if classes overlap even slightly, this feasible region is empty. A solver will report infeasibility or fail to converge. The fix is the soft-margin SVM, which introduces slack variables ξi≥0\xi_i \ge 0 allowing controlled constraint violations, penalized in the objective. That formulation, covered in Soft Margins and Hinge Loss, reduces to the hard-margin case exactly when the penalty weight is driven to infinity and the data happens to be separable.

Why do we call the dual variables αi\alpha_i and what do nonzero values mean?

The αi\alpha_i are Lagrange multipliers introduced to enforce the primal's inequality constraints inside a single unconstrained Lagrangian function. By the Karush-Kuhn-Tucker complementary slackness condition, at the optimum αi\alpha_i is nonzero only if the corresponding constraint is active (tight), meaning xix_i lies exactly on the margin boundary. Points strictly inside their class region, farther than the margin, get αi=0\alpha_i = 0 and contribute nothing to w=∑iαiyixiw = \sum_i \alpha_i y_i x_i. This is precisely the mechanism producing the sparse "support vector" representation.

Can the hard-margin SVM handle more than two classes?

Not directly — the formulation as written is inherently binary, since labels are constrained to {−1,+1}\{-1,+1\} and the hyperplane separates exactly two half-spaces. Multi-class extensions use strategies layered on top of the binary SVM: one-vs-rest (train kk binary classifiers, one per class against all others), one-vs-one (train (k2)\binom{k}{2} pairwise classifiers and vote), or structured formulations that directly generalize the margin concept to multi-class outputs. None of these change the underlying binary QP; they simply combine multiple binary SVMs.

Why does maximizing margin actually improve generalization, rather than just being a nice geometric idea?

Statistical learning theory ties margin directly to generalization via VC-dimension-style arguments: classifiers with large margin relative to the data's scale have effectively lower complexity, because fewer distinct hyperplanes can achieve a wide margin on any given dataset than can achieve zero margin. This yields bounds on generalization error that scale with 1/γ21/\gamma^2 (inversely with the square of the margin) rather than with the raw dimensionality dd of the input space. That is why SVMs can perform well even when dd is very large — the relevant complexity measure is the margin, not the ambient dimension.

Is the QP solved directly with generic solvers in practice, or is something smarter used?

Generic interior-point QP solvers work for small to moderate nn, but they scale poorly (roughly cubic in nn) because they manipulate the full n×nn\times n system. Practical SVM libraries use decomposition methods, most famously Sequential Minimal Optimization (SMO), which analytically solves the smallest possible sub-problem — updating just two αi\alpha_i at a time, since the equality constraint ∑iαiyi=0\sum_i \alpha_i y_i=0 makes single-variable updates infeasible. This avoids ever forming or factorizing the full Gram matrix, and is why SVM training became tractable for datasets with many thousands of points.

How does the hard-margin SVM connect forward to kernels?

The dual objective and the final decision function depend on the training data exclusively through inner products, xi⊤xjx_i^\top x_j during training and xi⊤xx_i^\top x at prediction time. This means the entire algorithm can be rewritten using any function K(xi,xj)K(x_i,x_j) that behaves like an inner product in some (possibly infinite-dimensional, possibly nonlinear) feature space, without ever computing that feature space explicitly. This substitution, explored in Kernels and the Kernel Trick, is what allows SVMs to learn nonlinear decision boundaries while still solving a convex QP.

Before this

Where this leads