← 🌳 Machine Learning

🌳 Tree Growth Lab

XGBoost — level-wise

Leaves:
Depth reached:
Gain recovered:

LightGBM — leaf-wise

Leaves:
Depth reached:
Gain recovered:

Simulated training time

XGBoost:
LightGBM:
Speed-up:
FPS:
Drag — rotate · Scroll — zoom

🌳 XGBoost vs LightGBM: Leaf-Wise Growth and the Speed Trade-off

Two gradient-boosted decision trees grow side by side in 3D — XGBoost's balanced, level-wise splitting on the left and LightGBM's greedy, leaf-wise splitting on the right — so you can see exactly why the same leaf budget produces two very different tree shapes.

🔬 What It Demonstrates

XGBoost's default strategy splits every leaf at the current depth before going deeper, producing a wide, symmetric tree. LightGBM always splits whichever leaf has the highest loss-reduction ("gain"), producing a narrower, lopsided tree that chases the biggest wins first.

🎮 How to Use

Set the target leaf count and the shared max-depth cap, then watch both trees regrow. Slide the dataset-size control to see how the simulated training-time gap between the two libraries widens as row count grows.

💡 Did You Know?

LightGBM's leaf-wise growth can reach a lower training loss with fewer leaves than XGBoost's level-wise growth — but the same greediness makes it more prone to overfitting small datasets without a tight depth or leaf-count cap.