Gradient Boosting as Functional Gradient Descent
Any differentiable loss, shrinkage and stochastic boosting.
Boosting is gradient descent in a space of functions, with each step projected onto what a small tree can represent. Making that precise explains a great deal: why AdaBoost is a special case, how Newton steps enter, why boosting a smoother acts as a spectral filter whose bias falls exponentially, why small steps make boosting trace a path close to the lasso, and when stopping early makes it consistent.
What you’ll learn
- Formulate boosting as functional gradient descent, and derive per-leaf line searches and the Newton (second-order) variant.
- Derive the operator of -boosting a linear smoother, and its exact bias and variance.
- Show that small-step boosting is steepest descent in the geometry, and relate it to forward stagewise regression, the lasso path and the maximum-margin vote.
- State convergence and consistency results for boosting with early stopping, and explain the role of subsampling.
Gradient descent with a projection
Let be the empirical risk of a function , with the empirical inner product . Its gradient at is the vector with at . The steepest-descent direction is defined only on the sample and is not a tree, so each round chooses the base function that best represents it, takes a step along , and repeats. Two choices of "best" are standard:
- AnyBoost (Mason, Baxter, Bartlett & Frean, 2000): maximize the directional derivative, , natural when has normalized functions such as classifiers.
- Gradient boosting (Friedman, 2001): fit to by least squares, natural for regression trees, whose scale is free.
For -valued the two agree, since . Either way, a line search (or a small fixed step ) follows.
For with , the gradient puts weight on each example:
Normalizing those weights into a distribution , the directional derivative is the edge under , so the best classifier is the one with the smallest weighted error:
An exact line search along gives , as derived in AdaBoost & the Exponential Loss. With the binomial deviance instead, the same recipe yields LogitBoost-style updates; with squared loss, residual fitting.
Per-leaf line search. A tree with leaves is , and the leaves are disjoint, so the loss after the step separates over leaves. Friedman's TreeBoost keeps the tree's partition from the least-squares fit and replaces its leaf values by separate line searches, : in effect, coefficients per round instead of one.
Expand the loss to second order around the current fit, with and evaluated at :
Complete the square. The step is a weighted least-squares fit of the targets with weights :
On a leaf, where is a constant , the minimizer is a Newton step; for log loss with it is :
Friedman's gradient boosting uses the second derivative only for the leaf values; Newton boosting also grows the tree on the weighted problem, as LogitBoost does (Friedman, Hastie & Tibshirani, 2000) and as XGBoost does with an added penalty (XGBoost, LightGBM & CatBoost). For squared loss, and the two coincide.
For the squared loss , how do gradient boosting and Newton boosting differ?
- Newton boosting converges in a single round
- Newton boosting fits the residuals divided by their variance
- Gradient boosting cannot use the squared loss
- They are identical: the second derivative is 1, so the Newton targets are the residuals and every weight is 1
Show the answer
D. They are identical: the second derivative is 1, so the Newton targets are the residuals and every weight is 1
With and , the weighted least-squares problem is the ordinary residual fit. The two methods differ only for losses with non-constant curvature, such as log loss, where the weights emphasize uncertain examples.
Boosting a linear smoother
Trees adapt their partition to the data, which makes exact analysis hard. Bühlmann & Yu (2003) analyzed -boosting (squared loss) with a linear base learner instead: a smoother that maps responses to fitted values, , such as a smoothing spline or a kernel smoother. The algorithm starts from and repeatedly adds the smoothed residuals: . With one extra step this is Tukey's "twicing".
Each round multiplies the residual vector by , so after rounds the fit is a fixed linear map of (Bühlmann & Yu's Proposition 1):
Let be symmetric with eigenvalues , as for smoothing splines. Then has the same eigenvectors and filters each direction (with shrinkage , replace by ):
With , and , the averaged squared bias and variance follow coordinate by coordinate (Proposition 3):
The filter belongs to the same family as ridge regression's and early-stopped gradient descent's , where are the singular values of the design matrix (Ridge Regression in Depth): strong directions are fitted early and weak ones late, and the number of rounds acts as the regularization parameter. For small , , so the path depends on and mainly through the product , the "time" of a gradient flow.
A direction of the smoother has eigenvalue , and you boost with . How many smoother fits until that direction is fitted to at least 90%, that is, until ?
Show the answer
22 fits
Each fit keeps a fraction of that direction's remaining residual, so we need , that is : 22 fits. A direction with would need 230. Weak directions, where the smoother distrusts the data, are fitted last, which is exactly why stopping early regularizes.
Small steps, the ℓ1 geometry and the lasso path
Strip boosting down to linear regression with the dictionary of single standardized predictors, and shrink the step to a tiny . The result is forward stagewise regression:
FORWARD_STAGEWISE(standardized X, centered y, step eps, rounds T)
beta = 0; r = y
for t = 1..T:
j = argmax_k |x_k . r| # predictor most correlated with the residual
s = sign(x_j . r)
beta_j = beta_j + eps * s # move that single coefficient a tiny step
r = r - eps * s * x_j
return betaBoosting with squared loss, base learners and shrinkage . Replace the columns by a dictionary of trees and it is -boosting.
Among all steps of length , the one that decreases a differentiable fastest to first order minimizes a linear function over the ball, and that happens at a vertex, a single coordinate:
For with standardized columns, the negative partial derivative is the correlation with the residual, so the steepest step is the forward-stagewise step:
Gradient descent is the same construction over the ball, whose minimizer is the whole negative gradient. The norm that defines "steepest" is what separates the two paths:
Each stagewise step raises by at most while lowering the loss as fast as possible, so the path roughly minimizes the loss at each budget: the lasso problem in constrained form. Efron, Hastie, Johnstone & Tibshirani (2004) made this precise for squared loss: as the stagewise path is computed by a modification of their LARS algorithm, and it coincides with the lasso path in simple cases such as orthogonal predictors; in general the two paths can differ, though they are often close.
This links the two halves of boosting theory. The quantity in the display is exactly the minimum margin of a vote from Why Boosting Resists Overfitting, and running boosting longer with small steps corresponds to relaxing the budget. It is the boosting counterpart of gradient descent's drift toward the maximum-margin direction on separable logistic regression (The Implicit Bias of Gradient Descent): no penalty is written down, yet the optimizer's geometry decides which of the many zero-loss solutions it approaches.
Forward stagewise regression with a tiny step moves one coefficient at a time and has no penalty term. Why does its coefficient path resemble the lasso's?
- Because it soft-thresholds every coefficient after each step
- Because each step is the steepest-descent step within a small ball, so the loss falls as fast as possible per unit of norm
- Because it minimizes explicitly
- Because it works only with orthogonal predictors
Show the answer
B. Because each step is the steepest-descent step within a small ball, so the loss falls as fast as possible per unit of norm
A linear function on the ball is minimized at a vertex, a single coordinate. Following those steps keeps the norm as small as possible for the loss achieved so far, which is what the lasso path does in constrained form.
Convergence, consistency and stochastic boosting
Optimization. For convex losses, greedy boosting over the span of a dictionary drives the empirical loss to its infimum over that span, under suitable step-size rules (Zhang & Yu, 2005). On separable data with exponential-type losses the infimum is approached only as the coefficients diverge, which is why the direction, not the size, of the vote is the interesting object.
Statistics. Running to convergence overfits: -boosting of a smoother interpolates the data (), and AdaBoost with noisy labels fits the noise. Consistency comes from stopping early. Zhang & Yu (2005) give early-stopping strategies under which boosting is consistent for i.i.d. samples, with bounds on the rates; Bühlmann & Yu (2003) obtain minimax rates for boosted splines; Bartlett & Traskin (2007) show AdaBoost is consistent when stopped after rounds. In practice the stopping round is chosen on validation data.
Stochastic gradient boosting. Friedman (2002) fitted each tree, and its leaf values, on a random fraction of the rows drawn without replacement, and found that this improved accuracy as well as speed. Two readings help. The random subsets decorrelate successive trees and average out some of their noise, like bagging. And each round now follows a noisy estimate of the functional gradient, computed on a random subsample, like a mini-batch step of SGD. Subsampling also blunts, without removing, a subtle bias that comes from computing gradients on the same points the model was trained on (Prokhorenkova et al., 2018); XGBoost, LightGBM & CatBoost shows how ordered boosting removes it.
Key takeaways
- Boosting is functional gradient descent: each round projects the negative gradient onto the base class, by maximizing (AnyBoost) or by a least-squares fit (gradient boosting), then steps along it; with the exponential loss this is AdaBoost.
- Newton boosting fits with weights , and its leaf values are ; for squared loss it coincides with gradient boosting.
- -boosting a linear smoother gives : bias falls exponentially and variance grows by exponentially small amounts; with a spline learner and early stopping it attains the minimax rate and adapts to unknown smoothness.
- Small steps make boosting steepest descent in the geometry: forward stagewise regression tracks the lasso path, and on separable data the normalized vote approaches an maximum-margin solution.
- Boosting's loss converges to its infimum, but consistency needs early stopping; row subsampling (stochastic gradient boosting) adds speed and a bagging-like variance reduction.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
In AnyBoost with the exponential loss and base classifiers, which base classifier maximizes ?
- The one with the smallest unweighted training error
- The one with the smallest error under weights proportional to
- The one most correlated with the current score
- The one that misclassifies the fewest points with positive margin
Show the answer
B. The one with the smallest error under weights proportional to
The gradient of weights each example by , and the directional derivative equals the edge under the normalized weights: AdaBoost's weak-learning step.
The base learner is least squares on a fixed set of basis functions, so is a projection. What does -boosting do after its first step?
- It converges to the interpolant of the data
- It doubles the fit at every step
- Nothing: the residuals are orthogonal to the basis, so every later fit is zero and
- It slowly adds the components outside the basis
Show the answer
C. Nothing: the residuals are orthogonal to the basis, so every later fit is zero and
After the first fit, is orthogonal to the column space of , so . Boosting needs a weak learner, one that shrinks (), to have anything to add.
A leaf of a log-loss Newton step holds 5 examples, all currently predicted at , and 2 of them are positive (). What is the leaf value , in log-odds?
- 0.2
- 1.0
- 1.25
- 0.8
Show the answer
C. 1.25
and , so the step is . The log-odds move from to about , a probability near 0.47: one Newton step overshoots the leaf's empirical rate of 0.4, which an exact line search () would hit.
On linearly separable data, gradient descent on the logistic loss of a linear model drifts toward the maximum-margin direction. Toward what does small-step boosting over a dictionary of base classifiers drift?
- The same maximum-margin direction
- The vote with the fewest base classifiers
- The minimum-norm interpolant
- An maximum-margin vote,
Show the answer
D. An maximum-margin vote,
Each small boosting step moves one coefficient, the steepest descent direction in the geometry, and Rosset, Zhu & Hastie (2004) showed that boosting approximately follows the -regularized path, whose normalized limit on separable data maximizes the margin. The geometry of the optimizer selects the solution.
Further reading
- J. H. Friedman, "Greedy function approximation: a gradient boosting machine," Annals of Statistics 29(5), 1189–1232 (2001).
- L. Mason, J. Baxter, P. Bartlett & M. Frean, "Boosting algorithms as gradient descent," Advances in Neural Information Processing Systems 12, 512–518 (2000).
- P. Bühlmann & B. Yu, "Boosting with the L2 loss: regression and classification," Journal of the American Statistical Association 98(462), 324–339 (2003).
- S. Rosset, J. Zhu & T. Hastie, "Boosting as a regularized path to a maximum margin classifier," Journal of Machine Learning Research 5, 941–973 (2004).
- T. Zhang & B. Yu, "Boosting with early stopping: convergence and consistency," Annals of Statistics 33(4), 1538–1579 (2005).