Random forest vs gradient boosting: how does each work, and why do tree ensembles still beat neural networks on tabular data?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
They sit on opposite sides of the bias-variance lever. Random forest is bagging: train many deep trees in parallel, each on a bootstrap sample and each split considering a random feature subset, then average. Deep trees are low-bias and high-variance; averaging decorrelated trees kills the variance. Adding trees never hurts, so it is hard to overfit by tuning.
Full worked answer with diagram
They sit on opposite sides of the bias-variance lever. Random forest is bagging: train many deep trees in parallel, each on a bootstrap sample and each split considering a random feature subset, then average. Deep trees are low-bias and high-variance; averaging decorrelated trees kills the variance. Adding trees never hurts, so it is hard to overfit by tuning.
Gradient boosting is sequential: each shallow tree fits the negative gradient of the loss with respect to the current ensemble's predictions (for squared error, literally the residuals), so every round reduces bias. It usually wins on accuracy, but it will overfit if you keep adding rounds, so learning rate, depth, subsample and early stopping actually matter. In practice that means LightGBM, XGBoost or CatBoost with a validation set wired into early stopping.
Why trees beat MLPs on tabular:
- Invariance to monotone transforms. Splits are thresholds, so no scaling, no log transforms, no outlier surgery. Neural nets need all of that.
- Heterogeneous, non-smooth features. MLPs are biased toward smooth functions; tabular targets are often irregular step functions of a few features. That bias is a mismatch.
- Robustness to uninformative columns. Trees just never split on them; an MLP has to learn to ignore them, which costs data.
- Mixed types and missing values handled natively, plus categorical handling in CatBoost/LightGBM.
- Small data. Most tabular datasets are thousands to millions of rows, where inductive bias matters more than capacity.
Neural nets win when there is structure to exploit: high-cardinality entities you want shared embeddings for, multi-modal input (free text or images beside the table), or transfer from a pretrained model. The honest default in 2026 is still: LightGBM baseline first, and make anything fancier beat it. The one real crack is small data: tabular foundation models such as TabPFN v2 do in-context prediction on tables up to roughly ten thousand rows and are competitive with tuned GBDTs there, so they belong in the baseline set for small problems. At scale, boosted trees still dominate.
Common misconception to avoid: saying random forest "boosts", or quoting n_estimators=1000 for GBDT with no early stopping.
Worth sketching. Parallel arrows against a feedback loop makes the variance-versus-bias distinction visual rather than memorised.
flowchart LR
A["Bootstrap samples"] --> B["Deep tree 1"]
A --> C["Deep tree 2"]
A --> D["Deep tree k"]
B --> E["Average: variance down,<br/>adding trees never hurts"]
C --> E
D --> E
F["Residual of the<br/>current ensemble"] --> G["Shallow tree t"]
G -->|"add, scaled by learning rate"| H["Ensemble: bias down,<br/>needs early stopping"]
H --> F
What a good answer covers
- They sit on opposite sides of the bias-variance lever
- Random forest is bagging: train many deep trees in parallel, each on a bootstrap sample and each split…
- Deep trees are low-bias and high-variance; averaging decorrelated trees kills the variance
- Adding trees never hurts, so it is hard to overfit by tuning
- Gradient boosting is sequential
Key terms: Random forest · Gradient boosting · Invariance to monotone transforms · Heterogeneous, non-smooth features · Robustness to uninformative columns · Mixed types and missing values · Small data
In the glossary: Accuracy · Early stopping
Interviewer follow-ups to expect
Why does CatBoost's ordered target encoding exist, and what leakage does it prevent?
How would you get calibrated probabilities out of a boosted tree?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep