Search

Search papers and lessons

Why do tree-based models still outperform deep learning on tabular data?

Léo Grinsztajn, Edouard Oyallon, Gaël Varoquaux · 2022

Grinsztajn, Oyallon and Varoquaux (2022) benchmark 45 tabular datasets and find that tree ensembles beat deep networks on medium-sized data, then trace the gap to how each model type treats the data.

On this page

  • Colour = topic mix
  • Probability
  • Linear algebra
  • Learning basics
  • Discrete math
  • Calculus
  • Classical models
  • ReadReady to readNot yet

TL;DR

Tabular data is the kind found in spreadsheets and database tables: one row per example, one column per feature, with numbers and categories mixed together. Grinsztajn, Oyallon and Varoquaux built a standard benchmark of 45 such datasets and tuned each model with the same search procedure. On medium-sized data (around 10,000 training rows) the tree-based models beat the deep networks they tested at every tuning budget. They then asked why, and found three properties of tabular data that trees handle and networks do not: the target is irregular, many features are useless, and the columns have individual meanings that a rotation would scramble.

Builds on: Gradient Boosting, Feedforward Neural Network, Hyperparameter Optimization, Inductive Bias · Leads to: Revisiting Deep Learning Models for Tabular Data and the later tabular-specific architectures it benchmarks against

Why it mattered

Deep learning won on images and text by building in structure: convolutions for pictures, sequence models for language. A common assumption after 2015 was that the same recipe would soon win on spreadsheet-style data. Practitioners in finance, medicine and industry kept using gradient-boosted trees, and data-science competitions kept being won by them, which made the question concrete: were the networks simply not good enough yet, or was something about the data that trees exploited and networks did not?

The paper changed how the field evaluates tabular methods. Before it, most papers that proposed a new network for tables compared it against a few baselines on a few datasets, with hyperparameters chosen by the authors. This benchmark fixes the dataset list, the tuning procedure and the score aggregation, and publishes the raw results of about 20,000 compute hours of search so that other researchers can compare against them without rerunning everything. The second contribution, the explanation, is what makes the paper useful beyond its leaderboard: it says which properties a tabular-specific network should have.

Decision trees and bagging were established long before the 2010s, and gradient boosting of trees matured in the early 2000s. Through the 2010s, tree ensembles were the default for tabular prediction in industry and competitions, and XGBoost (2016) made them much faster to train at scale. Meanwhile a line of papers proposed networks for tables, and most reported that they beat tree models on a handful of datasets. The results were hard to compare, because each paper chose its own datasets and its own tuning. Shwartz-Ziv and Armon (2021) argued that several new deep architectures for tables fail to generalise to new datasets.

The problem

Three things had to be settled before the comparison meant anything.

First, the datasets. A benchmark that includes images, time series or games tests things other than the question. The authors kept datasets whose columns are different features, dropped images and signal data where every column is the same sensor, dropped time series and streams, and removed games such as poker and chess where the target is a deterministic function of the input. They also removed datasets that were too easy: if a plain logistic regression came within 5% of both a default ResNet and a default histogram gradient-boosting model, the dataset was not discriminating enough to keep.

Second, the tuning. A model's score depends on its hyperparameters, and a method tuned carefully looks much better than one left at defaults. The question is how much search each model gets. The benchmark gives every model the same kind of search and reports results as a function of how much search was spent.

Third, the explanation. The best tabular methods the authors examined share two properties: they are Ensemble Learning methods (bagging or boosting), and the weak learner inside the ensemble is a Decision Tree. Other ensembles with other weak learners exist but are not used much on tables. So the real question is which properties of decision trees fit tabular data, and which properties of neural networks fit it badly.

How it works

The paper is an experiment plus an argument. Here is the pipeline it runs, in order.

