---
title: 'FastSHAP: Real-Time Shapley Explanations'
url: https://www.emergentmind.com/topics/fastshap
type: topic
---

# FastSHAP: Real-Time Shapley Explanations

FastSHAP is an amortized method for estimating Shapley-value explanations in real time. Introduced as a learned explainer that outputs a full attribution vector in a single forward pass, it reframes Shapley estimation from a per-instance combinatorial computation into a supervised optimization problem over sampled coalitions. The method is motivated by the weighted least-squares characterization of Shapley values and is designed to preserve Shapley-style attribution while eliminating the repeated model evaluations required by classical model-agnostic estimators such as KernelSHAP [2107.07436].

## 1. Conceptual position

FastSHAP addresses the central computational obstacle of Shapley explanations: exact Shapley values require aggregation over exponentially many feature subsets, and even stochastic approximations remain expensive because they query the explained model many times for each new input. FastSHAP shifts this cost from explanation time to a one-time training phase by learning a parametric mapping from inputs to attribution vectors, so that explanation becomes a direct prediction task rather than an instance-specific estimation procedure [2107.07436].

In this sense, FastSHAP belongs to the broader class of amortized explainers. Its defining characteristic is that it learns Shapley values themselves, rather than a proxy saliency score or a post hoc visualization heuristic. This places it closer to KernelSHAP in objective than to gradient-based methods such as GradCAM, Integrated Gradients, or SmoothGrad, although those methods are often used as empirical baselines because they are also fast at inference time [2107.07436].

FastSHAP should be distinguished from several neighboring lines of work that also emphasize speed. “Fast Hierarchical Games for Image Explanations” introduces h-Shap, a hierarchical game construction for image explanations, but it is not FastSHAP and does not use the learned one-pass explainer formulation [2104.06164]. Fast TreeSHAP accelerates TreeSHAP for tree models by reorganizing path computations, and WOODELF gives a unified exact framework for tree ensembles using pseudo-Boolean formulas; both are fast SHAP methods, but neither is an amortized explainer for arbitrary black-box models [2109.09847] [2511.09376].

## 2. Shapley-theoretic formulation

FastSHAP starts from the standard Shapley-value problem for a value function \(v:2^d \mapsto \mathbb{R}\). In the formulation given for feature \(i\),
\[
\phi_i(v) = \frac{1}{d} \sum_{s_i \neq 1} \binom{d - 1}{\mathbf{1}^\top s}^{-1} \Big( v(s + e_i) - v(s) \Big).
\]
This expression is theoretically attractive but computationally prohibitive, because the summation ranges over coalitions of features [2107.07436].

The methodological pivot of FastSHAP is the weighted least-squares characterization of Shapley values. In a finite-dimensional form, FastSHAP learns an explainer \(\Phi_\theta(x)\in\mathbb{R}^n\) by minimizing
\[
\mathcal L(\theta) = \mathbb E_{x,\,S\sim p_w}\!\left[\bigl(v_x(S)-\langle\Phi_\theta(x),1_S\rangle\bigr)^2\right],
\]
subject to the efficiency constraint
\[
\langle\Phi_\theta(x),1_N\rangle = v_x(N).
\]
This recasts Shapley estimation as regression over random coalitions sampled from the Shapley kernel, so that the explainer learns to approximate coalition values linearly through its predicted attribution vector [2606.28065].

The subset distribution used in FastSHAP is the Shapley kernel,
\[
p(s) \propto \frac{d - 1}{\binom{d}{\mathbf{1}^\top s} \cdot \mathbf{1}^\top s \cdot (d - \mathbf{1}^\top s)},
\]
for coalitions with \(0 < \mathbf{1}^\top s < d\). This is the same weighted-regression viewpoint that underlies KernelSHAP, but FastSHAP amortizes the solution across inputs by training one explainer model instead of fitting a separate regression for each explained instance [2107.07436].

The paper’s theoretical claim is that, if efficiency is enforced, the global optimizer of the training objective recovers the true Shapley values almost surely under the data distribution. This claim is central to the method’s identity: FastSHAP is not merely a fast heuristic for importance scores, but a learned estimator grounded in the least-squares characterization of Shapley values [2107.07436].

## 3. Training mechanics and inference

FastSHAP trains a separate parametric explainer model that outputs a full attribution vector in one pass. The original formulation samples triples consisting of an input, a target class, and a coalition, then penalizes the squared discrepancy between the coalition value and the linear reconstruction induced by the predicted attribution vector. Optimization uses standard stochastic gradient descent, with minibatching, multiple coalition samples per input, averaging over all classes, and paired sampling with complementary coalitions as variance-reduction strategies [2107.07436].

Efficiency can be handled in two ways. The first is additive efficient normalization, which evenly distributes the efficiency gap across features. The second is efficiency regularization, implemented as a penalty on the efficiency gap with parameter \(\gamma>0\). The original experiments report that normalization works better in practice, especially on tabular data, while image experiments can still perform strongly when efficiency is relaxed [2107.07436].

