Computing Library › Machine Learning
Machine Learning

LIME Explanations

LIME explains one prediction by fitting a simple, interpretable model to the black box behavior nearby.

Local, model-agnostic explanation

LIME, Local Interpretable Model-agnostic Explanations, explains an individual prediction by approximating the complex model with a simple one, but only in the small region around that input. The key insight is that even a wildly nonlinear model looks roughly linear in a tight neighborhood, so a sparse linear model fit there can reveal which features drove this particular decision.

How LIME builds an explanation

Kronos motion — lego machine

Around the instance of interest, LIME generates many perturbed samples, gets the black box prediction for each, and weights them by proximity to the original instance. It then fits an interpretable surrogate, usually a sparse linear model, to those weighted predictions. The surrogate coefficients are the explanation: how much each feature pushed the prediction up or down locally.

The role of perturbation

LIME depends heavily on how it perturbs inputs and how it defines the neighborhood width (the kernel). These choices are somewhat arbitrary and strongly affect the result, so two runs, or two kernel widths, can give different explanations. This instability is LIME best-known weakness.

LIME versus SHAP

SHAP can be viewed as a principled special case that fixes the weighting and objective to satisfy fairness axioms, which makes it more consistent but often slower. LIME is faster and more flexible but lacks those guarantees and can be gamed. Both are local, post-hoc tools within interpretability, and both explain the model, not the underlying causal reality.