ShapPFN
ShapPFN is a foundation model for tabular data that integrates Shapley value regression directly into its architecture, producing both predictions and explanations in a single forward pass. On standard benchmarks, ShapPFN achieves competitive performance while producing high-fidelity explanations ($R^2 \approx 0.96$, cosine $\approx 0.99$) over 1000x faster than KernelSHAP.
Architecture
ShapPFN combines several key components:
- PFN-style tabular transformers: Uses alternating attention over rows and features (similar to TabPFN / nanoTabPFN).
- Additive decomposition: Separate decoder heads for
base and per-feature contributions.
- Shapley value regression: Training explanations as part of the model output (ViaSHAP-style) rather than as a post-hoc procedure.
Setup
To use the code and the model from the official repository, you can install it via:
Quickstart
The official repository provides scripts for various tasks:
- Data Generation:
bash scripts/generate_data.sh
- Training:
bash scripts/train_shappfn.sh
- Evaluation:
bash scripts/eval_openml.sh (OpenML suite) and bash scripts/eval_shap.sh (KernelExplainer comparison)