How LightGBM trains — leaf by leaf
Same gradient/Hessian + gain math as XGBoost, but a fundamentally different growth strategy: leaf-wise (best-first) instead of level-wise. At every step, LightGBM splits the leaf that promises the highest gain — not whichever one happens to be at the current depth. This gives faster loss reduction per leaf, but produces unbalanced, deep-on-one-side trees.
XGBoost grows level-wise: split every node at depth d before any node at depth d+1.
Tree depth is the natural complexity knob (max_depth).
LightGBM grows leaf-wise: maintain a priority queue of current leaves and always split the one with
the largest potential gain. The natural complexity knob is the total number of leaves
(num_leaves). A LightGBM tree can be very deep on one branch and very shallow on another.
Watch the priority queue panel below — you can see which leaf gets chosen and why.
Task & objective
// what we're predictingHyperparameters
// LightGBM-flavoured knobs · changes reset the modelTraining controls
// one leaf-split, one tree, or all at onceLeaf priority queue
// every current leaf, ranked by its best-possible gain — top one splits nextStart growing a tree; this queue will show every current leaf with its potential gain.
Why this split?
// gain math for the chosen leafTake a leaf-split to see the gain calculation here.
Tree → ensemble update
// Fnew(x) = Fold(x) + η · tree(x) — same as XGBoostFinalize a tree (click ▶ Next tree) to see the update.
Ensemble history
// one row per finished treeNo trees yet.