TL;DR
Tabular data, a table of rows and columns with numbers and categories, is still mostly handled by gradient-boosted decision trees, and it was unclear whether neural networks beat them. Gorishniy and coauthors compare many deep models under one protocol and propose FT-Transformer: each column becomes a token embedding, and a transformer mixes the tokens. Across their eleven datasets it has the best average rank, though no deep model beats gradient boosting everywhere.
Builds on: Transformer, Multi-Head Attention, Embedding Layer, Gradient Boosting · Leads to: transformer-style baselines for tabular prediction, and the question of when they beat trees
Why it mattered
Most business and scientific prediction problems start as a table: loan records, house listings, sensor readings, customer histories. For years the default answer was a gradient-boosted tree library, and deep learning was seen as useful mainly when a table was one part of a larger input that also held images or text. The paper asks whether that default is right.
Its benchmark covers real problems: California Housing (house prices), Adult (income above a threshold), Higgs (simulated particle collisions), Covertype (forest cover type) and others. Its two main proposals are a ResNet-style baseline and FT-Transformer, and the paper recommends the ResNet model as a baseline that future papers should include. The paper's answer is also practical: with tuning, trees still win on some datasets, so a team should compare both.
The problem
A tabular example is a vector of features: some numeric, such as a house's area in square metres, and some categorical, such as a neighbourhood name. Neural networks expect numbers in a fixed layout, and for years most deep tabular models were multilayer perceptrons or ad hoc variants of them. Two things made comparison hard. First, papers used different datasets and different tuning budgets, so a claimed gain was often not a gain. Second, the simple baselines were weak: a plain MLP was often beaten by a model that was tuned harder, not by a better idea.
The paper's question is therefore twofold. Which deep architectures work best when they are compared fairly? And can a simple, well-understood block from another field, the transformer, be adapted to tables so that it becomes a strong default?
How it works
FT-Transformer keeps the transformer but changes its input. Each feature gets its own embedding, and the transformer attends across features instead of across words or pixels.
Here is one tiny object with two numeric features and one categorical feature, with embedding size d = 2.
- Turn the numeric feature x = 2 into an embedding. Multiply it by a learned vector W = (0.5, 1) and add a learned bias b = (0, 0.5). The result is (2 × 0.5, 2 × 1) + (0, 0.5) = (1, 2.5). Check: each entry is one number per embedding slot.
- Turn the categorical feature into an embedding. Its one-hot vector picks out one row of a learned lookup table, here row number 2, which is (−1, 0.5), and a bias is added. The result is one more token of size 2.
- Stack the tokens: one per feature. With three features, the stack has three rows of size 2.
- Prepend a learned [CLS] token, a fixed vector that will hold the prediction. Now there are four tokens.
- Pass the four tokens through L transformer layers. In each layer, every token attends to every other token, so each feature can use information from every other feature. The layers are applied in pre-norm form, with normalization before each sublayer.
- Read the final [CLS] token, normalize it, apply a ReLU and a linear layer. The output is the prediction.
flowchart LR A[Numeric and categorical features] --> B[Feature tokenizer: one embedding per feature] B --> C[Prepend CLS token] C --> D[L transformer layers: attention across features] D --> E[Read CLS token] E --> F[Normalize, ReLU, linear layer] F --> G[Prediction]
The tokenizer is the only part that knows the table layout. After it, the model treats the features of one object as a sequence of tokens, so each layer mixes information across the features of that object.
The math
Write the k input features of one object as x_1 through x_k. The feature tokenizer produces one embedding per feature. For a numeric feature the embedding is a bias plus a scaled vector; for a categorical feature it is a bias plus a row of a lookup table:
Here W_j^(num) is a vector of length d, W_j^(cat) is a table with one row per category, and e_j is the one-hot vector of the category. The stacked token matrix T has k rows and d columns.
Step 2 in symbols
For the example above, with x = 2, W = (0.5, 1) and b = (0, 0.5), the token is (2 times 0.5, 2 times 1) plus (0, 0.5), which equals (1, 2.5). The categorical token adds the chosen row of the lookup table to its bias.
Step 5 in symbols
Let T_0 be the stack of the [CLS] token and the k feature tokens, so T_0 has k + 1 rows. Each layer maps T_{i-1} to T_i. In pre-norm form, one layer is
where MHSA is multi-head self-attention, LN is layer normalization and FFN is the feed-forward block. Inside MHSA, each token forms a query, a key and a value, and the attention weights come from a softmax over query-key scores. Section 3.3 of the paper gives the exact form used.
Step 6 in symbols
The prediction is
The cost of attention
With k features plus the [CLS] token, attention compares every pair of tokens, which is (k + 1) squared pairs per layer. This is an arithmetic consequence of the architecture, not a figure from the paper. For 10 features there are 11 tokens and 121 pairs; for 100 features, 101 tokens and 10201 pairs.
Results
The results are the paper's reported averages, with the metric in each column's header.
- Benchmark. The paper uses eleven public datasets. Each has one fixed train, validation and test split, and each model is scored as the mean over 15 random seeds.
- Average rank (Table 2). FT-Transformer has the best average rank, 1.8 with standard deviation 1.2 across datasets. ResNet has 3.3, MLP has 4.8, and the NODE model has 3.9. Lower is better.
- California Housing (Table 2, RMSE, lower is better). FT-Transformer has 0.459; ResNet has 0.486 and MLP 0.499. The paper marks the FT-Transformer result as best on this dataset.
- Against gradient boosting with default settings (Table 4). An ensemble of default FT-Transformers beats the gradient-boosting ensembles on most datasets. The exceptions named in the text are California Housing and Adult.
- Against gradient boosting with tuned settings (Table 4). Once tuned, gradient boosting dominates on some datasets: the text names California Housing, Adult and Yahoo. On California Housing, tuned CatBoost reaches RMSE 0.423 against 0.448 for the FT-Transformer ensemble. The paper concludes that no universally superior solution exists.
- Where FT-Transformer gains. Its advantage over ResNet is concentrated on the datasets where gradient boosting beats ResNet, and it is on par with ResNet elsewhere (Section 4.6).
- Limits, as the paper states them. FT-Transformer needs more hardware and training time than ResNet, and it may not scale to datasets with too many features for the available hardware. The authors also say the benchmark is slightly biased towards problems that favour deep models.
Reading guide
- Section 1, Introduction: the state of tabular deep learning and the two proposals. Needs Gradient Boosting and Feedforward Neural Network.
- Section 2, Related work, and Section 3.1 and 3.2: MLP and ResNet as baselines. Needs Residual Connection, Deep Residual Learning for Image Recognition (ResNet) and Batch Normalization.
- Section 3.3, FT-Transformer: the feature tokenizer, the [CLS] token and the prediction head. Needs Embedding Layer, One-Hot Encoding, Transformer and Multi-Head Attention.
- Section 4.2 and Table 1, Datasets: the eleven datasets and their metrics. Needs Area Under the ROC Curve only for reading the accuracy columns.
- Section 4.4, Table 2: the average-rank comparison. Needs Cross-Validation for the idea of evaluating on held-out data.
- Section 4.5, Table 4: ensembles against boosted trees. Needs Decision Tree and Random Forest for the tree ensembles that the table compares.
- Section 5, Analysis: when FT-Transformer beats ResNet, and feature importances from attention. Needs Softmax.
Check yourself
QuestionRecall: what does the feature tokenizer produce for each feature, and why does the transformer then see a sequence?Show answer
It produces one embedding vector per feature, with a bias plus either a scaled vector (numeric) or a looked-up row (categorical). Stacking these gives one token per feature, so the transformer treats the features of one object as a sequence of tokens and attends across them.
QuestionComputation: a numeric feature has value x = 3, with W = (2, −1) and bias b = (0.5, 0). What is its token?Show answer
The token is (3 times 2, 3 times −1) plus (0.5, 0), which is (6, −3) plus (0.5, 0), so (6.5, −3).
QuestionWhy: the paper says ResNet is a strong baseline that is often missing from earlier work. Why is it a useful baseline if it is simpler than FT-Transformer?Show answer
Because it is simple, well understood and easy to tune, so a new model can be compared against a strong reference that costs little. The paper's results show ResNet is competitive on many datasets, so beating it is a meaningful test, and it is cheaper to train than FT-Transformer.
QuestionApplied: a table has 40 features, you want FT-Transformer, and attention costs grow with the number of token pairs. Compute the number of token pairs per layer, including the [CLS] token, and say what it implies for a table with 400 features.Show answer
There are 41 tokens, so 41 squared is 1681 pairs per layer. For 400 features there would be 401 tokens and 401 squared is 160801 pairs per layer, about 96 times as many. The cost grows with the square of the feature count, so a very wide table may need a cheaper model or a different attention approximation, as the paper's limitations section notes.
Sources
- Gorishniy, Rubachev, Khrulkov and Babenko (2021), Revisiting Deep Learning Models for Tabular Data. https://arxiv.org/abs/2106.11959
- Vaswani et al. (2017), Attention Is All You Need. https://arxiv.org/abs/1706.03762
- Chen and Guestrin (2016), XGBoost: A Scalable Tree Boosting System. https://arxiv.org/abs/1603.02754