LIME — Explaining One Prediction at a Time

Global feature importance tells you what a model relies on overall, but the question people actually ask is local: why did the model deny this particular loan? LIME answers it with a clever trick — approximate the complicated model with a simple, interpretable one in the small neighborhood around a single prediction. It was the method that popularized model-agnostic local explanations, and understanding how it works (and where it's fragile) is essential interpretability literacy.

Post 3 covered global importance; this post is the first local method (post 1) — explaining an individual prediction. LIME (Local Interpretable Model-agnostic Explanations) is model-agnostic, intuitive, and widely used, and it introduces the core idea behind local explanation that SHAP (post 5) builds on more rigorously.

The idea: locally, even a complex model looks simple

LIME starts from a genuinely clever observation. A complex model’s decision boundary is wildly nonlinear globally — too complicated to describe simply. But locally, in the tiny neighborhood around one specific input, that boundary is approximately simple: you can fit a straightforward linear model that mimics the complex model’s behavior just in that small region. A curve, zoomed in far enough, looks like a straight line.

So to explain why the model predicted what it did for this one input, LIME: 1. Takes the single instance you want to explain. 2. Perturbs it — generates many variations by slightly changing its feature values — and asks the black-box model for its prediction on each. This probes how the model behaves around this point. 3. Fits a simple, interpretable model (usually a weighted linear model) to those perturbed points and their predictions, weighting the perturbations by how close they are to the original instance (nearby variations matter most). 4. Reads the explanation off that simple local model: its coefficients tell you which features pushed this prediction up or down, and by how much.

The result is a local, human-readable explanation — “this loan was denied mainly because of high debt-to-income and a recent missed payment, despite good tenure” — for a single decision from an otherwise opaque model. It’s model-agnostic (it only queries inputs/outputs, so it works on any black box — deep nets, ensembles, anything) and it directly answers the question users and regulators actually ask: why this one?

Why LIME was a breakthrough

LIME mattered because it made local, model-agnostic explanation practical and intuitive:

It essentially launched the modern wave of practical post-hoc explanation, and the core idea — approximate the complex model locally with a simple one — is one of the most important concepts in interpretability.

Where LIME is fragile — and why SHAP followed

LIME is powerful but has real, well-documented weaknesses that you must know to use it responsibly — and they’re exactly why SHAP (post 5) was developed:

These aren’t reasons to dismiss LIME — it’s genuinely useful, fast, and intuitive, and remains widely used — but they’re reasons to treat its explanations as suggestive, local approximations rather than exact truths (post 1’s and post 2’s recurring caveat, made concrete). In practice: use LIME for quick, intuitive local insight, but be wary of its instability (run it multiple times, check consistency), validate that the local fit is good, and reach for SHAP (post 5) when you need explanations that are stable and theoretically principled — SHAP was designed precisely to fix LIME’s lack of guarantees by grounding attribution in game theory. LIME is the intuitive pioneer; SHAP is the rigorous successor, and most serious work uses SHAP while owing the core local-explanation idea to LIME.

The throughline: LIME answers the local question “why this prediction?” with a clever idea — a complex model’s boundary is nonlinear globally but approximately linear locally, so you perturb the instance, query the black box on the variations, fit a simple interpretable (linear) model weighted by closeness, and read the per-feature contributions off it. It’s model-agnostic (works on any black box via queries), explains individual decisions (what users/regulators actually ask), is intuitive/visual, and handles tabular/text/image — which made it the breakthrough that launched practical post-hoc explanation. But it’s fragile: unstable (random perturbations → different explanations on reruns — its most cited flaw), sensitive to perturbation/neighborhood/sample choices, a potentially poor local fit in sharply-curved regions, and ungrounded/gameable (no fair-attribution theory; can be fooled to hide bias). So treat LIME explanations as suggestive local approximations, and reach for SHAP (post 5) — designed to fix exactly these gaps with game-theoretic guarantees — when stability and rigor matter.

Key takeaways

Further reading

Sources & References