flowchart LR
  A["45 tabular datasets"] --> B["Remove side issues: truncate to 10,000 rows, drop missing values"]
  B --> C["Random search over hyperparameters, about 400 iterations"]
  C --> D["Pick best model on validation set, score it on test set"]
  D --> E["Repeat with shuffled search order, 15 times"]
  E --> F["Normalise scores per dataset, average across datasets"]
  F --> G["Compare tree models with deep models at each search budget"]
  1. Start with a dataset. Take one table with 1,000 rows, 10 features and a binary label. Keep 70% of the rows for training, which is 700. Of the remaining 300, take 30% for validation (90 rows) and 70% for test (210 rows). The benchmark does this for each of its 45 datasets. Check: 700 + 90 + 210 = 1,000.
  2. Pick a search budget and a random order. Suppose the search is allowed 3 trials. A random search draws settings at random from a fixed space (for a tree model that might be tree depth and number of trees). The paper always starts with the default settings, so the first trial is the default. Check: 1 default + 2 random = 3.
  3. Score every trial on validation data. Say trial 1 gets 0.80, trial 2 gets 0.84 and trial 3 gets 0.82 on the validation set. The validation score is the only thing used to choose.
  4. Keep the best validation trial and test it once. Trial 2 wins with 0.84 on validation. Its test score, say 0.83, is the number recorded for budget 3. The test set is never used to choose the setting.
  5. Repeat with different orders. Shuffle the trials and redo steps 2 to 4 fifteen times. The 15 test scores give a spread, shown as a band in the paper's plots. Their mean is the estimate for budget 3.
  6. Increase the budget and repeat. Do this for budgets 1, 2, 3, up to about 400. The curve of test score against budget shows how fast each model improves with tuning.
  7. Put the datasets on one scale. Different datasets have different difficulty, so raw accuracy cannot be averaged fairly. Each score is mapped so that a reference model is 0 and the best model is 1 (details in the math section).
  8. Ask why. Change the data in controlled ways (smooth the target, add useless columns, rotate the columns) and see which models lose or gain. The three findings in the paper come from this step.

The headline result comes from steps 1 to 7: at every budget, the tree models sit above the networks. The explanation comes from step 8.

The math

The paper uses only simple quantities, but the aggregation across datasets is worth writing down, because it decides which model looks best.

Definition: Normalised score

For one dataset, let sms_{m} be the test score of model mm (accuracy for classification, R2R^2 for regression), let smax⁡s_{\max} be the best score any model reached on that dataset, and let sqs_{q} be the reference score: the score of the model at the 10% test-error quantile for classification, or the 50% test-error quantile for regression. The normalised score is

scorem=sm−sqsmax⁡−sq.\text{score}_m = \frac{s_m - s_{q}}{s_{\max} - s_{q}}.

It is 0 for a model at the reference quantile and 1 for the best model. For regression, negative values are clipped to 0.

Why a quantile and not the worst model? The worst model on a dataset is often an outlier, a run that failed. Using it as the floor would let one failure stretch the scale for every other model. A quantile is more representative of the dataset's difficulty.

Step 2 in symbols

The random search samples nn settings θ1,…,θn\theta_1, \dots, \theta_n from a space Θ\Theta, with θ1\theta_1 fixed to the default. After kk trials the procedure picks

θ^k=arg⁡max⁡i≤k  scoreval(θi),\hat{\theta}_k = \arg\max_{i \le k} \; \text{score}_{\text{val}}(\theta_i),

and reports scoretest(θ^k)\text{score}_{\text{test}}(\hat{\theta}_k). The test set appears only in the last term. Averaging over 15 shuffles of the order θ1,…,θn\theta_1, \dots, \theta_n gives the curve the paper plots against kk.

Step 4 in symbols, with the numbers from the walkthrough

In step 3 the validation scores were 0.80, 0.84 and 0.82. The argmax is trial 2, so θ^3=θ2\hat{\theta}_3 = \theta_2 and the reported test score is 0.83. The chosen index is the one with the best validation score, not the best test score.

Step 7 in symbols

Take a dataset where the best model scores smax⁡=0.90s_{\max} = 0.90 accuracy, the 10% quantile model scores sq=0.70s_{q} = 0.70, and a given model scores sm=0.85s_m = 0.85. Then

scorem=0.85−0.700.90−0.70=0.150.20=0.75.\text{score}_m = \frac{0.85 - 0.70}{0.90 - 0.70} = \frac{0.15}{0.20} = 0.75.

A model that matched the best would score 1, and a model at the reference quantile would score 0.

Results

