TL;DR
Complex models such as ensembles and deep networks are accurate but hard to read. Many methods explain a single prediction by giving each input feature a number, but the methods disagreed and it was unclear which to trust. Lundberg and Lee show that every method in one large class of "additive" explanations can be written as a linear model over binary switches, and that exactly one member of that class satisfies three simple fairness properties. They call it SHAP (SHapley Additive exPlanations) and propose faster ways to estimate it.
Builds on: Shapley Value, Linear Regression, “Why Should I Trust You?”: Explaining the Predictions of Any Classifier, Weighted Least Squares · Leads to: SHAP Values, the feature-attribution tools that use it
Why it mattered
SHAP became a common name for per-prediction feature attribution, and its Kernel SHAP and Deep SHAP estimators are the paper's practical contribution, with code released by the authors. The paper has been cited about 47,000 times according to the metrics snapshot. Its most lasting effect is the framework itself: a reader can ask of any new attribution method whether it is local-accurate, missingness-respecting and consistent, and the answer tells them whether it can be trusted for comparison.
The problem
Before this paper, a user who wanted to explain one prediction had many choices. LIME fits a local linear model around the input. DeepLIFT compares activations with a reference input. Layer-wise relevance propagation splits the output back through a network. Shapley-based methods average over feature subsets. Each produced a different set of numbers for the same prediction, and nothing said which set was correct.
The authors ask two questions. First, what do these methods have in common? Second, is there a principled rule that picks one answer? The difficulty is that the methods look different on the surface. LIME uses a regression with hand-chosen weights, DeepLIFT uses a backward pass, and the Shapley methods use game-theory formulas. To compare them you need a shared form and a shared list of properties that a good attribution should have.
How it works
The paper's logic runs in four steps, from the shared form to the final estimator.
flowchart LR A[Any explanation] --> B[Additive form: phi_0 plus sum of phi_i z_i] B --> C[Three properties: local accuracy, missingness, consistency] C --> D[Unique solution: Shapley values] D --> E[SHAP estimators: Kernel SHAP, Deep SHAP, and others]
- Treat the explanation as a model. Let be the model being explained and a simpler explanation model that is only meant to be faithful near one input . A method is an additive feature attribution method if has the form: a base value plus one weight per feature, where each feature is switched on () or off (). Its output is the sum of the weights that are switched on.
- Check that known methods fit. LIME, DeepLIFT, layer-wise relevance propagation and the three classic Shapley estimators all fit this form. Their weights differ, but the shape is the same. This is the paper's "unity".
- Impose three properties. Local accuracy: the explanation adds up to the model's output for this input. Missingness: a feature that is absent has weight zero. Consistency: if a model changes so that a feature's contribution goes up or stays the same whatever the other features do, its weight must not go down.
- Read off the answer. Theorem 1 says there is exactly one weighting that satisfies all three properties, and it is the Shapley value of the game where a coalition of features is worth the model's output when only those features are known. The paper names the resulting values SHAP values. Because the conditional expectation replaces a missing feature, the value of a coalition is the expected prediction given the known features.
- Estimate it. Computing Shapley values exactly needs model evaluations for features. Kernel SHAP fits the additive model by weighted least squares with a specific weighting kernel, so the Shapley values drop out of a regression with far fewer evaluations. Deep SHAP passes these values backwards through a network, combining them from small components.
A two-line check. Local accuracy: the base value plus the sum of the weights equals . Missingness: setting a feature's switch to 0 removes its weight from the sum.
The math
The explanation model is linear in binary switches. Let mark which of simplified features are present. Then
where is the base value and is the attribution to feature .
Step 3 in symbols: the Shapley value
The unique solution satisfying the three properties is the Shapley value. Let be the set of features. For feature , let run over the subsets of the other features, , and let be the number of features in . Then
Here is the model's output when only the features in are known. The bracket is the marginal contribution of to . The weight is the chance that a random ordering of the features puts exactly the features of in front of . Read it as: average the marginal contribution of over all orders.
Step 4 in symbols: the Shapley kernel
Kernel SHAP chooses the regression weights so that least squares recovers these values. The paper's Theorem 2 sets
with infinite weight on the empty and full subsets, which forces and the sum of all weights to equal . The paper notes that this is equivalent to a constrained quadratic formulation of Shapley values from econometrics, which the authors found while preparing the manuscript.
Worked examples
These examples apply the Shapley formula from Step 3 to the sickness example of Figure 4, where the paper gives the model's output for each combination of two symptoms.
- Two features: fever (F) and cough (C). The model output is 2 when both are present, 5 when only one is present, and 0 when neither is present. Take the base value .
- Attribution to fever. Ordering 1: fever first. Marginal contribution is .
- Ordering 2: cough first. Marginal contribution is .
- Average over the two orders: . So .
- By symmetry .
- Check local accuracy: .
- Interpretation: each symptom gets credit 1, even though neither produces the output alone. The large drop when the second symptom arrives (from 5 to 2) is shared fairly between the two.
- Take the same sickness model and an input where fever is present and cough is absent. The output is 5.
- Missingness says cough, which is absent, must get weight 0. Check: cough's switch is 0, so its term drops out of the sum.
- Local accuracy: base value 0, plus fever's weight, plus cough's weight 0, must equal 5.
- Fever's weight must therefore be 5. This agrees with the Shapley formula: with cough absent, fever's marginal contribution over the empty set is .
- Interpretation: when a feature is absent, it cannot take credit, and the rest of the output is assigned to the features that are present.
- A model with features has subsets. An exact Shapley computation has to consider the marginal effect of each feature over the subsets of the others.
- Kernel SHAP does not enumerate every ordering. It evaluates the model on a set of chosen subsets and fits the weighted linear regression of Theorem 2.
- The paper's Figure 3 compares Kernel SHAP, Shapley sampling and LIME as the number of model evaluations grows, on a decision tree using 10 features and on one using 3 of 100 features. Kernel SHAP reaches a stable estimate with fewer evaluations, and the authors report that LIME's values can differ from the SHAP values that satisfy local accuracy and consistency.
- Try it: why does the Shapley kernel put infinite weight on the empty and full subsets? Answer: those subsets fix the base value and force the attributions to sum to , which is local accuracy. Without the infinite weights the regression would not reproduce the Shapley values.
Results
The paper's results are mostly figures and qualitative comparisons, so the numbers below are the ones stated in the text and captions.
- Unification: the additive class contains six existing methods: LIME, DeepLIFT, layer-wise relevance propagation, Shapley regression values, Shapley sampling values and Quantitative Input Influence.
- Uniqueness (Theorem 1): exactly one additive method satisfies local accuracy, missingness and consistency.
- Computation (Section 4 and 5.1): Kernel SHAP reaches more accurate estimates with fewer evaluations of the model than Shapley sampling values and LIME, especially with regularisation (Figure 3).
- Complexity: the paper states that regression-based estimation has cost and that Max SHAP computes the Shapley values of a max function over inputs in time rather than .
- Human agreement (Section 5.2): in two simple settings the paper's Amazon Mechanical Turk participants (30 and 52 people) gave explanations that agreed more with SHAP than with LIME or DeepLIFT. The paper reports this qualitatively in the text.
- Images (Section 5.3): on an MNIST convolutional network, the paper masks 20% of the pixels chosen by each method to switch the predicted class from 8 to 3. Figure 5 plots the change in log odds over 20 random images and the authors use it to support the better SHAP estimates.
Limits. The properties are asserted for the additive class, so a method outside the class is not covered. The conditional expectation used for missing features is approximated, and the paper's model-specific shortcuts assume feature independence or linearity. The human study uses very simple models, and the MNIST study uses one network.
Reading guide
- Section 1 (Introduction): the trade-off between accuracy and interpretability. Needs nothing beyond Linear Regression.
- Section 2 (Additive feature attribution methods): the form in Definition 1 and the six methods. Needs “Why Should I Trust You?”: Explaining the Predictions of Any Classifier for the local-approximation idea.
- Section 3 (Properties and Theorem 1): the three properties and the uniqueness proof. Needs Shapley Value.
- Section 4 (SHAP values): the conditional expectation, Kernel SHAP and Deep SHAP. Needs Conditional Expectation, Weighted Least Squares and Expected Value.
- Section 5 (Experiments): computational, human and image studies. Needs only the ideas above.
- Section 6 (Conclusion): future work on interaction effects and model-type-specific methods.
Check yourself
QuestionIn one sentence, what does the local accuracy property require of an explanation?Show answer
The base value plus the sum of the feature attributions must equal the model's output for that input, so the explanation adds up exactly to the prediction it explains.
QuestionA model with two features has outputs f(empty)=0, f(A)=4, f(B)=1 and f(A,B)=6. Compute the Shapley value of feature A.Show answer
Marginal contribution of A when added alone: . Marginal contribution when added after B: . The average is . So .
QuestionWhy does the paper say that methods outside the Shapley class violate local accuracy or consistency?Show answer
Theorem 1 says that under the three properties there is only one additive solution, and it is the Shapley value. Any other additive method must therefore break local accuracy or consistency. LIME, with its heuristic kernel and loss choices, is the paper's example: its weights do not recover the Shapley values.
QuestionExplain why the infinite kernel weight on the empty and full subsets matters for Kernel SHAP.Show answer
Those subsets pin the base value to and force the attributions to sum to , which is local accuracy. Without them the weighted regression would not return values that satisfy the three properties.
QuestionA deep model is explained by Deep SHAP. Why can it avoid choosing linearisations by hand?Show answer
DeepLIFT's linearisation of each component comes from its heuristically chosen backpropagation rules. Deep SHAP defines those multipliers in terms of the SHAP values of each component instead, so the linearisation rests on Shapley values. The multipliers are then passed backwards through the network, as DeepLIFT does.
Sources
- Lundberg, S. M., and Lee, S.-I. (2017). A Unified Approach to Interpreting Model Predictions. arXiv:1705.07874. https://arxiv.org/abs/1705.07874
- SHAP implementation: https://github.com/slundberg/shap