At inference time, FastSHAP does not solve an optimization problem. It applies the trained explainer once, optionally followed by a lightweight normalization step, and returns the full attribution vector. This single-pass property is the immediate source of its “real-time” designation and the principal reason it differs computationally from KernelSHAP and other stochastic estimators that must repeatedly query the original predictor for each example [2107.07436].

A concrete downstream realization appears in CASPER, a gravitational-wave detection pipeline that couples a residual CNN classifier with a FastSHAP explainer. There, FastSHAP is implemented as a U-Net trained to approximate pixel-wise Shapley values on STFT spectrograms of shape \((65,69,1)\), with skip connections preserving spatial resolution. The explainer is trained with a masked-prediction consistency objective,
\[
\mathcal{L} = \mathbb{E}_{\mathbf{m}}\!\left[\!\left(\sum_j\phi_j(\mathbf{x})m_j - \bigl[f(\mathbf{x}\odot\mathbf{m})-f(\mathbf{x}_\mathrm{bg})\bigr]\right)^{\!2}\right],
\]
using Adam at learning rate \(10^{-3}\), batch size \(32\), for \(10\) epochs, with Bernoulli\((0.5)^{65\times69}\) masks and random noise frames as background references. The stated runtime benefit is “single pass generation of attribution maps” [2606.17214].

## 4. Empirical behavior and application domains

The original FastSHAP experiments cover both tabular and image tasks. On tabular datasets—Census, Marketing, Bankruptcy, and News—the method is evaluated against approximations to ground-truth Shapley values obtained by running KernelSHAP to convergence. The reported finding is that FastSHAP matches the accuracy of KernelSHAP-style estimators while using far fewer model evaluations: KernelSHAP requires about \(1{,}200\)–\(2{,}000\) evaluations on news, census, and bankruptcy to match FastSHAP, paired sampling reduces this to roughly \(250\)–\(1{,}000\), permutation baselines require about \(200\)–\(1{,}000\), and FastSHAP is reported as at least \(600\times\) faster than original KernelSHAP and about \(200\times\) faster than the best non-amortized baseline [2107.07436].

On images, the original study evaluates CIFAR-10 and Imagenette using Inclusion AUC and Exclusion AUC. FastSHAP is reported as the strongest overall method, with best or near-best Exclusion AUC on both datasets and strong Inclusion AUC, second only to KernelSHAP-S in some cases. For explaining \(1{,}000\) images, the reported runtime is about \(0.04\) minutes for FastSHAP, compared with \(453.69\) minutes and \(1089.50\) minutes for KernelSHAP on CIFAR-10 and Imagenette, respectively, while the training cost is \(693.57\) minutes on CIFAR-10 and \(146.49\) minutes on Imagenette. These numbers illustrate the method’s central tradeoff: high upfront training cost in exchange for negligible marginal explanation cost [2107.07436].

CASPER provides an application in scientific machine learning and detector interpretability rather than generic computer vision. In that system, FastSHAP does not improve classification accuracy directly; it serves as a post hoc explainer for a customized 7-layer ResNet/2D CNN used on real GWOSC data from the H1 and L1 detectors. The classifier achieves AUC of \(91\%\), Platt calibration reduces ECE by \(15\%\), and FastSHAP attribution maps are reported to recover the complete chirp morphology. In a perturbation-fidelity experiment, masking the top \(1\%\) of pixels by absolute Shapley value reduces average confidence by about \(0.05\), and masking the top \(10\%\) reduces it to about \(0.19\). The full classifier-plus-FastSHAP pipeline remains under \(45\) ms on a standard laptop CPU, with the classifier alone taking \(34.11\) ms [2606.17214].

These empirical results support two distinct uses of FastSHAP. The first is high-throughput explanation of many samples when amortization can dominate per-instance cost. The second is low-latency interpretability in end-to-end systems, where the one-pass nature of the explainer makes it compatible with operational constraints that would preclude repeated coalition sampling [2107.07436] [2606.17214].

## 5. Relations to later variants and adjacent methods

Subsequent work has treated FastSHAP both as a baseline and as a template for broader families of amortized Shapley estimators. Some extensions generalize its least-squares framework, others criticize its post hoc separation between predictor and explainer, and others address architectural or domain restrictions.

