TL;DR
A function is smooth when its graph has no corners, kinks or jumps, so its slope changes gently. In optimization the word has a sharper meaning: a function is -smooth when its gradient can change no faster than a fixed rate . That single bound is what lets gradient descent take a step of size and be sure the function goes down.
Where you'll see it: in the convergence proofs of Gradient Descent, in the choice of its step size, and in the analysis of training losses such as the squared error of Linear Regression.
Intuition
Picture a road. A smooth road has no sharp corners where you would have to stop and turn, and its steepness changes gradually. A road with a corner has a point where the steepness jumps in an instant.
Now think about walking downhill on a foggy hill. You can only see the slope under your feet. If the slope could change suddenly, a step that looked safe could land you on a steep wall. If the slope changes at most at some known rate, you can estimate how far you will go before the terrain changes under you, and choose a step that is safe.
That is the reason the optimization definition exists. Gradient descent moves a point against the Gradient, which is the vector of partial derivatives. It works well when the gradient at one point tells you something reliable about the gradient nearby. Smoothness is the promise that it does.
The plot below shows three shapes. is smooth everywhere. has a corner at zero, where the slope jumps from to . has a flat, gentle bend at zero, and it is the kind of function that is smooth enough for optimization even though its curvature jumps.
- x^2 (smooth)
- x|x| (slope is continuous)
- |x| (corner at 0)
The math
Two different definitions go by the name smooth. Keep them apart.
A function is smooth, or , when it has derivatives of every order and each one is continuous. It is when has a continuous first derivative. Polynomials, and are smooth everywhere they are defined.
Let be differentiable, and let be a number. Then is -smooth when its gradient is -Lipschitz:
Here is the Euclidean length, and is the smallest number that makes the inequality hold, called the smoothness constant.
The second definition asks about the gradient, not the function. The gradient may be continuous and bounded in slope change even when the function is not . This matters below.
Two checks you can run by hand
For a one-variable function, the definition says that the derivative is -Lipschitz. If is twice differentiable, a simpler test works: is -smooth when for all . In several variables the same role is played by the Hessian , the matrix of second partial derivatives. A twice-differentiable is -smooth when every eigenvalue of the Hessian, at every point, has absolute value at most .
The descent lemma
The key consequence is a bound on how much the function can curve above its linear approximation. For an -smooth , for all ,
Read it in words. The right side is the tangent-plane guess at , plus a quadratic penalty. The function is never higher than its tangent plane plus that penalty.
Why it holds. Write as the integral of the directional change along the segment from to , subtract the tangent term, and bound the leftover with the Lipschitz condition. The gap is . Each integrand is at most , and .
Why this gives a safe step size
Take a gradient step and put into the descent lemma. Let . Then and , so
Every step lowers the function by at least . The step size is not a guess. It is the value the proof needs. This is the core reason Gradient Descent converges on smooth problems.
Smooth is not the same as with a bound
A function need not be -smooth on the whole line. The function is smooth in the calculus sense, but its derivative grows without bound, so no single works everywhere. It is -smooth on any bounded interval, which is often enough in practice.
The converse also fails. The function is only , but its derivative has Lipschitz constant , so is -smooth in the optimization sense.
Worked examples
Take . Its derivative is .
- Find . , so .
- Start at . Here and .
- Take the step : .
- The new value is .
- Check the bound . The right side is .
The bound is exact here. One step reaches the minimum, which happens because the parabola is the simplest smooth curve.
Take , written as with .
- The Hessian is , a constant matrix. Its eigenvalues are and , so .
- Start at . The gradient is , and .
- Compute .
- Take the step : .
- Compute .
- Check the bound: .
Since , the bound holds. The step lowered the value by more than the guaranteed amount. Notice the step size was set by the stiffest direction, , which is why the gentler direction converges slower.
A linear regression loss is . Here and (with the transpose of ), a constant matrix. So is -smooth with equal to the largest eigenvalue of .
Take with rows , , and .
- Compute . Its trace is and its Determinant is , so its eigenvalues are .
- The largest is .
- Start at . Then , and . So .
- Compute .
- Take the step : .
- Compute the residual , so .
- The bound says .
The loss fell from to about in one step, and the guarantee of holds. In practice the same argument tells a data scientist that a learning rate near is safe, and that a much larger one can make the loss grow.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Gradient steps with a step size above | The loss can grow from one step to the next, because the descent bound no longer holds. | Use a step at most , or line search. |
| is unknown or very large | The safe step is tiny and training is slow. | Estimate on the fly, or use adaptive methods such as Adam. |
| The function has corners, as with | No exists, and the gradient step can oscillate around the kink. | Use Subgradient or proximal methods. |
| The function is smooth only on a bounded region | The bound holds locally but a large step can leave the region. | Restrict steps, or use a line search. |
Smoothness is a worst-case promise over the whole domain. A function can be smooth in most places and fail the bound at one extreme point, and that one point is enough to break the global guarantee.
History
The calculus idea of a smooth function, one with derivatives of every order, grew out of the nineteenth-century work that made derivatives and continuity precise. The optimization sense, a bound on how fast the gradient can change, became central to the analysis of gradient methods in the second half of the twentieth century. Yurii Nesterov's work on fast gradient methods in the 1980s used this bound to prove convergence rates, and his later book made the condition standard. Modern texts, including the one by Boyd and Vandenberghe, use it as the working definition for analyzing Gradient Descent in machine learning.
Recap
A smooth function changes its slope gently. In optimization, the useful version is an -smooth function, whose gradient is -Lipschitz. That gives the descent lemma, which in turn gives the step size and a guaranteed decrease at every step. The same bound is the first step toward the convergence proofs of Gradient Descent.
Check yourself
QuestionWhat does the abbreviation L-smooth refer to, and what property of which object does it describe?Show answer
An -smooth function has a gradient that is -Lipschitz: the gradient changes by at most times the distance between the two input points. It describes the gradient, not the function's values directly, though it implies a bound on how far the function can rise above its tangent.
QuestionCompute the smoothness constant L of f(x) = 5x^2 and state the safe step size.Show answer
The derivative is . Then , so . The safe step size is . Using a larger step, for example , makes the iteration overshoot on this parabola.
QuestionWhy does the descent lemma imply that the gradient step with size 1/L reduces the loss?Show answer
Substituting into the descent lemma gives . The right side is strictly smaller than whenever the gradient is nonzero, so the loss falls at every step.
QuestionA function is C-infinity on the whole real line, but its derivative 3x^2 has no finite Lipschitz constant. Is it L-smooth? Explain.Show answer
No, not globally. Take . Its derivative grows without bound, so can be made as large as desired with and far from zero. No single works on all of . The function is still -smooth on any bounded interval, with set by the largest value of there.
QuestionSuppose you train a linear model whose loss has Hessian X^T X, and the largest eigenvalue of X^T X is 8. Which step size should you use, and why?Show answer
The smoothness constant is , so the safe step size is . The Hessian is constant for a linear model, so the bound holds everywhere, and a step of is guaranteed not to increase the loss. Steps larger than can make the loss grow.