LIME and Local Surrogate Models
A technique for explaining one single prediction from a complex model by fitting a simple, interpretable model — usually a linear one — that mimics the complex model's behavior only in the small neighborhood right around that one prediction.
Prerequisites: Partial Dependence Plots
A gradient-boosted model flags a specific trade today as high-conviction, and a portfolio manager reasonably asks: why this trade, specifically? A partial dependence plot describes the model's average behavior across the whole feature range — useful for understanding the model in general, but not for explaining one particular decision made on one particular day. LIME (Local Interpretable Model-agnostic Explanations) answers the narrower, more urgent question: for this one prediction, what pushed the model to this specific number, in terms a human can act on immediately?
An analogy: a tangent line on a curved road
A mountain road curves constantly across its full length — no single straight line describes the whole route. But if you only care about the next 50 meters ahead of your car right now, a straight line (a tangent) is a perfectly good local approximation: it tells you accurately enough which way to steer for the stretch immediately in front of you, even though it would badly mislead you about a hairpin turn five miles down the road. LIME builds exactly this kind of tangent for a complex model: around one specific prediction, it approximates the model's twisting, nonlinear decision surface with a simple straight (linear) model that's only claimed to be accurate in that local neighborhood.
The mechanics, one step at a time
- Take the one instance you want to explain — today's flagged trade, with its specific feature values.
- Generate many perturbed variations of it: nudge the momentum, volatility, and other features slightly up and down, creating a cloud of nearby synthetic points.
- Run the real, complex model on every one of these nearby synthetic points to get its predictions.
- Fit a simple, interpretable model — typically a weighted linear regression — to this local cloud of (perturbed features, complex-model prediction) pairs, weighting points closer to the original instance more heavily.
- The coefficients of that local linear model are the explanation: "for this specific trade, momentum contributed +0.4 to the score, sector contributed −0.1."
In plain English: instead of trying to understand the complex model everywhere at once, LIME zooms in on the one neighborhood that matters right now and asks a much simpler question there — "in this small region, what does a straight line say is driving the score?" — which a human can read off directly as a list of feature contributions.
Worked example: explaining one flagged trade
The full gradient-boosted model gives today's candidate trade a score of 0.82 (high conviction). LIME perturbs the instance's momentum, volatility, and sector-relative-strength features across 500 nearby synthetic variations, scores each with the real model, and fits a local weighted linear model to the results. That local model reports approximate contributions: momentum , sector-relative-strength , volatility , baseline , summing to roughly . The PM now has an actionable read: this specific trade's high score is driven mainly by strong momentum and relative strength, only slightly dampened by elevated volatility — a story that's easy to sanity-check against the trader's own read of the setup, even though the underlying model itself has no single global equation that would say the same thing for every trade.
What this means in practice
LIME is the tool for case-by-case explanations demanded by compliance, risk committees, or a PM overriding a specific flagged trade — situations where "why did the model do this, right here, right now" matters more than a global picture. It's model-agnostic, so it works identically whether the underlying model is a tree ensemble or a neural network. But the explanation is only as good as the local neighborhood it was fit on: a different perturbation radius or sampling scheme can produce a noticeably different-looking explanation for the same instance, and the resulting simple model can be unstable if the true decision surface curves sharply right at that point.
LIME explains one specific prediction by generating perturbed neighbors around it, scoring them with the real model, and fitting a simple linear model to that local cloud — a tangent-line approximation to a complex model's decision surface, valid only in the immediate neighborhood of the instance being explained.
A LIME explanation is not a claim about the model's global behavior, and it is not fully stable — rerunning it with a different random perturbation seed or neighborhood size can shift the reported feature contributions noticeably. Treat a single LIME explanation as a rough, local sketch, not a precise or reproducible attribution.
Practice in interviews
Further reading
- Ribeiro, Singh & Guestrin, Why Should I Trust You? Explaining the Predictions of Any Classifier