| Method | Core mechanism | Relation to FastSHAP |
|---|---|---|
| PDD-SHAP [2208.12595] | Learns an ANOVA/PDP-style surrogate of the model and computes Shapley values analytically | Same amortization goal, but approximates the model rather than learning a direct explainer |
| FW-Shapley [2503.06602] | Learned estimator for weighted Shapley values via weighted least squares | Generalizes FastSHAP from standard to weighted Shapley values |
| SimSHAP [2311.01010] | Amortized estimator trained with a plain \(l_2\) objective against an unbiased stochastic target | Positions FastSHAP as more complicated than necessary and removes its special metric and normalization |
| ViaSHAP [2505.04775] | Learns Shapley values as part of the predictive model itself | Contrasts with FastSHAP’s post hoc explainer design |
| FourierShap [2410.06300] | One-time sparse Fourier approximation of the model, then exact SHAP in Fourier space | Amortized like FastSHAP, but learns a model representation instead of the SHAP mapping |
| OperatorSHAP [2606.28065] | Neural-operator explainer producing a continuous attribution field | Extends the FastSHAP idea to grid-agnostic function-space settings |

PDD-SHAP is explicitly described as belonging to the same broad family as FastSHAP, because both amortize explanation cost over many inputs. The difference is conceptual: FastSHAP learns a neural explainer that directly outputs Shapley values in one forward pass, whereas PDD-SHAP learns a structured functional decomposition of the original model and derives Shapley values analytically from the decomposition terms \(f_u\). A stated advantage of PDD-SHAP is that it exposes interaction structure, which a direct explainer like FastSHAP does not retain [2208.12595].

FW-Shapley recasts FastSHAP as the natural prior learned-estimator baseline for feature attribution and extends the same amortized-learning principle to weighted Shapley values. In the reported feature-attribution experiments, FW-Shapley outperforms FastSHAP by \(27\%\) on average in Inclusion AUC, while matching FastSHAP’s runtime of \(1.42\) s in the cited setting [2503.06602].

SimSHAP offers a more foundational critique. It places FastSHAP, KernelSHAP, and related estimators into a unified framework and argues that FastSHAP’s special metric matrix and efficiency-normalization machinery are redundant. In the reported experiments, SimSHAP achieves accuracy comparable to FastSHAP, with lower tabular inference and training time, although its image-training cost is higher than FastSHAP’s [2311.01010].

ViaSHAP presents a stronger architectural alternative by integrating prediction and explanation rather than learning a post hoc explainer for a pretrained predictor. The reported results state that ViaSHAP explanations are significantly more accurate than FastSHAP on both tabular data and images, with Wilcoxon signed-rank tests rejecting the null hypothesis of no difference on cosine similarity, Spearman rank, and \(R^2\) for tabular explanation quality [2505.04775].

OperatorSHAP identifies a structural limitation of FastSHAP: standard FastSHAP assumes homogeneous inputs on a fixed player set. For neural operators and heterogeneous meshes, this fixed-dimensional assumption fails. OperatorSHAP therefore lifts the FastSHAP idea to function space by learning a continuous attribution density field that transfers across grid sizes without retraining [2606.28065].

## 6. Limitations, assumptions, and ongoing issues

FastSHAP’s acceleration is amortized rather than free. The original paper is explicit that the method incurs a fixed training cost and is therefore most compelling when many explanations are required from the same model. This makes the method especially attractive in deployment settings with repeated inference, but less obviously advantageous in low-volume explanation regimes where the training overhead cannot be amortized effectively [2107.07436].

The method also depends on the availability of an appropriate value function \(v_{x,y}(s)\). In practice, especially for classification, the original experiments often use a surrogate model to approximate conditional feature marginalization. This means that FastSHAP may inherit approximation error not only from the learned explainer but also from the choice of value-function construction and feature-removal semantics [2107.07436].

A second limitation is architectural. OperatorSHAP explicitly characterizes FastSHAP as restricted to homogeneous, fixed-dimensional feature spaces, which is problematic for neural operators, irregular meshes, and resolution-varying physical data. This suggests that the original FastSHAP formulation is naturally suited to conventional tabular and fixed-grid vision settings, but does not transfer directly to grid-agnostic operator learning without methodological modification [2606.28065].

A third issue concerns post hoc faithfulness. ViaSHAP’s comparison argues that FastSHAP remains a post hoc explainer and therefore introduces a separation between the predictive model and the explanation model. This suggests a potential source of mismatch: explanation quality depends not only on the fidelity of the learned Shapley approximation, but also on how well a separately trained explainer aligns with the predictor it is asked to explain [2505.04775].

Finally, FastSHAP does not preserve explicit interaction structure. PDD-SHAP contrasts its surrogate-decomposition approach with FastSHAP on precisely this point: once FastSHAP has learned to output attributions directly, it does not expose the decomposition terms that would reveal which features interact with which others. A plausible implication is that FastSHAP is best regarded as an efficient local attribution engine rather than an interaction-aware structural model of the predictor [2208.12595].

Taken together, these limitations do not negate FastSHAP’s core contribution. They instead define the main research directions that have followed from it: broader value notions such as weighted Shapley values, simpler amortized objectives, predictor-explainer unification, interaction-aware surrogates, and function-space generalizations. Across these developments, FastSHAP remains the canonical reference point for learned one-pass Shapley estimation [2107.07436].

Source: https://www.emergentmind.com/topics/fastshap