SHAP-IQ: Interaction Quantification in ML
- SHAP-IQ is a unified framework that quantifies higher-order Shapley interactions using unbiased, sampling-based estimators.
- It partitions feature interactions into deterministic and stochastic parts to significantly reduce the exponential computational cost.
- The method offers rigorous theoretical guarantees and versatile applications across various ML models, boosting interpretability.
SHAP-IQ (SHAPley Interaction Quantification) refers to a unified, theoretically principled, and computationally efficient methodology for estimating Shapley-based feature interactions of any order in machine learning models. This approach generalizes the classic Shapley value framework—originally for additive feature attributions—to quantify higher-order synergistic or redundant contributions among groups of features via cardinal interaction indices (CIIs). SHAP-IQ provides unbiased, scalable, and axiomatic estimates of interaction effects, equipping practitioners to dissect both individual attributions and complex interactions in modern black-box models.
1. Motivation and Foundations
The standard Shapley value (SV) decomposes a model’s output for an input into additive feature attributions by averaging marginal contributions over the power set of features. While satisfying properties such as local accuracy, missingness, and consistency, SV inherently captures only main effects. Shapley interaction indices (SIs), including the Shapley Interaction Index (SII), Shapley Taylor Index (STI), and Faithful Shapley Interaction Index (FSI), extend SV by assigning joint contributions to feature subsets, theoretically overcoming the main-effects limitation.
A central challenge in leveraging SIs is their exponential computational cost, as for d features, 2d coalitions must theoretically be considered. SHAP-IQ addresses this challenge by introducing a novel, unified sampling-based estimator that works for all CIIs—i.e., interaction indices satisfying linearity, symmetry, and dummy axioms—while providing rigorous theoretical guarantees for approximation quality and efficiency (Fumagalli et al., 2023).
2. Theoretical Representation and Cardinal Interaction Indices
The theoretical insight underpinning SHAP-IQ is that any interaction index Im(S) (for subset S and order ≤ s₀) meeting standard axioms admits the discrete derivative representation
where ν_0(T) = ν(T) − ν(∅) and γ is a weight kernel determined solely by the cardinalities of T and its overlap with S.
This representation generalizes earlier derivations for SII and centralizes all any-order interaction estimation as a sum of ν_0(T) across subsets T. Critically, after a single evaluation of ν_0(T), SHAP-IQ can efficiently update all relevant interaction scores for all S such that |S| ≤ s₀. Therefore, during Monte Carlo sampling, many interaction estimates are updated in parallel.
3. The SHAP-IQ Algorithm: Efficient and Unbiased Estimation
Instead of naïvely summing over all 2d subsets, SHAP-IQ divides the calculation into deterministic (extreme subset sizes) and stochastic (middle subset sizes) parts. Letting k₀ be a practitioner-chosen cutoff, SHAP-IQ computes small or large T deterministically, sampling only the "middle" T. The estimate is
where c_{k_0}(S) is a deterministic sum, p_{k_0} is the sampling distribution, and all interaction scores for |S| ≤ s₀ can be updated per model evaluation.
Strong theoretical properties include:
- Unbiasedness and Consistency: The estimator is unbiased. Any-order interaction estimates converge by Chebyshev's inequality, with error decaying as O(1/√K), K being sample size. On-line variance estimation is feasible via Welford’s algorithm.
- Efficiency: The sum of all interaction scores equals ν(D) – ν(∅) for indices satisfying s-efficiency (e.g., SII and STI).
- Generalization: The approach yields correct SV computation for |S| = 1, with the SV case reducing to a closed-form weighted sum over sampled ν_0(T) (which in this instance is also equivalent to an unbiased KernelSHAP formulation).
4. Practical Implementation and Applications
SHAP-IQ is instantiated via the following high-level steps:
- Sampling Subsets: Generate random feature subsets T according to a kernel-based or importance-weighted probability distribution (e.g., proportional to the Shapley kernel μ).
- Model Evaluation: For each sampled T, compute ν_0(T) = ν(T) – ν(∅) (typically ν(T) is the model's output with only features in T present).
- Parallel Updates: Use the γ_{|S|}m weight to update all interaction indices for S with |S| ≤ s₀.
- Variance Estimates: Update running variance/covariance matrices for error bounds.
In practical settings, SHAP-IQ has been applied to LLMs (e.g., DistilBERT for sentiment on IMDB), vision models (ResNet18 on ImageNet with superpixel groupings), and high-dimensional synthetic rules (sum-of-unanimity models), demonstrating significant improvements in computational tractability and interpretability over permutation-based and kernel-based baselines. The estimator efficiently reuses each model evaluation to update multiple (potentially all) interactions, yielding substantial cost reductions.
5. Comparative Analysis with Existing Methodologies
Prior approaches targeted estimation for specific interaction indices or were restricted to particular model families:
Method | Properties | Applicability | Scalability |
---|---|---|---|
Permutation Sampling | Unbiased, high variance | Any, CIIs | Slow (exp.) |
Kernel-based (KB) | Weighted regression | Any, SV/some SII | Fast (1st order) |
SHAP-IQ | Unbiased, general CIIs | Any, CIIs | Fast, all orders |
TreeSHAP-IQ | Exact, fast for trees | Tree models | Fast, any order |
SHAP-IQ uniquely provides a unified framework for any CII, supports parallel and unbiased estimation for any interaction order, and permits robust variance estimation. Unlike permutation-based approaches (unbiased but slow and high variance) and kernel regression (efficient but typically for SV/low-order only), SHAP-IQ is both general and sample-efficient.
6. Axiomatic Guarantees and Theoretical Implications
Axiomatic analysis in SHAP-IQ ensures the estimator:
- Satisfies linearity (responses are linear in the value function),
- Respects symmetry (indistinguishable features get equal attributions),
- Implements the dummy axiom (zero marginal effect yields zero attribution),
- Adheres to s-efficiency, where the sum over all orders up to s exhausts the model's change.
The general representation enables consistent application to any CII. In particular, SII and STI respect s-efficiency, guaranteeing additive decomposability; FSI indices, while effective empirically, may not always exhibit this property from a sampling perspective.
7. Broader Impact and Extensions
By providing unbiased, theoretically justified, and efficient estimation of higher-order interactions, SHAP-IQ substantially widens the interpretability capacity of XAI in black-box models. It complements—and in cases like complex neural and ensemble models, significantly outperforms—earlier methods, making practical, unbiased interaction attributions feasible at scale.
SHAP-IQ underlies recent algorithmic and software advancements in explainable AI, including open-source toolkits such as shapiq (Muschalik et al., 2 Oct 2024), which generalize the computation of SVs and SIs to high-dimensional, real-world applications. As understanding complex model behavior and interactions becomes increasingly critical (e.g., in high-stakes domains), SHAP-IQ offers a principled solution integrating rigorous approximation error bounds and robust interaction quantification across supervised learning contexts.