Local explanation

Also known as: local interpretability

On this page 7

A local explanation is an account of why a model produced one specific prediction for one specific input, usually expressed as the contribution of each feature, region or token to that single output. In Explainable AI, it answers the question “why this decision for this case”, as opposed to a global explanation, which describes how the model behaves across the whole data distribution.

The concept is also called local interpretability. It underpins loan denial notices, clinical decision support and model debugging, because stakeholders usually care about an individual outcome rather than average behavior. Local explanations can be produced by model-agnostic methods such as LIME and KernelSHAP or by model-specific methods such as TreeSHAP, gradient-based saliency and Grad-CAM.

How a local explanation is constructed

Every local explanation method starts from an instance to explain, the prediction of interest and a reference or baseline that defines what “absence” of a feature means. The method then measures how the output changes when features move between their actual values and that baseline, and it assigns each feature a signed attribution score.

Three mechanisms dominate. Perturbation methods sample variations of the input around the instance and observe the model’s response. Surrogate methods fit a simple interpretable model, such as a sparse linear model, to those perturbed samples within a small neighborhood. Gradient methods read the sensitivity of the output to each input directly from the model’s derivatives.

The following table maps each mechanism to its representative techniques and its main assumption.

MechanismRepresentative methodsKey assumption
Local surrogateLIMEModel is roughly linear near the instance
Game-theoretic attributionKernelSHAP, TreeSHAPShapley value axioms suit the task
Gradient-based saliencyGradient × input, SmoothGrad, Integrated GradientsModel is differentiable and gradients are informative
OcclusionOcclusion sensitivityMasking a region removes its information
Rule extractionAnchorsA short rule holds with high precision locally
Mechanisms behind local explanation methods

Forms a local explanation can take

The output of a local method is not always a list of feature weights. Depending on the data type and the audience, a local explanation can be a feature attribution vector, a saliency map over pixels, a highlighted span of text, a sufficient rule or a counterfactual that states the smallest change that would flip the decision.

FormatWhat it showsTypical audience
Attribution scoresSigned contribution per featureData scientists, auditors
Saliency mapImportant pixels or regionsRadiologists, vision engineers
Token highlightingInfluential words in textContent reviewers, analysts
Anchor ruleConditions that lock the predictionBusiness users, compliance teams
CounterfactualMinimal change that alters the outcomeAffected individuals, customers
Similar examplesTraining cases close to the inputDomain experts
Output formats and their typical audiences

Contrastive explanations form a special case: they explain why the model chose class A instead of class B, which often matches how people naturally ask about decisions. Example-based explanations and influence functions extend the idea to training data attribution, pointing at the training examples most responsible for a prediction.

Local explanation compared with global explanation

Local and global explanations answer different questions at different scopes. A global explanation, such as permutation feature importance or a global surrogate model, summarizes average behavior; a local explanation describes behavior at one point, where the model may rely on features that matter little on average.

AspectLocal explanationGlobal explanation
Question answeredWhy this predictionHow the model works overall
ScopeOne instance or small neighborhoodEntire data distribution
Typical methodsLIME, SHAP values, saliency mapsPermutation importance, ALE plots, global surrogates
Main useDecision justification, debugging casesModel validation, feature selection
Main riskInstability between similar inputsHiding subgroup-specific behavior
Scope and use of local and global explanations

The two scopes connect. Aggregating many SHAP values yields a global importance ranking, and individual conditional expectation plots sit between the scopes by tracing one instance across a feature’s range. Practitioners should still avoid reading a global story into a single local result.

Choosing and validating a local explanation method

Method choice depends on model class, data type, latency budget and the person receiving the explanation. Exact TreeSHAP runs in milliseconds on tree ensembles, whereas KernelSHAP on a black-box model may need thousands of model calls per instance.

SituationRecommended methodReason
Gradient boosted trees on tabular dataTreeSHAPExact, fast and consistent
Black-box API modelKernelSHAP or LIMERequires only prediction access
Convolutional image classifierGrad-CAM or Integrated GradientsUses internal gradients efficiently
Customer-facing adverse decisionCounterfactual plus top attributionsActionable and easy to communicate
Text classifierIntegrated Gradients on tokensRespects input embedding structure
Method selection for common situations

Validation is essential because explanations can look plausible yet be wrong. Explanation faithfulness is tested with deletion and insertion curves, which check whether removing top-ranked features actually changes the output. Stability is tested by explaining near-identical inputs and comparing results, and sanity checks confirm that attributions change when model weights are randomized.

Pitfalls of local explanations

Local explanations are approximations, not ground truth, and several failure modes recur in practice. Experienced teams document the method, baseline and parameters alongside every explanation they release.

  • Baseline sensitivity: SHAP and Integrated Gradients results change with the chosen reference input.
  • Correlated features: perturbation creates unrealistic inputs and splits credit arbitrarily between correlated variables.
  • Instability: LIME can return different top features for the same instance across random seeds.
  • Manipulation risk: models can be engineered to produce reassuring explanations while relying on protected attributes.
  • Rashomon effect: equally accurate models may yield very different local explanations for the same case.

A further limit concerns what the explanation describes. A local explanation reports how the model reached its output, not whether the output is correct or fair, and it says nothing about causal effects in the real world. A feature with a large attribution is important to the model, which does not mean that changing it would change the underlying outcome. Communicating this distinction clearly prevents users from treating attribution scores as causal advice or legal justification on their own.

In simple terms

Imagine asking a bank why your loan was refused. You do not want a lecture on how the bank treats all customers. You want to know what mattered in your own case.

A local explanation gives that answer for an AI model. It points to the few facts that pushed this one decision up or down. For example, it may say that a short credit history counted against you. It explains one decision, not the whole system, and it is an estimate rather than a perfect account.

A practical example

A regional lender uses a gradient boosted tree model to score consumer loan applications. Regulations require the lender to tell rejected applicants the principal reasons for an adverse decision, so the model risk team adds TreeSHAP attributions to every scored application.

For one rejected applicant, the attribution vector shows that a debt-to-income ratio of 48 percent contributed most to the low score, followed by two recent credit inquiries. The system maps the top three negative attributions to standard reason codes and adds a counterfactual: a ratio below 40 percent would have changed the outcome.

During a quarterly review, analysts aggregate thousands of these local explanations and notice that postal code attributions are unusually strong for one region. The finding triggers a fairness investigation and a retraining with the feature removed, showing how local explanations support both individual notices and model governance.