Subgradients
Kinks have no single slope, but every line touching from below still works. Subgradients collect those lines so nonsmooth convex problems run.
Why Does This Exist?
Lasso, SVM hinges, and ReLU all kink: no gradient at zero, yet optima sit exactly there. Demanding differentiability either smooths away the sparsity you wanted or stalls at the interesting point. Training sparse and robust models needs calculus that works at corners.
Subgradients supply it: is a subgradient at when f(y) \\geq f(x) + g^\\top(y - x) everywhere, a global under-estimator. The set drives optimality (0 \\in \\partial f(x^\\star)) and the subgradient method. It extends convex sets and functions into the nonsmooth half of convex optimization.
The one idea you need first
A convex smooth function's tangent sits below the graph. At a kink, several lines do. For : left slope , right slope , and at 0 every under-supports. Zero belongs, so 0 is optimal.
Think of It Like This
Propping a tent at the pole
A tent's peak is a kink: no single roof slope exists there. Any plank touching the peak from below without piercing canvas is a valid prop. Steep planks lean left or right; a flat plank balances on top.
All props certify the peak holds canvas up. Where it stops: planks are straight and global, so on non-convex tents (sagging canvas) a local prop can pierce far away and the certificate fails.
How It Actually Works
Calculus: (mild conditions), chain and max rules extend by convex hulls. Optimality 0 \\in \\partial f(x^\\star) is necessary and sufficient for convex . Subgradient method with diminishing steps () converges in function value: slow but universal. Lasso uses soft-thresholding: .
Worked example
Minimize : smooth part pulls toward 0.4, kink pulls toward 0. Subgradient condition: . Try : , so need , i.e. . Certified: w^\\star = 0. Lasso step check from , , : shrink crosses zero . Sparsity in one line.
Code
w = 0.4alpha, lam = 0.5, 1.0w = float(__import__('math').copysign(max(abs(w) - alpha * lam, 0.0), w))print(round(w, 2)) # -> 0.0Shrinkage zeroes 0.4 in one proximal step. The kink eats small weights exactly, which is the sparsity mechanism.
Watch Out For
Fixed steps on the subgradient method
Constant on nonsmooth objectives oscillates around the kink forever: the method steps over zero by each time and never settles. Loss plateaus above optimum and teams blame the model.
Diminish () or switch to proximal/bundle methods. If iterates bounce across zero with fixed amplitude, the schedule is the bug.
Picking ReLU subgradient 1 at zero everywhere
Autodiff returns 0 or 1 at ReLU zero arbitrarily per framework. A network with many dead units plus subgradient 1 leaks phantom signal; with 0 it kills recovery. Either choice biases thin-margin behavior.
Treat exact-zero as measure-zero noise in training, but audit dead-unit counts. If dead units dominate, the kink convention is not your problem; initialization is.
The Quick Version
- Subgradients are global linear under-estimators; the set at a kink replaces the missing gradient.
- has ; zero inside certifies optimality.
- Lasso zeroes small weights by soft-thresholding in one step.
- The subgradient method needs diminishing steps and runs .
- Optimality 0 \\in \\partial f(x^\\star) is necessary and sufficient for convex .
- Fixed steps oscillate; ReLU-at-zero conventions need auditing, not worship.