What is LIME?

LIME is a method that approximately explains a single prediction of any machine learning model with a simple, interpretable surrogate model trained on similar examples generated around the input being explained.

The name stands for Local Interpretable Model-agnostic Explanations. It differs from SHapley Additive exPlanations in its basis: SHAP computes each feature's contribution from Shapley values in game theory, within a framework with consistency guarantees, while LIME fits a local model near the prediction, simpler and faster but sensitive to sampling settings.

Topic
Responsible AI and governance
Also known as
Local Interpretable Model-agnostic Explanations
Origin
2016, Ribeiro, Singh and Guestrin

How LIME works

  1. Many synthetic examples with slightly changed features are generated around the example to explain.
  2. These go to the model being explained and its predictions are collected.
  3. A simple model, such as a sparse linear model, is trained on them, weighted by closeness to the original example.
  4. The simple model's coefficients show which features most affected that prediction and in which direction.

In more detail

Interpretable representation, kernel width and proximity weighting

LIME operates on a simplified 'interpretable representation' rather than raw model inputs: for text it toggles words on or off, for images it masks superpixels and for tabular data it often discretises continuous variables. Perturbed samples are weighted by an exponential proximity kernel controlled by a kernel width parameter, making explanation quality highly sensitive to how locality and distance are defined.

Out-of-distribution sampling and attacks that fool LIME

Because LIME perturbs features independently, synthetic samples frequently fall outside the true data distribution, breaking natural correlations (such as age and income). Slack et al. (2020) demonstrated that adversarial models can detect these out-of-distribution probes and hide biased behaviour from LIME, meaning LIME explanations alone cannot certify model fairness.

Use with tabular models and limits with large language models

For generative LLMs, classical LIME is rarely practical because perturbing long prompts thousands of times is prohibitively expensive and breaks syntactic coherence. In enterprise deployments, LIME remains mostly used for legacy tabular black-box classifiers (often compared against deterministic TreeSHAP), whereas LLM interpretability relies on token attribution, mechanistic interpretability or citation-grounded RAG verification.

Commonly confused terms

TermHow it differs
SHapley Additive exPlanationsSHAP computes feature attributions grounded in cooperative game theory (Shapley values) with formal consistency and local accuracy guarantees, whereas LIME fits an approximate local linear surrogate via random perturbation and can vary across runs.
Global feature importance and partial dependencePartial Dependence Plots (PDP) and global feature importance summarise how features affect model predictions on average across the entire dataset, whereas LIME explains only one individual prediction locally.
Counterfactual explanationCounterfactual explanations show the smallest realistic change to inputs needed to flip a model's decision (e.g., 'increase income by 15% to get approved'), whereas LIME attributes weights to existing features around the current prediction.

Why LIME matters for on-premises AI

LIME is model-agnostic: it explains using only predictions, without access to the model's internals. This helps show the reasons for individual decisions in credit, insurance or public-sector cases. Computation runs in-house, so sensitive inputs are not sent outside. Its limits matter too: the explanation is local and approximate, does not reveal the model's true internal logic and can change with sampling settings, so important decisions are cross-checked with other methods.

ON-PREMISES EXAMPLE

A bank shows customer advisers a short LIME explanation for rejected credit applications, listing the features that most influenced the decision; the adviser checks the explanation's consistency before replying to the customer.

Common questions

How does LIME differ from SHAP?

LIME fits a simple local model around the prediction; it is fast, but results can vary with sampling. SHAP rests on Shapley values and computes feature contributions more consistently but is usually more costly.

Does LIME show the model's true logic?

No. It gives a simple explanation approximating the model's behaviour around one prediction; it does not explain the model's full inner workings.

Sources

In the glossary: Glossary, D to L

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.