Shaping Up SHAP: Enhancing Stability through Layer-Wise Neighbor Selection

Gwladys Kelodjou, Laurence Rozé, Véronique Masson, Luis Galárraga, Romaric Gaudel, Maurice Tchuenté, Alexandre Termier

Abstract

Kernel SHAP is a widely used method for explaining black-box machine learning models, yet it suffers from inherent instability due to its stochastic nature. This paper introduces ST-SHAP (Stable SHAP), a deterministic approach that employs a layer-wise sampling strategy to ensure reproducible explanations. By sequentially filling perturbation layers, ST-SHAP eliminates the "jitter" common in standard Kernel SHAP. Furthermore, we propose a "Layer 1" attribution method that provides a computationally efficient alternative with linear complexity. Our evaluation across eight datasets demonstrates that ST-SHAP achieves perfect stability without compromising explanation fidelity, offering a reliable foundation for high-stakes AI applications.

Introduction

In high-stakes domains such as healthcare and finance, the interpretability of AI models is as crucial as their accuracy. Kernel SHAP has emerged as a gold standard for providing feature attribution scores. However, a significant limitation persists: its reliance on random sampling to approximate Shapley values leads to inconsistent results across multiple runs on the same input. This lack of stability undermines user trust and complicates the deployment of AI in regulated environments.

Figure 4: Demonstrating the instability of standard Kernel SHAP. Multiple executions on the same input instance yield varying feature attribution scores and rankings.

Methods

The instability in Kernel SHAP stems from the random selection of "neighbors" (perturbed versions of the input) used to estimate feature importance. These neighbors are categorized into layers based on the number of active features.

ST-SHAP (Stable SHAP)

ST-SHAP addresses the jitter problem by prioritizing the inclusion of complete layers. Instead of sampling randomly across the entire feature space, ST-SHAP fills layers sequentially. If the computational budget is insufficient to include an entire layer, random sampling is restricted solely to that specific layer. This constraint significantly reduces variance. When the budget allows for the inclusion of full layers, the process becomes entirely deterministic, ensuring that the same input always produces the same explanation.

Layer 1 Attribution

As a further optimization, the authors introduce "Layer 1" attribution, which considers only perturbations involving a single feature. This method is proven to belong to the Least Square (LES) family of attribution scores, maintaining essential properties like symmetry and efficiency. With a complexity of $O(M)$, where $M$ is the number of features, it is orders of magnitude faster than traditional SHAP approximations.

Results

The proposed methods were evaluated on eight datasets using models including SVMs, Random Forests, and Neural Networks.

Stability and Fidelity

The primary metric for stability is the Jaccard coefficient, measuring the overlap of top features across runs. ST-SHAP consistently achieves a Jaccard coefficient of 1.0 at budget levels corresponding to complete layers, indicating perfect reproducibility. In contrast, standard Kernel SHAP exhibits significant fluctuations.

Figure 6: Stability comparison on the HELOC dataset. ST-SHAP (solid lines) achieves perfect stability (Jaccard = 1.0) at specific budget thresholds, significantly outperforming standard SHAP (dashed lines).

Crucially, this gain in stability does not come at the cost of fidelity. ST-SHAP maintains high "adherence" to the underlying black-box model, ensuring that the explanations remain accurate representations of model behavior.

Computational Efficiency

The Layer 1 approach demonstrated remarkable performance, often yielding feature rankings highly correlated with full SHAP values (Kendall $\tau > 0.85$) while being up to 1,000 times faster. This makes it a viable candidate for real-time explanation systems.

Conclusion

ST-SHAP solves the critical issue of instability in local model explanations. By constraining the sampling process to a layer-wise structure, it provides deterministic and reliable feature attributions. The introduction of Layer 1 attribution further extends the utility of SHAP-based methods to large-scale, time-sensitive applications. Future research will focus on extending these stability guarantees to global model summaries and exploring the relationship between model complexity and the required sampling budget.

Summary updated

BibTeX
@inproceedings{kelodjou2024shaping,
  author = {Gwladys Kelodjou and Laurence Rozé and Véronique Masson and Luis Galárraga and Romaric Gaudel and Maurice Tchuenté and Alexandre Termier},
  title = {{Shaping Up SHAP: Enhancing Stability through Layer-Wise Neighbor Selection}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=mh9atlyw4w},
}
Figure