---
title: Tractability of SHAP Explanations
url: https://www.emergentmind.com/topics/tractability-of-shap-explanations
type: topic
---

# Tractability of SHAP Explanations

SHAP (Shapley Additive Explanations) values are a principled feature attribution method grounded in cooperative game theory and have become central in model explainability research. The tractability of SHAP explanations—i.e., whether SHAP values can be computed or approximated efficiently—depends on the combination of model class, input distribution, SHAP variant, and, in some cases, the desired type of interaction explanation. Recent theoretical and algorithmic work has characterized this landscape in depth.

## 1. Formalization and General Algorithmic Equivalence

SHAP values for a function $F: \mathcal{X} \to \mathbb{R}$, instance $x \in \mathcal{X}$, and distribution $\mathcal{P}$ are defined as:

\[
\phi_i(F, x) = \sum_{S \subseteq N \setminus\{i\}} \frac{|S|! (n - |S| - 1)!}{n!} \left( v(S \cup \{i\}) - v(S) \right)
\]
where $v(S) = \mathbb{E}_{\mathcal{P}}[F(X) \mid X_S = x_S]$, and $N = \{1, \ldots, n\}$ indexes features. This formulation embodies the fundamental computational challenge—each $\phi_i$ involves $2^{n-1}$ terms, each term requiring conditional expectation computation.

A central result, formalized by Barceló, Cominetti, and Morgado, is that for any "simple" (cardinality-based) power index such as SHAP or Banzhaf, and for any model $F$, computation of the index is polynomially equivalent to computing expectations under product distributions. Specifically:
- If computing $\mathbb{E}_{\mathcal{P}}[F]$ is polynomial-time for the model class, so is SHAP.
- Conversely, if expectation is $\#$P-hard, so is SHAP.
This reduction is tight and general, holding for all simple indices with positive mass on the empty coalition, such as SHAP and Banzhaf [2501.02356].

## 2. Tractability Frontiers: Model and Distribution Classes

A precise taxonomy for tractable SHAP computation emerges when considering the interplay between model class and distributional assumptions:

| Model Class                | Distributional Assumption       | SHAP Complexity      | Reference          |
|----------------------------|---------------------------------|----------------------|--------------------|
| Linear regression / Linear Gaussian | Any product/factorized $\mathcal{P}$    | Polytime            | [2009.08634], [2501.02356]    |
| Decision/regression trees; ensemble forests | Any product/factorized $\mathcal{P}$    | Polytime (TreeSHAP) | [2009.08634], [2104.08015]    |
| Deterministic, decomposable Boolean circuits (d-DNNF, OBDD, SDD, FBDD) | Product or uniform   | Polytime           | [2007.14045], [2104.08015]    |
| Tractable probabilistic circuits / low-treewidth Bayes nets | Product              | Polytime           | [2009.08634], [2501.02356]    |
| Markov chain on features (first-order Markov) | Weighted automata, disjoint DNF, trees | Polytime            | [2405.02936]      |
| Logistic regression, neural nets (sigmoids), naive Bayes    | Product or NB        | $\#$P-/NP-hard     | [2009.08634], [2501.02356]    |
| General CNF/DNF                      | Product/empirical        | $\#$P-hard           | [2009.08634], [2104.08015], [2007.14045]    |
| Empirical distributions (training set) | Any model $F$         | $\#$P-hard           | [2009.08634]      |
| HMM (for interventional-type SHAP)    | Trees, automata, lin reg | Polytime             | [2502.12295]      |

Key points:
- SHAP values are polytime on any model class (and input distribution) for which $\mathbb{E}[F]$ under product/factorized distributions is polytime.
- Decision trees, additive tree ensembles, tractable circuits are the frontier of polytime exact SHAP for common ML models under product distributions.
- Logistic regression, sigmoidal NNs, Naive Bayes, and general CNF/DNF models are $\#$P-hard even under feature independence, with further intractability in the presence of feature dependencies.

## 3. Structure-based and Distributional Extensions

### Markovian and HMM Extensions

Recent advances transcend feature-independence by considering chain-structured Markov (and HMM) distributions:
- For weighted automata, disjoint DNF, and decision trees, SHAP can be computed in polynomial time under Markovian input distributions, using automata-based dynamic programming [2405.02936], [2502.12295].
- This generalizes the independence frontier, maintaining tractability for an important class of sequential models relevant to time-series and NLP.
- TreeSHAP polytime guarantees extend from empirical to general HMM backgrounds for Interventional and Baseline SHAP [2502.12295].

### Tensor Network and Parameterized Complexity

Tensor network representations allow efficient SHAP computation for a wider range of models, especially when structured as tensor trains (TT). For TT models (and f and $P$ as TT), SHAP computation is in class NC${}^2$ (polylog parallel time), and this result transfers to trees, tree ensembles, linear models, and linear RNNs. For binarized neural networks, tractability is governed by network width: if width is fixed (but not depth), SHAP is tractable, but remains hard for arbitrary width [2510.21599].

## 4. Intractability and Hardness Reductions

