TabPFN
TabPFN is a transformer pre-trained on synthetic tables that predicts in one forward pass. Learn how it works, where it shines, and where it falls short.
Overview
TabPFN is a transformer that has been pre-trained on millions of synthetic tables so that it can make predictions on a new table without any training on that table. You give it the labeled rows and the unlabeled rows together. It reads them in one pass and returns predictions. The name stands for Tabular Prior-data Fitted Network. The "fit" step in the usual sense is almost empty: it only stores your data. The learning happened earlier, during pre-training, and it is applied through in-context learning.
This makes TabPFN very different from gradient boosting, random forests, or a neural network that you train per dataset. There is no hyperparameter search, no epochs, and no early stopping. On small and medium tables it is often as accurate as a carefully tuned ensemble of trees, and it gets there in seconds. Its limits are mostly about size: the cost of attention grows with the number of rows and columns, so very large tables need other approaches such as TabICL or classic boosting like XGBoost.
What it is
TabPFN belongs to a family called prior-data fitted networks, or PFNs. A PFN is a neural network trained to approximate Bayesian prediction. Instead of learning from one real dataset, it learns from a very large number of datasets drawn from a prior. The prior is a recipe that generates random tasks. After pre-training, the network has absorbed the recipe. When it sees a new dataset, it behaves like a statistician who has already seen millions of similar problems and quickly recognizes the pattern.
In practical terms TabPFN is:
- A transformer with a special input format: each row is a token (or a set of cell tokens), and the labeled rows act as the "context" while the unlabeled rows are "queries".
- A pre-trained model whose weights are fixed when you use it. You do not run gradient descent on your data.
- A scikit-learn style estimator with
fitandpredictmethods, so it fits into existing pipelines built with scikit-learn. - A model for classification and, in later versions, regression too.
- A foundation model for tabular data, in the sense that one set of weights serves many unrelated tables. See /model/research for the wider research picture.
Everyday analogy
Think of a doctor who has seen thousands of patients across many clinics. When a new patient arrives with a short chart, the doctor does not need to re-learn medicine. They compare the chart to patterns seen before and make a good guess. TabPFN is like that doctor. The pre-training is medical school and residency. Your table is the new clinic's set of past patients. The query rows are the new patients to be diagnosed.
Where it came from
The idea has two roots. The first is the Bayesian view of prediction. In this view, the best prediction for a new point is the posterior predictive distribution: you average over all models that could explain the data, weighted by how well each one does. This is exact but usually too expensive to compute. The second root is the observation that transformers can do in-context learning: they can adapt to a new task from examples in the prompt, as shown by large language models.
The key papers, by name and year:
- "Transformers Can Do Bayesian Inference" (2021, presented at ICLR 2022) introduced prior-data fitted networks. It showed that a transformer trained on data sampled from a prior can approximate the posterior predictive distribution in a single forward pass.
- "TabPFN: A Transformer That Solves Small Tabular Classification Problems in a Second" (2022, presented at ICLR 2023) applied the idea to tabular classification. It was limited to small numeric tables with a modest number of classes and features, but it already matched strong baselines on many small benchmarks.
- A later article, "Accurate predictions on small data with a tabular foundation model" (2025, published in Nature), described a second generation, often called TabPFN v2. It extended the approach to regression, missing values, categorical features, and larger tables, and it changed the architecture so that attention runs both across rows and across columns.
The history shows a common pattern in machine learning. A narrow, clever demonstration (first version) is followed by a more general system (second version) that handles the messy properties of real data. Later work such as TabICL and TabSTAR pushed the same direction toward larger tables and text-rich tables.
How it works
This section walks through the mechanism in steps. Each step includes an analogy.
Step 1: Define a prior over tasks
The prior is a program that creates random tabular datasets. The designers write it to cover many kinds of structure that real tables may have. Two main ingredients are commonly described:
- Structural causal models, or SCMs. An SCM is a random graph where some variables cause others. Each variable is computed from its parents with a random function plus noise. Some variables become features, and one becomes the target.
- Randomized neural networks and other function families, including tree-like functions, used to create varied relationships between features and target.
On top of this, the generator adds realistic messiness: categorical columns made by discretizing numbers, missing values, uninformative features, skewed distributions, and different sample sizes and feature counts.
Analogy: imagine a teacher who writes a million different exam problems, each with its own hidden rule. A student who practices on all of them learns how to discover hidden rules fast, even if the exam rule is new.
Step 2: Sample a dataset and split it
For each training step, a synthetic dataset is drawn from the prior. It is split into a context part, with labels visible, and a query part, with labels hidden. This mimics what will happen at prediction time.
Step 3: Feed rows to a transformer
The model embeds each cell, row, or feature according to its design. In the second generation, the input is a grid: rows by features. The model uses two kinds of attention:
- Attention across features within one row, so that the model can learn interactions between columns.
- Attention across rows within one column, so that the model can learn the distribution of that column and compare rows.
Analogy: reading a spreadsheet by first scanning each row left to right, then scanning each column top to bottom. Both views help you understand it.
Step 4: Make queries attend to context but not to each other
The labeled rows can look at each other. The query rows can look at the labeled rows, but not at other query rows. This keeps predictions independent from the batch of queries, so that adding more queries does not change the answer for one query. It also makes the attention pattern efficient and permutation friendly.
Step 5: Predict the label
The output for each query row is a distribution. For classification it is a probability over classes. For regression the model outputs a distribution over a binned range of values, which allows quantiles and uncertainty estimates, not only a point prediction.
Step 6: Train by cross-entropy on the hidden labels
The loss is computed on the query rows only. The weights are updated over a very large number of synthetic datasets. This is done once, by the model builders, and is expensive. After that, the model is frozen.
Step 7: Use it on your table
At inference time:
- You pass your labeled rows and the rows to predict.
- The model runs one forward pass with your labeled rows as context.
- It returns predictions.
There is no learning step on your data. All the "learning" is an inference computation inside attention. This is the same idea as in-context learning in language models.
Step 8: Ensembling over views
Because the model has no built-in notion of column order or class label identity, practical use often runs several forward passes with different feature orders, different transformations of the inputs (for example, a power transform or standardization), and shuffled class labels. The outputs are averaged. This reduces variance, similar to test-time augmentation in vision. It costs more compute but usually improves accuracy.
Why this approximates Bayesian prediction
If the network is trained on data from the prior with enough capacity, the training loss is minimized when the network outputs the true posterior predictive distribution under that prior. So at test time, if your dataset looks like something the prior can generate, the network's output is close to the Bayes-optimal answer for that prior. The quality therefore depends on how well the prior covers real-world data.
Key concepts and terms
| Term | Plain meaning |
|---|---|
| Prior-data fitted network (PFN) | A network trained on datasets sampled from a prior so it can do Bayesian-style prediction in one pass |
| Prior | The random program that creates synthetic tasks for pre-training |
| Structural causal model (SCM) | A random graph where each variable is a noisy function of its parents |
| In-context learning | Adapting to a task from examples placed in the input, with no weight updates |
| Context rows | Labeled training rows given to the model at prediction time |
| Query rows | Rows whose labels the model must predict |
| Posterior predictive distribution | The probability of a new label after averaging over all plausible models |
| Forward pass | One run of data through the network from input to output |
| Two-way attention | Attention across features and across rows, used in later versions |
| Test-time ensembling | Running several perturbed copies of the input and averaging results |
| Foundation model | A model pre-trained broadly so it can be reused on many tasks |
| Binned regression head | An output layer that predicts a probability for each value interval |
For the broader vocabulary of this field, see Transfer learning, Few-shot learning, and Meta-learning. TabPFN is a close cousin of meta-learning, since it learns across many datasets how to learn from one.
A worked example
A usage example in Python
The following sketch shows the typical API shape. Names can vary a little between versions, but the pattern of fit and predict is stable.
import numpy as np
import pandas as pd
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, roc_auc_score
from tabpfn import TabPFNClassifier
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.3, random_state=0, stratify=y
)
clf = TabPFNClassifier() # loads pre-trained weights
clf.fit(X_train, y_train) # stores the training rows as context
proba = clf.predict_proba(X_test) # one forward pass over context + queries
pred = proba.argmax(axis=1)
print("accuracy:", accuracy_score(y_test, pred))
print("auc:", roc_auc_score(y_test, proba[:, 1]))
What happens inside fit: almost nothing. It validates the inputs and keeps them. What happens inside predict_proba: the full computation, because that is when the context and queries meet in attention.
A regression example
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error
from tabpfn import TabPFNRegressor
X, y = fetch_california_housing(return_X_y=True)
# Use a subsample: attention cost grows with the number of rows
idx = np.random.RandomState(0).choice(len(X), 5000, replace=False)
X, y = X[idx], y[idx]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)
reg = TabPFNRegressor()
reg.fit(X_train, y_train)
pred = reg.predict(X_test)
print("MAE:", mean_absolute_error(y_test, pred))
Because the regression head is a distribution, many implementations also let you ask for quantiles or the full predictive distribution, which is useful for risk-aware decisions.
A numeric walk-through of in-context prediction
Here is a tiny conceptual example, done by hand, to show what "learning in the forward pass" means. Suppose the context has four labeled rows with one feature x and a binary label:
| Row | x | label |
|---|---|---|
| 1 | 1.0 | 0 |
| 2 | 2.0 | 0 |
| 3 | 8.0 | 1 |
| 4 | 9.0 | 1 |
A query row has x = 7.5. Attention from the query to the context rows gives high weight to rows with similar x values, so rows 3 and 4 get large weights, and rows 1 and 2 get small weights. The label information carried by those rows is averaged with these weights, and the output layer turns it into a probability, say close to 0.9 for class 1.
A real TabPFN does much more than nearest-neighbor averaging. It learns, from its pre-training, when to behave like a smooth threshold, when like a linear model, and when like a rule that depends on two features together. But the first-order picture holds: the answer is a weighted combination of context information, and the weights are computed by learned attention.
A practical evaluation recipe
To compare TabPFN with boosting fairly:
- Choose a set of tables of different sizes.
- Use repeated stratified cross-validation, not one split.
- Tune XGBoost, LightGBM, or CatBoost with a fixed time budget, for example using Optuna.
- Run TabPFN with its default settings, then with a larger number of ensemble members.
- Compare accuracy or AUC and also wall-clock time for the whole pipeline, including tuning.
This second step matters. Boosting needs tuning to be at its best, and tuning has a cost. TabPFN has no tuning cost, so the fair comparison is on total time to a good model.
A mixed-type table with missing values
Real tables rarely look like a clean numeric matrix. The sketch below builds a small mixed table, leaves the holes in place, and passes it to the model after light preparation.
import numpy as np
import pandas as pd
from sklearn.model_selection import cross_val_score, RepeatedStratifiedKFold
from tabpfn import TabPFNClassifier
rng = np.random.RandomState(1)
n = 800
df = pd.DataFrame({
"age": rng.randint(18, 80, n).astype(float),
"income": rng.lognormal(10, 0.6, n),
"city": rng.choice(["a", "b", "c", "d"], n),
"owns_home": rng.choice([0, 1], n),
})
# Make the target depend on two features together
y = ((df["income"] > df["income"].median()) & (df["age"] > 40)).astype(int)
# Punch holes in the data, as real tables have
mask = rng.rand(n) < 0.1
df.loc[mask, "income"] = np.nan
# Light preparation: category codes, no sentinel values
df["city"] = df["city"].astype("category").cat.codes
cv = RepeatedStratifiedKFold(n_splits=5, n_repeats=3, random_state=0)
scores = cross_val_score(TabPFNClassifier(), df.values, y, cv=cv, scoring="roc_auc")
print(scores.mean(), scores.std())
Points to notice in this example:
- The target depends on an interaction of two columns. A model that only looks at one column at a time would struggle, while attention across columns can capture it.
- Missing income values stay as NaN. The model learns to treat missingness as part of the pattern.
- The city column becomes integer codes. The model does not know that code 2 is "larger" than code 1, and the prior contains enough discretized columns that it can learn to treat such codes as labels.
- Repeated cross-validation gives both a mean and a spread, which is important on a table of only a few hundred rows.
Reading the uncertainty
For classification, the probability vector tells you how sure the model is. A prediction of 0.51 versus 0.49 is a coin flip, while 0.98 versus 0.02 is a confident call. A simple, useful pattern is an abstain rule: send low-confidence rows to a human reviewer.
proba = clf.predict_proba(X_test)
confidence = proba.max(axis=1)
auto = confidence >= 0.9
print("auto-decided share:", auto.mean())
print("accuracy on auto-decided:", (proba.argmax(1)[auto] == y_test[auto]).mean())
For regression with a distributional head, you can ask for quantiles and build a prediction interval, for example the 10th to 90th percentile. A well-calibrated interval should contain the true value about 80 percent of the time. Always check this on held-out data. If coverage is lower than expected, the table may be far from the prior, and a conformal wrapper can repair coverage.
A day-by-day mental model of the cost
It helps to know where time goes. Consider a table with n context rows, m query rows, and d features.
| Stage | What happens | Cost trend |
|---|---|---|
| Load weights | Read the pre-trained network into memory | Fixed, once per process |
| Fit | Validate and store the context | Almost free |
| Preprocess | Normalize, encode, build ensemble views | Grows with n * d and the number of views |
| Attention across rows | Queries read the context | Grows with (n + m) * n |
| Attention across features | Each row mixes its columns | Grows with d squared per row |
| Average the ensemble | Combine the views | Grows with the number of views |
The practical lesson is that doubling the number of context rows more than doubles the cost, so subsampling the context is the first lever to pull when speed matters. The second lever is reducing ensemble views. The third is moving to a GPU.
Strengths and limitations
Strengths
- Strong accuracy on small and medium tables, often with no tuning.
- Very fast time to a first good model, because there is no training on your data.
- Good calibration in many cases, because the output approximates a Bayesian posterior.
- Works with little data, where deep networks trained from scratch struggle.
- Handles mixed feature types and missing values in later versions, with little preprocessing.
- Provides predictive distributions for regression, not only point estimates.
- Robust to uninformative features and moderate noise, since the prior included those cases.
- A single model serves many tasks, which simplifies deployment.
Limitations
- Scale. Attention cost grows with the number of rows and with the number of features. Very large tables need subsampling, chunking, or a different model.
- Inference cost. Every prediction needs the context rows to be present. There is no compact trained model you can ship and run cheaply on millions of rows.
- Memory use on GPU can be high for large contexts.
- Dependence on the prior. If your data has a structure the prior never covers, accuracy can drop. Examples include very high cardinality categories, long text, strict hierarchical dependence, and extreme time-series structure.
- Not designed for raw text, images, or sequences. Text-rich tables are the target of models like TabSTAR.
- Limited interpretability compared with a single tree. You can use post-hoc tools such as SHAP, but the explanation is of a black box.
- Version differences. Limits on rows, features, and classes differ between releases, so you must check the current documentation.
- Licensing and usage terms of released weights can vary, so check them before commercial use.
How it compares with alternatives
| Method | Needs training per dataset | Typical sweet spot | Handles missing values | Speed to first model | Notes |
|---|---|---|---|---|---|
| TabPFN | No (in-context) | Small to medium tables | Yes in later versions | Seconds | Pre-trained on synthetic data |
| TabICL | No (in-context) | Medium to large tables | Yes | Seconds to minutes | Column-then-row design for scale |
| TabSTAR | Light fine-tuning | Tables with free text | Yes | Minutes | Uses a text encoder |
| XGBoost / LightGBM / CatBoost | Yes | Small to very large | Yes | Minutes with tuning | Strong default for production |
| Random forest | Yes | Small to large | Varies | Fast | Easy to use, less accurate than boosting often |
| FT-Transformer | Yes | Medium to large | With preprocessing | Slow | Deep model trained from scratch |
| SAINT | Yes | Medium | With preprocessing | Slow | Row and column attention, trained per dataset |
| TabNet | Yes | Medium | With preprocessing | Slow | Sparse attention for feature selection |
Rules of thumb:
- If the table has fewer than a few thousand rows and mostly numeric or simple categorical columns, try TabPFN first.
- If the table has hundreds of thousands of rows or more, start with boosting or a scalable in-context model.
- If the table is mostly free text, use a text-aware model or a language-model pipeline.
- If you must serve millions of cheap predictions per day, a boosted tree model is still easier to deploy.
Role in tabular foundation models
TabPFN is one of the clearest examples of what a tabular foundation model is. It is worth walking through how it connects to each property that matters for models that learn from raw tables. Compare with the model design notes at /model/architecture and the evaluation notes at /model/benchmarks.
Row and column structure
A table is not a sequence of words. Rows are exchangeable: shuffling them should not change the answer. Columns are also, in principle, exchangeable, apart from their meaning. A good tabular model has to respect both symmetries. TabPFN does this by using attention without fixed positional order across rows, and by using ensembling over column permutations to reduce order effects. Two-way attention, across features and across rows, is a direct match to the row and column structure of a table. See Axial attention for the general idea of attending along one axis at a time.
Mixed types
Real tables mix numbers, categories, dates, and flags. TabPFN handles this through preprocessing and through its prior. Categorical values are encoded as integers or similar codes, and the prior contains discretized features so that the model has seen categorical-like columns during pre-training. Numeric values are normalized, and power transforms are applied to tame skew. The model never sees the category name, only its code, which leads to the next point.
No column names
TabPFN does not use column names or category labels. It treats the table as anonymous numbers. This is a strength and a weakness. It is a strength because the model works on tables with arbitrary or missing headers, and it cannot be misled by a bad name. It is a weakness because it throws away semantic information: a column called "age" and a column called "income" carry meaning that a language-aware model can exploit. TabSTAR and the Semantic sector heads idea go in the other direction and use text and cell content to recover meaning.
Missing values
A table with holes is the normal case. Later TabPFN versions accept missing values directly, because the prior includes missingness mechanisms. The model learns to attend around gaps and to use the other columns of the row. This is closely related to imputation: if you can predict a column from the others, you can fill the column. See Imputation networks and MIDAS.
Pre-training on synthetic tables
TabPFN is the most visible case of pre-training only on synthetic tables. This has several benefits: unlimited data, no privacy issues, control over structure, and no leakage of benchmark datasets into training. It also has a risk: a mismatch between synthetic and real data. Much of the research effort goes into improving the prior. See Synthetic data generation for the general craft. Pre-training on real tables, as in TabSTAR, or on a mix, is the main alternative.
In-context learning
In-context learning is the central mechanism. The labeled rows are the prompt. The query rows are the questions. No gradient steps are taken. This is the same principle as Few-shot learning in language models, with the difference that the "examples" are table rows. In-context learning brings advantages (speed, no per-task tuning, uncertainty) and costs (context size limits, per-prediction compute).
Continual learning
Because the weights are frozen, a TabPFN-style model does not forget when you give it a new dataset, and it does not learn anything permanent from it either. When new data arrives, you add rows to the context. This is a simple form of continual adaptation without catastrophic forgetting. For gradual updates to the weights themselves, techniques such as Experience replay and Elastic weight consolidation are the relevant tools, and they apply when you fine-tune the base model on a stream of tasks. Fine-tuning a PFN on a specific domain is an active research direction, and it needs care to avoid losing generality.
Imputation
A PFN can be used for imputation by treating one column as the target and the other columns as features. You run the model once per column to fill, using rows with the value present as context. This is a form of iterative imputation similar to chained equations, but with a pre-trained learner in place of a per-column model. The result is often better than simple means or medians and does not require training. Training objectives that mask cells, such as Masked cell modeling, make this idea native to the model rather than an add-on.
Anomaly detection
A predictive distribution can be turned into an anomaly score. If the model predicts a cell or a label with high confidence and the actual value is far from that prediction, the row is unusual. The density-style output of the regression head is especially helpful here. This approach relates to Anomaly detection methods like Isolation forest, but uses a learned model of normal structure rather than random splits. It works best when the context holds mostly normal rows.
Sector and semantic classification
Classifying a table into an industry sector from its content is a table-level task, not a row-level one. TabPFN as released predicts row labels, so it does not directly produce a table-level sector label. But its internal representations, or the pooled outputs of a table encoder in the same style, can feed a classification head. This is the idea behind Semantic sector heads: small heads that read a table-level embedding and map it to a coarse-to-fine label hierarchy. Because TabPFN ignores column names, such a head built on it would rely on value patterns alone, such as ranges, cardinalities, and correlations, which is a hard but useful setting when headers are missing.
Why this matters
Taken together, TabPFN shows that a single pre-trained network can replace the per-dataset training loop for a broad class of tabular problems. It sets a baseline that newer systems try to beat on scale, on semantics, and on the number of supported tasks.
Practical guidance and best practices
When to choose it
- You have a few hundred to a few thousand labeled rows, and you want a strong model fast.
- You want a baseline to compare with a tuned boosting model.
- You need calibrated probabilities or predictive intervals with little effort.
- You work with many small tables, and tuning each one is not affordable.
Data preparation
- Remove identifier columns that carry no signal, such as row IDs. They add noise and cost.
- Keep the number of features within the supported range. Drop duplicates and constant columns.
- Encode categories as integers or let the library do it. Do not one-hot encode very high cardinality columns, since it multiplies the number of features.
- Keep missing values as missing. Do not fill them with a magic number such as -999, which the model may interpret as a real value.
- Convert dates into useful numeric parts such as year, month, day of week, or elapsed days.
Controlling size
- Subsample rows if the table is too large. Stratified sampling keeps class balance. Choose the most informative or most recent rows if there is drift.
- Use feature selection to reduce columns, for instance by removing near-duplicates or low-importance columns found with a quick boosting model.
- Consider chunking: run several models on different subsets of the context and average the results.
Evaluation
- Use cross-validation with several repeats, because small tables give noisy estimates.
- Report the metric that matches the decision: log loss or Brier score if probabilities matter, AUC for ranking, F1 or recall for imbalanced detection.
- Check calibration with a reliability plot.
- Compare to a simple baseline such as logistic regression and to a tuned boosting model.
Settings that usually matter
- Number of ensemble members: more members cost more time and often give a small gain.
- Device: a GPU gives large speedups for non-trivial table sizes.
- Random seed: set it for reproducibility, since the ensemble uses random permutations.
Deployment
- Treat the training rows as part of the model artifact. You must store and load them at inference time.
- Watch latency: each call processes context plus queries. Batch your queries to amortize the context cost.
- Monitor for drift. If the live data departs from the context, refresh the context.
- Keep the version of the weights pinned, and record it with each prediction batch.
Explaining predictions
Use model-agnostic tools. SHAP can approximate feature contributions, but it needs many forward passes, so use a small background set. Local surrogate models and partial dependence plots are other options. Remember that explanations describe the model, not the world.
Scaling strategies when the table is too big
If your table exceeds the supported size, there are several honest options. None is perfect, and each should be tested against a boosting baseline.
- Random subsample of the context. Simple and often effective, since accuracy tends to flatten as context grows. Use stratification for classification.
- Nearest-neighbor context. For each query (or small group of queries), pick the context rows most similar to it and run the model on that local set. This turns a global problem into many local ones and works well when the relationship varies across regions.
- Clustering then local models. Cluster the rows first with a method such as k-means (see Clustering), then run one in-context model per cluster.
- Feature reduction. Drop columns that a quick tree model finds irrelevant, or compress groups of correlated columns.
- Bagging over chunks. Split the context into several chunks, predict with each, and average the probabilities.
- Switch model. Use a design built for long contexts, such as TabICL, or move to boosting.
A short checklist before you ship
- The table fits the documented limits, or you have a tested sampling strategy.
- You compared it with a tuned boosting model using repeated cross-validation.
- You looked at calibration and, if needed, applied a post-hoc correction.
- You have a plan for refreshing the context when data drifts.
- You pinned the version of the weights and the library.
- You wrote down which columns were dropped and why.
- You tested the pipeline with missing values at inference time, not only at training time.
- You measured end-to-end latency with realistic batch sizes.
Common mistakes
- Using it on a table far larger than its supported size and getting an out-of-memory error, or silently truncated context.
- Comparing it with an untuned boosting model, or with a boosting model tuned much more than TabPFN, and drawing the wrong conclusion in either direction.
- One-hot encoding high cardinality categorical columns, which inflates the feature count.
- Filling missing values with sentinel numbers before passing them in.
- Assuming that column names help the model. In the standard version they are ignored.
- Evaluating on one random split of a small table and trusting the result.
- Leaking the target through engineered features, such as group means computed on the full data.
- Forgetting that the context must be available at serving time, and shipping only the weights.
- Treating predicted probabilities as perfect. Check calibration on your data, especially far from the training distribution.
- Using it for time series forecasting with random splits, which leaks the future into the past. Split by time instead.
- Ignoring the license terms of the released weights.
Frequently asked questions
What does TabPFN stand for?
TabPFN stands for Tabular Prior-data Fitted Network. It is a transformer trained on datasets drawn from a prior, a program that generates many synthetic tabular tasks. The word "fitted" refers to the pre-training stage, after which the network can predict on new tables directly.
Does TabPFN train on my data?
No weights are updated on your data. When you call fit, the model mainly stores your labeled rows. When you call predict, it processes those rows as context together with the query rows in a single forward pass. This is in-context learning, and it is why the model is so fast to set up.
Is TabPFN better than XGBoost?
It depends on the table. On small and medium tables, TabPFN is often as good as or better than a tuned boosting model, and it needs no tuning. On very large tables, or when low-cost serving is the priority, boosting such as XGBoost is usually the better choice. The best practice is to compare them on your own data with repeated cross-validation.
How large a table can TabPFN handle?
The limits depend on the version. The first release was aimed at around a thousand training rows and a small number of features, while the later generation supports considerably larger tables, on the order of thousands of rows and hundreds of features. Always check the documentation of the version you use. For much larger tables, consider TabICL or boosting.
Why is it trained on synthetic data?
Synthetic data is unlimited, free of privacy concerns, and fully controllable. The designers can cover a wide range of structures, noise levels, and missingness patterns, and they avoid training on public benchmark datasets that would later be used for evaluation. The risk is a gap between synthetic and real data, which is why the quality of the prior is so important.
Can TabPFN handle missing values and categorical features?
Later versions can. Missing values are accepted as they are, and categorical columns are encoded as codes. Good results still depend on sensible preprocessing, such as avoiding sentinel values and avoiding one-hot encoding of very high cardinality columns.
Does TabPFN use column names?
The standard model does not. It sees anonymous numbers, so it works even when headers are missing, but it cannot use the meaning of a name like "age". Models that read text, such as TabSTAR, are designed to use that extra information.
Can I use TabPFN for imputation or anomaly detection?
Yes, with some adaptation. For imputation, treat each column with holes as a target and the other columns as features, then predict the missing entries from rows where the value is known. For anomaly detection, use the predictive distribution and flag rows whose observed values are unlikely under the model. Both approaches work best when most of the context is clean.
Is TabPFN a large language model?
No. It is a transformer, but it is much smaller than a language model, it is trained on tables rather than text, and its input is a grid of numbers. It shares with language models the idea of in-context learning, and it can be seen as the tabular counterpart of that idea.
How should I explain its predictions?
Use post-hoc tools. SHAP values, permutation importance, and partial dependence plots work with any predictor. Because the model is a black box, treat the explanations as approximate, and validate them against domain knowledge.
Glossary
- Attention: A mechanism that lets each element of the input look at other elements and combine their information with learned weights.
- Bayesian inference: A way of updating beliefs about models using data and a prior.
- Calibration: The match between predicted probabilities and observed frequencies.
- Context window: The amount of input, in rows or tokens, the model can process at once.
- Cross-validation: Splitting data into folds to estimate performance on unseen data.
- Ensemble: A combination of several predictions to reduce variance.
- Forward pass: One computation from input to output of a neural network.
- Foundation model: A broadly pre-trained model reused for many tasks.
- In-context learning: Learning from examples given in the input, with no weight updates.
- Posterior predictive distribution: The distribution of a new outcome given the data, averaged over model uncertainty.
- Prior: A distribution over models or tasks before seeing data. In TabPFN, the generator of synthetic datasets.
- Query row: A row without a label that the model must predict.
- Structural causal model: A set of equations that describe how variables cause each other.
- Synthetic data: Artificially generated data used in place of real data.
- Test-time augmentation: Making predictions on several perturbed versions of an input and combining them.
Summary
TabPFN is a transformer pre-trained on a very large number of synthetic tables so that it can classify or regress on a new table in one forward pass, using the labeled rows as context. It brings the speed and low effort of in-context learning to tabular data, and it often matches tuned gradient boosting on small and medium problems. Its main limits are table size, per-prediction cost, and dependence on how well the synthetic prior matches real data.
As a tabular foundation model, it is a reference point for how to respect row and column structure, mixed types, and missing values, and for how to use pre-training and in-context learning in place of per-dataset training. Related designs such as TabICL extend it to larger tables, TabSTAR adds text understanding, and Semantic sector heads add table-level semantic labels. For more on the research direction and evaluation, see /model/research, /model/architecture, and /model/benchmarks.
Related
It belongs to Related models and baselines in my stack, under Foundation models and applied ML. Others in the same group: