What SHAP and LIME Explain—and What They Do Not

An explanation can make a model’s output easier to inspect, but it does not turn that model into a trustworthy decision-maker by itself. A useful starting point is to be precise about the question being asked: which inputs did this fitted model associate with this prediction? That is different from asking what caused an outcome, whether the data is representative, or whether the system is fair.

LIME and SHAP are two widely used approaches for attributing a model’s output to its inputs. They are helpful tools for investigating model behaviour; they are not substitutes for validation, governance, or domain expertise.

LIME: a local approximation

LIME, short for Local Interpretable Model-agnostic Explanations, explains a prediction by fitting a simpler, interpretable model around that prediction. It perturbs the input, observes how the original model responds, and uses those responses to build a local approximation.

The emphasis is local: the explanation can help investigate why a model behaved as it did near one particular example. That does not mean the simple model is a faithful description of the whole system.

SHAP: feature attributions for a prediction

SHAP is a framework for assigning feature-attribution values to a prediction. It draws on Shapley values from cooperative game theory and places several additive feature-importance approaches within one framework.

For a particular model output, a SHAP explanation can show how features moved the output relative to a reference value. It is still an account of the model’s behaviour—not proof that a feature caused the real-world outcome.

How to use explanations responsibly

The choice between methods is less important than the evaluation around them. Before relying on an explanation, ask:

  • What question should this explanation answer: a single prediction, a pattern across a dataset, or a model-development decision?
  • Does the explanation remain stable when reasonable modelling or input choices change?
  • Are correlated inputs, data quality, or the chosen reference distribution affecting the attribution?
  • Can a domain expert tell whether the explanation is plausible and useful?

These questions matter because a compelling visualisation can create false confidence. Explanations should sit alongside performance evaluation, data quality checks, and appropriate human review.

A useful boundary

LIME and SHAP explain aspects of a fitted model. Neither establishes causality, guarantees fairness, or demonstrates that a model will generalise safely in a new setting. Treating explanation as one form of evidence—not the final verdict—is a more dependable starting point for trustworthy AI work.

This article is an introductory guide. It does not disclose findings from my unpublished MSc research on explanation tamper resistance.

References

  1. Ribeiro, M. T., Singh, S., & Guestrin, C. (2016). “Why Should I Trust You?”: Explaining the Predictions of Any Classifier.
  2. Lundberg, S. M., & Lee, S.-I. (2017). A Unified Approach to Interpreting Model Predictions.



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • 6 months a data engineer…
  • Failing forward; Lessons from Airflow error alerts.
  • Learning while working.
  • When the Explanation Is the Target: Building a Reproducible XAI Robustness Benchmark
  • Grounded by Design: Building a Self-Hosted Assistant for Health-Supply Planning