Polytime tractability of SHAP depends critically on both model structure and feature distribution:
- Under product distributions, SHAP computation is as hard as model expectation, thus inheriting known $\#$P-hardness for logistic regression, DNF, and neural networks.
- With dependencies (e.g., Naive Bayes or empirical distribution), SHAP may become NP-hard even for trivial classifiers [2009.08634].
- For Boolean circuits, tractability requires both determinism and decomposability; removing either restores $\#$P-hardness (see Table below):

| Boolean Circuit Type       | SHAP Complexity     |
|---------------------------|---------------------|
| d-DNNF             | Polytime           |
| Only decomposable  | $\#$P-hard         |
| Only deterministic | $\#$P-hard         |
| General DNF        | $\#$P-hard, no FPRAS [2104.08015]  |

No fully polynomial randomized approximation scheme (FPRAS) exists for SHAP on DNF/monotone DNF unless RP=NP, contrasting with the tractability of approximate model counting for DNF formulas [2104.08015].

## 5. Algorithmic and Structural Mitigations

Given the exponential complexity of exact subset enumeration, several methods offer scalability or approximation without explicit enumeration:

- **TreeSHAP and Circuit SHAP**: For tree ensembles and tractable Boolean circuits, dynamic programming enables exact polynomial-time calculation [2104.08015], [2007.14045].
- **Functional Decomposition**: For models expressible as low-dimensional additive/interacting structures (e.g., shallow trees/forests), the unique ANOVA-like decomposition can be exploited to yield exact interventional SHAP values in polynomial time, exponential only in the maximal interaction order—not total number of features [2208.06151].
- **Interaction-aware Explanations**: Pruning exponentially many interaction terms by partitioning features into a small set of interacting groups (as in iSHAP/SIAE) suppresses the combinatorial blow-up to the Bell number of the group count, which remains small for sparse interaction graphs [2402.05566].
- **Conformal Regression Surrogates**: Train a regression model to approximate SHAP values, then calibrate output intervals with inductive conformal prediction for statistical validity. This method achieves 5–10× speedups over exact SHAP for tree-based models and maintains informative confidence intervals [2308.11975].

| Approach                | Complexity           | Scope            | Reference          |
|-------------------------|---------------------|------------------|--------------------|
| TreeSHAP (exact)        | $O(T \cdot L \cdot D^2)$ per sample | Trees/ensembles | [2009.08634]      |
| Functional decomp.      | Poly($n$), exp($q$) | Trees/forests, low $q$ | [2208.06151]      |
| SIAE/iSHAP (partition)  | Poly($d$), exp($m$) | Interaction groups m | [2402.05566]      |
| Surrogate+Conformal     | Fast (MLP/XGB prediction) | General       | [2308.11975]      |

## 6. Open Problems and Research Directions

Several open directions remain for enhancing the tractability and coverage of SHAP explanations:
- Identifying novel model–distribution pairs (e.g., beyond Markov/chains or tractable circuits) that admit efficient SHAP.
- Developing formal approximation schemes (FPTAS or parameterized algorithms) for intractable settings, especially for neural networks, DNF formulas, and realistic dependent features.
- Extending the tractability frontier to tree-structured or more general Bayesian network dependencies beyond chains [2405.02936].
- Leveraging low-dimensional submodular or hierarchical structure, or exploiting sparsity in model interactions, to further shrink the explanatory player set [2402.05566].
- Formal characterization and practical optimization of constants in polynomial-time algorithms for automata-based or functional-decomposition-based SHAP, especially for high-dimensional or sequence data.

## 7. Practical Implications and Recommendations

- For any model class where computing model expectation under feature independence is tractable (e.g., trees, additive models, d-DNNF/OBDD circuits, bounded-treewidth graphical models), SHAP computation is also tractable.
- When feature dependencies cannot be ignored but are chain-structured (Markov), polynomial-time SHAP is possible for automata, decision trees, and disjoint DNF [2405.02936].
- For models that are not tractable in expectation (e.g., logistic regression, general DNF), exact SHAP is $\#$P-hard, and neither approximation nor even comparison between SHAP values is in BPP unless RP = NP [2104.08015].
- Approximate or surrogate-based SHAP with validity guarantees should be adopted when real-time explanations or high model complexity preclude exact computation [2308.11975].
- In high-dimensional domains, semantic/latent factors or feature grouping can yield interpretable and computationally feasible SHAP-style explanations [2010.07384], [2601.06114].
- Algorithm designers should exploit model structure (trees, circuits, automata, tensor networks) and interaction sparsity whenever possible.

The tractability of SHAP explanations delineates a sharp boundary in explainable AI: for simple models and certain structured dependencies, efficient and exact attribution is possible; but for general, highly expressive models, especially with complex dependencies, SHAP's theoretical guarantees do not translate to tractable computation, except through carefully optimized structure-exploiting algorithms or approximations [2009.08634], [2405.02936], [2510.21599], [2502.12295].

Source: https://www.emergentmind.com/topics/tractability-of-shap-explanations