The idea
Boosting builds a strong model as a running sum of weak ones, each new term fitted to what the sum so far still gets wrong:
The magic is what is trained on. Gradient boosting treats the current predictions as free parameters and asks: in which direction should each prediction move to decrease the loss fastest? That direction is the negative gradient — the pseudo-residuals:
A small tree is then fit to the pairs — a projection of the ideal descent direction onto the tree function class — and added with step size . This is gradient descent in function space. For squared error the gradient is literally the residual ; for log loss it is ; for MAE it is . Swap the loss, keep the machinery — that generality is why the same library does regression, classification, and ranking.
Why this reduces bias (and bagging cannot). Bagging averages parallel copies of the same low-bias model: noise cancels, but shared systematic error survives averaging perfectly intact. Boosting starts from a high-bias model and sequentially extends it — every round adds capacity aimed at the current error. With a learner that approximates a descent direction and a suitable step size, training loss generally falls and bias can shrink; neither is guaranteed for an arbitrary fitted tree or step. The mirror image: because later trees chase whatever error remains, enough rounds will start fitting noise — variance rises, test loss traces a U against rounds, and early stopping is not optional hygiene but part of the algorithm.
Hence the trademark settings, all of them variance guards on a bias-killing machine: shallow trees (depth 3-8; depth also caps interaction order), shrinkage (many small steps correct each other; halve , roughly double the rounds), row/column subsampling (stochastic gradient boosting — implicit bagging inside the loop), and penalized leaf weights in the modern implementations (XGBoost adds to the objective and uses second-order gradients to fit each tree).
Worked example
Four points, squared-error loss, trees replaced by a single split at for legibility:
| 1 | 1 | 10 |
| 2 | 2 | 12 |
| 3 | 3 | 20 |
| 4 | 4 | 22 |
Round 0. for everyone. Residuals: . MSE .
Round 1. Fit a stump to the residuals: left leaf () predicts the mean residual ; right leaf predicts . With :
New residuals: . MSE .
Round 2. Stump on the new residuals: leaf means and .
Residuals: . MSE .
Two things to notice. The group-level error halves every round — the leaf-mean residual is — so the systematic gap between the two groups (pure bias at round 0) decays geometrically: shrinkage slows the descent but never stops it. And what remains inside each leaf ( a couple of points) is exactly what further identical splits cannot fix — later rounds would need finer splits, and on real noisy data those finer splits are where overfitting begins.
Cheat sheet
Algorithm: ; repeat: , fit tree to , ; stop by validation loss.
Pseudo-residuals by loss: squared error → ; log loss → ; MAE → ; that swap is the whole generalization.
| Knob | Controls | Typical |
|---|---|---|
| learning rate | step size; generalization | 0.01-0.1; smaller = more rounds |
| n_estimators + early stopping | total capacity | large budget, let validation stop it |
| max_depth / num_leaves | interaction order, per-tree capacity | 3-8 deep |
| subsample (rows) | variance, speed | ~0.8 |
| colsample (features) | tree decorrelation | 0.5-1.0 |
| L1/L2 on leaves, | leaf-weight shrinkage, split gating | XGBoost/LightGBM extras |
- Bagging = parallel + deep trees + averaging ⇒ variance down, bias flat. Boosting = sequential + shallow trees + additive corrections ⇒ bias down, variance creeps up with rounds.
- Forest error flattens with more trees; boosting test error is U-shaped in rounds ⇒ early stopping mandatory.
- and rounds trade off almost linearly; tune them as a pair.
- Boosting is sequential ⇒ does not parallelize across trees (libraries parallelize within a tree's split search instead).
- Sensitive to label noise/outliers with squared or exponential loss — use Huber/MAE or subsampling.
- XGBoost vs classic GBM: second-order Taylor fit per tree, regularized objective, sparsity-aware splits; LightGBM: histogram splits + leaf-wise growth (faster, watch overfitting on small data).
- No feature scaling needed (still trees). Probabilities usually need calibration.