Approximating the Shapley Value without Marginal Contributions

Patrick Kolpaczki, Viktor Bengs, Maximilian Muschalik, Eyke Hüllermeier

Abstract

Calculating exact Shapley values for feature attribution in machine learning is computationally prohibitive for models with many features. Traditional approximation methods rely on marginal contributions, which require multiple model evaluations per feature and scale poorly with dimensionality. We introduce SVARM and Stratified SVARM, two novel algorithms that decouple Shapley values from marginal contributions by treating them as the difference between two weighted averages. This approach allows every model evaluation to update the importance scores of all features simultaneously. Our methods achieve state-of-the-art accuracy with a theoretical variance bound that scales logarithmically with the number of features, significantly outperforming existing linear-scaling methods.

Introduction

In Explainable AI (XAI), the Shapley value is widely regarded as the most principled method for attributing a model's output to its input features. However, its exact calculation requires $2^n$ model evaluations for $n$ features, making it intractable for most real-world applications. Existing approximation techniques, such as ApproShapley and KernelSHAP, typically estimate the "marginal contribution" of a feature—the change in output when a feature is added to a specific subset ($v(S \cup \{i\}) - v(S)$).

This reliance on marginal contributions introduces two primary inefficiencies. First, it is computationally expensive, often requiring two model evaluations to obtain a single data point for one feature. Second, the variance of these estimates typically grows linearly with $n$, necessitating an increasing number of samples as models grow in complexity. To address these challenges, we propose a method that maximizes the information extracted from every model evaluation by moving away from the marginal contribution paradigm.

Methodology: The SVARM Approach

The core innovation of this work is a mathematical reformulation of the Shapley value ($\phi_i$). Instead of the traditional marginal contribution sum, we represent it as the difference between two weighted averages: $$\phi_i = \phi_i^+ - \phi_i^-$$ where $\phi_i^+$ is the weighted average of coalition values containing player $i$, and $\phi_i^-$ is the weighted average of those not containing $i$.

SVARM (Shapley Value Approximation without Requesting Marginals)

SVARM utilizes a "swarm update" mechanism. When a coalition $A$ is sampled and its value $v(A)$ is evaluated, this single value is used to update the $\phi^+$ estimate for every feature inside the coalition and the $\phi^-$ estimate for every feature outside it. This allows one model evaluation to provide information for all $n$ players simultaneously, effectively "recycling" every access to the value function.

The SVARM update mechanism: decomposing the Shapley value into positive and negative components and updating all players from a single coalition sample.

Stratified SVARM

To further reduce variance, we introduce Stratified SVARM. This variant partitions coalitions by size (strata), as coalitions of similar sizes often have comparable values. By sampling within these strata, the algorithm achieves even higher precision. An empirical version, S-SVARM+, incorporates sampling without replacement to further enhance performance and convergence speed.

Evaluation and Results

We evaluated SVARM against industry standards like KernelSHAP and Owen Sampling across several domains, including synthetic games (Airport game, Shoe game) and real-world XAI tasks (NLP sentiment analysis with DistilBERT, image classification with ResNet18, and tabular classification with gradient-boosted trees).

Key Findings

  1. Efficiency and Convergence: S-SVARM+ consistently converged to true values faster than competitors. In synthetic tests like the "Shoe game," it maintained a lower Mean Squared Error (MSE) across all computational budgets.
  2. Logarithmic Scaling: We proved that SVARM’s variance has a logarithmic dependence on $n$ ($O(\frac{\log n}{T})$), compared to the linear dependence ($O(\frac{n}{T})$) of traditional sampling methods. This makes it uniquely suited for high-dimensional datasets.
  3. State-of-the-Art Performance: S-SVARM+ achieved approximation quality that rivals or exceeds KernelSHAP while being theoretically more robust and parameter-free.

Conclusion and Future Work

SVARM represents a significant shift in Shapley value approximation. By decoupling the calculation from marginal contributions, it provides a more efficient and scalable solution for XAI. While the current implementation requires $O(n^2)$ space for stratification—manageable for hundreds of features—future work could explore "coarse stratification" to handle thousands of features or exploit specific model structures to further accelerate convergence.

Summary updated

BibTeX
@inproceedings{kolpaczki2024approximating,
  author = {Patrick Kolpaczki and Viktor Bengs and Maximilian Muschalik and Eyke Hüllermeier},
  title = {{Approximating the Shapley Value without Marginal Contributions}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i12.29225},
}
Figure