Both XGBoost and LightGBM build gradient-boosted ensembles of decision trees, but they decide which node to split next in very different ways. This simulation grows one tree from each library, live, in 3D, so you can watch the difference in shape rather than just read about it.
max_depth and num_leaves caps.LightGBM's name is a pun — it is literally a "lighter", faster gradient boosting machine, achieved partly through leaf-wise growth and partly through gradient-based one-side sampling and exclusive feature bundling, tricks that shrink both the rows and columns considered at each split.
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.
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.
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.
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.