- See which features drive model predictions.
- Compare feature importance across samples.
- Detect feature interactions.
- Debug unexpected model behavior.
Why TabPFN is Well-Suited for Interpretability
TabPFN produces smooth, well-calibrated predictions that make post-hoc explanations more stable and meaningful. Because it is a foundation model pretrained on synthetic data, it generalizes without overfitting to individual training samples — so feature attributions reflect genuine patterns. TabPFN follows the scikit-learn estimator API (fit, predict, predict_proba), which means it works out of the box with most interpretability tools in the sklearn ecosystem — partial dependence plots, permutation importance, and any other method that accepts a sklearn-compatible estimator. No wrappers or adapters needed.

Installation
shapiq and the other dependencies needed for all methods. To
run against the cloud API instead of locally, install
tabpfn-client in place of tabpfn:
Quickstart
Train a model, explain a single prediction, and plot the result:This tutorial runs TabPFN locally, which requires a GPU — see our FAQ
for GPU setup. The recommended
get_tabpfn_imputation_explainer relies on
fit_mode="fit_with_cache", which is local-only and not available in the
tabpfn_client backend. To use the cloud API, replace the tabpfn import with
tabpfn_client and remove fit_mode (the client does not support it yet).Choosing a Method
Before diving into each method, here is a summary to help you pick the right tool for the question you are trying to answer.
If you are still unsure which method to use, follow the table below to see the best tools for most common questions.
Use Cases
Explain a prediction with shapiq
Use Shapley interaction indices to understand not just which features matter, but which feature pairs drive a prediction together.- Classification
- Regression
predict_proba to a
shap explainer directly and reuse the same values for both the global beeswarm
above and per-sample waterfalls (pip install shap):


Visualize global feature effects with Partial Dependence Plots
PDP and ICE curves show how a feature affects predictions across the whole dataset, not just one sample.- Classification
- Regression

The remove-and-recontextualize alternative
get_tabpfn_explainer uses the remove-and-recontextualize paradigm (Rundel et
al. 2024): TabPFN is re-fit for every coalition, so the KV cache cannot be
reused — expect this path to be substantially slower than the recommended
get_tabpfn_imputation_explainer. Reach for it when you specifically want this
paradigm. It also takes the training labels and does not need fit_mode.
Feature selection
Sequential feature selection identifies the minimal subset of features that contributes most to model performance:Controlling the budget parameter
Thebudget parameter in explainer.explain() sets how many coalition samples
shapiq evaluates to approximate Shapley values. Each coalition is a subset of
features — evaluating more of them produces more accurate estimates but costs
more model calls.
In theory, exact Shapley values require evaluating all 2^n feature subsets
(e.g. 1024 for 10 features, ~1 billion for 30). In practice, shapiq’s
approximation algorithms converge well before that:
Start low (e.g.
budget=128) and increase only if the resulting explanations
look noisy or unstable across repeated runs.
Library Reference
interpretability.shapiq.get_tabpfn_imputation_explainer
Creates a shapiq TabularExplainer that uses imputation-based feature removal
(marginal / conditional / baseline). The training set is fixed across
coalitions, so the KV-cache fast path applies — construct the model with
fit_mode="fit_with_cache" (set before .fit()); the wrapper warns at
construction time if it is not. This is the recommended adapter.
Returns:
shapiq.TabularExplainer
Call .explain(x, budget=N) where x is a 2D numpy array of shape (1, n_features) and budget is the number of coalition samples to evaluate (see Controlling the budget parameter). Returns a shapiq.InteractionValues object with .plot_waterfall(), .plot_force(), and other visualization methods.
interpretability.shapiq.get_tabpfn_explainer
Creates a shapiq TabPFNExplainer that uses the remove-and-recontextualize
paradigm (Rundel et al. 2024). TabPFN is re-fit for every coalition, so the KV
cache cannot be reused — expect this path to be substantially slower than the
recommended get_tabpfn_imputation_explainer.
Returns:
shapiq.TabPFNExplainer
Same .explain(x, budget=N) interface as above.
interpretability.pdp.partial_dependence_plots
Convenience wrapper around sklearn’s PartialDependenceDisplay.from_estimator.
Returns:
sklearn.inspection.PartialDependenceDisplay
interpretability.feature_selection.feature_selection
Sequential feature selection using cross-validation. Returns a rich result
object with the fitted selector, selected indices/names, and baseline vs.
selected CV scores.
Returns:
FeatureSelectionResult — a dataclass with the following attributes:
interpretability.shap.shapiq_to_shap_explanation
Bridge helper that computes first-order Shapley values with a shapiq explainer
and wraps them in a shap.Explanation for use with shap.plots.* and
shap.summary_plot. This is the recommended way to use shap plotting with
TabPFN (see shap_example.py).
The
shap package is not included in the interpretability extra — shapiq
handles the computation. Install it separately to use this bridge:
pip install shap
Returns:
shap.Explanation with values.shape == (n, d). Only first-order
Shapley values are wrapped — for higher-order interactions use shapiq’s native
plots directly on the InteractionValues object.
FAQ
GPU setup, batch inference, and performance tuning.
Classification
Binary and multi-class classification guide.
Regression
Point estimates, quantiles, and full distributions.
Fine-Tuning
Adapt TabPFN to your domain-specific data.