---
title: Interaction Tensor SHAP
url: https://www.emergentmind.com/topics/interaction-tensor-shap-it-shap
type: topic
---

# Interaction Tensor SHAP

Interaction Tensor SHAP (IT SHAP) is a framework for computing exact Shapley‐Taylor interaction indices of arbitrary order in high‐dimensional machine learning models, formulated as a tensor network contraction to achieve polynomial time and polylogarithmic depth complexity under tensor train (TT) assumptions. IT SHAP is designed to overcome the exponential computational barrier inherent in existing approaches for higher‐order feature interactions, while maintaining the axiomatic exactness of the Shapley family of attribution methods [2512.05338].

## 1. Limitations of Existing Shapley Interaction Methods

Traditional feature attribution techniques in explainable AI largely rely on Shapley value–based formulations, which decompose a model’s output into contributions from individual features. The Shapley–Taylor Interaction Index (STII) generalizes Shapley values to quantify main effects and interactions of arbitrary order by applying discrete derivatives on the value function $F:2^{[n]}\to \mathbb{R}$. The central expressions are:
- Discrete derivative:
  $$
  \delta_S F(T) = \sum_{W\subseteq S} (-1)^{|S|-|W|} F(T\cup W)
  $$
- Closed-form STII:
  $$
  I^k_S(F) = \frac{k}{n} \sum_{T\subseteq [n]\setminus S} \frac{\delta_S F(T)}{\binom{n-1}{|T|}}
  $$

However, enumerating all $2^n$ subsets for fixed $S$ and $T$ yields complexity $\Theta(4^n)$ for general order $k=n$, which is prohibitive in high‐dimensional settings. Marginal SHAP Tensor (MST) methods recast first‐order effects as tensor contractions under TT structure, but do not extend to higher‐order interactions.

## 2. Mathematical Formalism: Value and Weight Tensors

IT SHAP reformulates STII exactly in terms of tensor contractions involving two central objects:
- **Value Tensor** $V^{(M,P)}$ encodes the model output under feature interventions. For routing index $s\in\{1,2\}^n$, which selects which features to keep or impute,
  $$
  V_{x,s,y} = F_{x,y}(S(s)) = E_{x'\sim P}[M_y(x_{S(s)}, x'_{S(s)^c})]
  $$
- **Weight Tensor** $\widetilde{W}^{(k)}$, a modified weighted coalitional tensor (MWCT), assigns the appropriate combinatorial weights $\alpha^k_S(\tau)$ rolled out from the closed‐form STII expression.

The contraction for order‐$k$ interactions is:
$$
T^{(k)}_{S,x,y} = \sum_{\tau} \widetilde{W}^{(k)}_{S,\tau} \cdot V^{(M,P)}_{x,\tau,y} = I^k_S(F_{x,\cdot})
$$
where $\tau$ indexes all routing choices.

## 3. Tensor Train Representation and Polynomial Complexity

A key advance of IT SHAP is showing that the weight tensor $\widetilde{W}^{(k)}$ admits an exact TT decomposition provided its combinatorial weighting function $\alpha^k_S(\tau)$ is computable by finite-state prefix recursion. Specifically, the TT format expresses an $n$-mode tensor $T$ as a chain $\langle G^{(1)},\ldots,G^{(n)} \rangle$, where each core $G^{(i)} \in \mathbb{R}^{r_{i-1} \times 2 \times r_i}$, and $r_i$ are the TT‐ranks.

Finite‐state prefix construction ensures all TT‐ranks of $\widetilde{W}^{(k)}$ are bounded by $\mathcal{O}(n^2)$ (Lemma 4.6), dramatically reducing complexity compared to the exponential scaling of naïve enumeration.

## 4. Algorithmic Workflow for IT SHAP Computation

Under TT assumptions for the model, background distribution tensor, and weight tensor, IT SHAP computation proceeds by parallel contraction of per‐mode TT cores:
- Inputs: TT decompositions for model, background, and $\widetilde{W}^{(k)}$
- Precomputation: Router cores $M^{(i)}$ selecting or imputing each feature.
- For each mode $i$, compute:
  - Mode‐$i$ MST contraction: $A_i := M^{(i)} \times_2 I^{(i)} \times_2 P^{(i)}$
  - Incorporate weighting: $C_i := A_i \times_{?,?} G^{(i)}$ (contracting routing with TT core)
- Output: Chain $\langle C^{(1)},C^{(2)},...,C^{(n)}\rangle$ is the TT representation of $T^{(k)}$.

Individual interaction terms $T^{(k)}_{S,x,y}$ are extracted via TT slice and chain product with complexity $O(n r^3)$ sequential or NC$^2$ parallel time.

### Complexity Table

| Item                   | STII (Naïve)                     | IT SHAP (TT)                |
|------------------------|----------------------------------|-----------------------------|
| Time complexity        | $\Theta(4^n)$                    | $O(n \cdot r_{IT}^3)$ (poly $n$)   |
| Space complexity       | $\Theta(2^n)$                    | $O(n \cdot r_{IT}^2)$ (poly $n$)   |
| TT‐ranks               | Exponential in $n$               | $O(n^2)$ for weight/overall poly $n$ |
| Parallel complexity    | Exponential barrier              | NC$^2$ (depth $O(\log^2 n)$)        |
| Essential operation    | $2^n$ subset enumeration         | TT contraction, rank‐dependent       |

## 5. Axiomatic Exactness and Guarantees

IT SHAP retains the five core axiomatic properties of STII—linearity, dummy, symmetry, efficiency, and interaction distribution—ensuring rigorous attribution semantics. For first‐order ($k=1$), it exactly matches MST/Shapley value decomposition. The framework thus provides a unified formalization for both main and higher‐order effects with exactness inherited from STII.

## 6. Illustrative Construction and Scaling Implications

For explicit illustration, consider $n=3$ features and $k=2$: the routing index $\tau \in \{1,2\}^3$ yields eight configurations. For $S = \{1,2\}$, the MWCT expansion recovers the expected discrete derivative, and the TT‐core construction yields ranks $\leq 12$. The finite state at position $i$ is determined by the running count and flags for membership in $S$, demonstrating polynomial TT‐rank scaling.

A plausible implication is that, whenever empirical models and data distributions exhibit TT‐ranks in the low hundreds, IT SHAP is practical up to hundreds of dimensions on commodity hardware.

## 7. Practical Impact and Future Directions

By reformulating Shapley–Taylor interactions as TT‐structured tensor contractions, IT SHAP renders tractable the analysis of higher‐order interactions in large black box models. The approach is foundational for scalable interaction‐aware explainable AI (XAI), enabling a granular decomposition of feature interplay previously infeasible in deep and high‐dimensional architectures. Theoretical results guarantee polynomial time and NC$^2$ parallelism under TT‐rank conditions (Theorem 4.8). In general tensor networks (TN), complexity is #P‐hard, so TT structure is essential for scalability.

Future research directions include characterizing TT‐rank bounds for real model/distribution pairs, error analysis for background estimation, empirical benchmarking for large $n$, and extensions to alternative tensor formats such as Tucker and CP. Preliminary results indicate feasibility for dimensions $n$ in the hundreds, provided TT ranks remain manageable.

In summary, Interaction Tensor SHAP establishes the first provably exact, scalable, and axiomatically consistent framework for high‐order Shapley–Taylor interactions, formulated as polynomial‐time tensor train contractions [2512.05338].

Source: https://www.emergentmind.com/topics/interaction-tensor-shap-it-shap