Trees ahead at every budget. On medium-sized datasets with numerical features only, tree-based models (scikit-learn's random forest, gradient-boosted trees and XGBoost) score higher than every deep model tested at every random-search budget. The gap stays wide after a large number of iterations. The comparison favours the networks, since each random search iteration is generally slower for them than for the tree models, and the paper's time-based plots show this.

Categorical features are not the main problem. Many people think neural networks fail mainly on categorical columns. The paper finds a narrower gap with numerical features only, but most of the gap remains, so categories are not the whole story.

The three findings. Smoothing the target function hurts trees strongly and barely moves the networks, so the target functions in these datasets are irregular and networks are biased toward smooth ones. Adding random uninformative features widens the gap, because MLP-like networks are less robust to them; removing the least important features narrows it. Rotating the columns reverses the ranking: the networks move above the tree models. Only the ResNet is rotation-invariant in the paper's sense, and it stays strong, which is consistent with the original column basis carrying information that trees use.

Limits, stated by the paper. The study covers medium-sized data (10,000 training rows, with a separate check at 50,000 in the appendix) and numerical classification in the main analysis. Very small datasets, very large datasets, missing values and high-cardinality categories are open questions. The paper also does not show that networks cannot win: it shows that the tested ones, under this budget, do not, and it names embeddings and other ways to break rotation invariance as a direction for future work.

Common misreadings. It is tempting to read this as "neural networks are bad at tables." The paper measures them under one fixed budget, one set of search spaces and medium-sized data. It is also tempting to think trees win because they are "more powerful." They are not more expressive; the difference is inductive bias, the built-in assumptions a learner makes, which determine how it generalises when the target is irregular, when many features are useless, or when columns should not be mixed. Tree ensembles are fast, need little preprocessing and are robust to uninformative columns, but they are not differentiable, so they cannot be trained jointly with other neural components. Use the result for tabular-only prediction on medium-sized data, and treat the trade-off as different for very large tables or for pipelines that include neural parts.

Reading guide

The paper is short in its main text, with a long appendix of dataset lists and extra plots.

  • Abstract and Section 1. The claim and the three challenges for tabular networks. Needs Inductive Bias only to read the phrase "inductive biases" in the abstract.
  • Section 2, Related work. Skim it. It lists earlier tabular methods and benchmarks; none needs a prerequisite beyond Feedforward Neural Network.
  • Section 3, The benchmark. The dataset criteria, the side-issue removals and the normalised score. Needs Hyperparameter Optimization for the random-search procedure and Cross-Validation for why the validation set is kept separate from the test set.
  • Section 4, Results. The models (a random forest, gradient-boosted trees, XGBoost, an MLP, a ResNet-style network, an FT-Transformer and a transformer with attention across rows) and the budget curves. Needs Decision Tree, Random Forest, Bagging, Gradient Boosting and Transformer.
  • Section 5, Why. The three findings. Needs Inductive Bias, Overfitting and Bias-Variance Tradeoff for the argument about smooth versus irregular functions.
  • Section 6, Discussion. The limitations, stated plainly. Read them as a list of open questions.

Read next: Revisiting Deep Learning Models for Tabular Data for the best-case deep baseline the paper compares against, and XGBoost: A Scalable Tree Boosting System for the boosting system that the tree models in the benchmark are built on.

Check yourself

QuestionThe benchmark reports, for each model at a given budget, a score averaged over 15 shuffles of the search order. Why shuffle the order rather than run one search?Show answer

A single random search can be lucky or unlucky about which settings it happened to draw first. Shuffling the order and averaging gives an estimate that does not depend on that one draw, and the spread across shuffles shows how much the result depends on the search. The paper plots that spread as a band.

QuestionA table has 2,000 rows and 15 features, and a model's test accuracy is 0.82, the reference score at the 10% test-error quantile is 0.60, and the best score is 0.85. What is the normalised score of this model?Show answer

The normalised score is (0.82−0.60)/(0.85−0.60)=0.22/0.25=0.88(0.82 - 0.60) / (0.85 - 0.60) = 0.22 / 0.25 = 0.88. The table fails the size filter, since 2,000 is below 3,000, so the benchmark would not use it, but the arithmetic for the score is the same.

QuestionWhy does smoothing the target function on the training set hurt tree models much more than neural networks?Show answer

Trees fit piecewise-constant functions, so they can represent sharp jumps directly. Smoothing removes those jumps and the trees lose accuracy. Neural networks are biased toward low-frequency, smooth functions, so they already fit the smoothed target about as well as the original, and smoothing barely changes their accuracy. This is evidence that the tabular targets in the benchmark contain irregular patterns that networks struggle to learn.

QuestionA team adds 200 random Gaussian columns that have no relation to the target to their table. Which model do you expect to lose more accuracy, a tree ensemble or an MLP, and why?Show answer

The MLP. Its learning procedure is rotationally invariant, so by Ng's result its worst-case sample complexity grows at least linearly in the number of irrelevant features. Trees select features one split at a time and are much less affected. The paper's experiment with added uninformative features shows the gap widening for MLP-like models.

QuestionIn the paper's experiment, randomly rotating the feature columns makes the networks look better relative to the tree models. What does that suggest about the original column basis?Show answer

The original basis carries information that tabular models can use: each column has a meaning, such as age or weight. Rotation-invariant learners ignore the basis, so rotating the data does not hurt them. Tree models rely on the individual columns, so rotation hurts them. The original orientation of the data is part of what makes tabular data easy for trees, and it is not a nuisance to be removed.

Sources

Read the full paper

Léo Grinsztajn, Edouard Oyallon, Gaël Varoquaux, 2022. arXiv:2207.08815