Paper commentary
"Why Should I Trust You?": Explaining the Predictions of Any Classifier
LIME explains any classifier's single predictions by fitting a local linear model
- Problem Validation accuracy can overestimate real-world performance, so it cannot alone justify trusting a model. Users need to know why one prediction was made, and whether the model relies on leaked or shifted features.
- Method LIME explains a prediction by fitting a sparse linear model to perturbed samples near that instance. It leaves the classifier alone and weights samples by their closeness to the instance.
- Results LIME reached F1 between 91.8 and 96.7 on trustworthy predictions across eight model and dataset columns. It beat parzen, greedy and random in every column.
Why accuracy alone leaves trust open
Most teams judge a classifier by its accuracy on a held-out validation set. The authors argue that this number answers a narrower question than the one users face. Users need to decide whether to act on one prediction, and whether the model will behave well on real-world data.
The paper gives two failure modes that accuracy hides. Data leakage can inflate validation accuracy, as when a patient ID tracks the label in both training and validation data. Dataset shift means the training data differs from the data the model meets later, which is hard to see in raw predictions. An explanation helps here because a leaked feature appears as a reason behind predictions.
Choosing between models adds another gap. A model with higher validation accuracy can turn out to be the worse one, and the metrics a team can compute often differ from the goals it cares about. The authors therefore want explanations that work for any model, so that different models can be compared on the same footing.
Fitting a local surrogate around one prediction
The key idea is to leave the classifier alone and study only its behaviour near one instance. Near that instance, the complicated decision surface can be approximated by a simple linear model. That linear model is the explanation.
The explanation is written in a representation that people can read, and this need not match the features the classifier uses. For text, the representation is a binary vector that records whether each word is present. For images, it is a binary vector over super-pixels, where a 1 keeps a super-pixel and a 0 grays it out.
Formally, LIME searches a class of models G for the explanation g that minimizes a locality-weighted loss plus a complexity penalty. The explanation is given by \[\xi(x) = \arg\min_{g \in G} \mathcal{L}(f,g,\pi_x) + \Omega(g)\] Here f is the classifier, π_x measures how close each sample z is to x, and Ω(g) counts complexity, such as the number of nonzero weights for a linear model.
The proximity weight is an exponential kernel, \(\pi_x(z)=\exp(-D(x,z)^2/\sigma^2)\), built on a distance D such as cosine distance for text or L2 distance for images. Samples close to x get large weights and distant samples get small ones, which keeps the fit local. For text, the authors cap the number of words in the explanation at K, and this paper uses a constant K of 10 in its experiments.
How one LIME run works
A run draws random subsets of the nonzero interpretable components of x′. Each sampled vector is mapped back to the original representation, and the classifier labels it. These labelled samples form the dataset that the surrogate is fitted on.
Solving the sparsity constraint exactly is intractable, so the authors use a two-step fit. Lasso along the regularization path first selects K features. Least squares then learns the weights of those features, and this procedure is the one called K-LASSO.
The cost of one explanation depends on the time to query the classifier and on the number of samples N, not on the size of the dataset. Explaining a random forest with 1000 trees on a laptop with N = 5000 took under 3 seconds, without GPUs or parallelization. By contrast, explaining each prediction of the Inception network took around 10 minutes.
Two inherent drawbacks follow from the design. If the interpretable representation can't express a behaviour, such as a sepia tone that makes images look retro, no explanation can capture it. If the model is highly non-linear near the instance, a linear explanation may not be faithful, although the authors suggest estimating faithfulness on the sampled data.
Choosing a representative set of explanations
One explanation can't show how the model behaves globally, so SP-LIME selects a budget of B instances for the user to inspect. It arranges the explanations of n instances into an n by d′ matrix W. Each entry records the absolute weight that an instance's explanation gives to one interpretable component.
Each component j gets a global importance I_j, computed for text as the square root of its summed entries across instances. \[I_j = \sqrt{\sum_{i=1}^{n} W_{ij}}\] A feature that explains many instances therefore scores higher than one that explains few.
Coverage is the total importance of the components that get nonzero weight in at least one instance of a chosen set V. The pick problem asks for the set V with at most B instances that has the highest coverage, and it is NP-hard. Coverage has diminishing returns, so repeatedly adding the instance with the largest marginal gain reaches a guarantee of 1−1/e of the optimum.
Faithfulness and trust in single predictions
The authors test on books and DVDs, each with 2000 product reviews split into 1600 training and 400 test instances. They compare LIME with parzen, a greedy removal procedure and a random choice of K features, with K set to 10. LIME and parzen use N = 15,000 samples, and their hyper-parameters are set by cross validation.
Faithfulness is checked on classifiers that are interpretable by design, a sparse logistic regression and a decision tree, so the important features are known.
For trust, 25% of features are marked untrustworthy, and a prediction counts as trustworthy only if removing them leaves the prediction unchanged. A simulated user discounts those features inside LIME's linear model, while greedy and random mistrust any prediction whose explanation contains one. LIME's F1 on trustworthy predictions ranges from 91.8 to 96.7 across the eight model and dataset columns, and it is higher than parzen, greedy and random in each one.
The result shows that a local linear fit separates trustworthy from untrustworthy predictions well when the simulated user applies the oracle's rule.
Choosing the better of two models in simulation
The authors add 10 artificial noisy features that correlate with the label on training and validation data but not on the test data. They train pairs of random forests with 30 trees whose validation accuracies are within 0.1% of each other, but whose test accuracies differ by at least 5%.
The simulated human marks the artificial features that appear in the B explanations as untrustworthy. The human then counts how many validation predictions should be trusted and picks the classifier with fewer untrustworthy predictions. Averaged over 800 runs, LIME is consistently better than greedy whichever pick method is used. Combining submodular pick with LIME gives the highest accuracy, and it is much better than random pick with LIME when only a few examples are shown.
The authors read these trust assessments as good indicators of generalization, and they test that reading with people in the next section.
Human subjects choosing classifiers and cleaning features
The authors build a religion dataset of 819 webpages per class from DMOZ and curated lists, to estimate real-world performance. The original SVM reaches 57.3% on it, and the cleaned SVM reaches 69.0%. On the 20 newsgroups test split the order flips, with 94.0% for the original and 88.6% for the cleaned classifier, so accuracy alone would pick the worse one.
Mechanical Turk workers with basic knowledge about religion compare the two classifiers using side-by-side explanations and raw data. LIME outperforms greedy in both the random pick and the submodular pick settings. Submodular pick also improves the users' choices over random pick, so explanations separate the better classifier from the worse one when the instances are chosen well.
In the feature engineering study, workers mark words to delete after seeing B = 10 instances with K = 10 words each, and they never see the religion dataset. Ten initial subjects produce 10 classifiers, and each round's explanations go to five new users, which yields 250 classifiers in the final round. The average real-world accuracy rises across rounds on paths built with SP-LIME and with RP-LIME, and SP-LIME paths rise further.
Each path removed on average 200 words with SP-LIME and 157 with RP-LIME, and each subject spent 3.6 minutes per round.
Spotting a spurious snow signal in Husky vs Wolf
The authors train a logistic regression on 20 images, where all wolves have snow in the background and no huskies do, using Inception max-pooling features. The resulting classifier predicts Wolf whenever there is snow or a light background, regardless of animal colour, position or pose. Participants first see a balanced set of 10 test predictions without explanations, one of which is a husky classified as a wolf.
Before the explanations, 10 of 27 subjects trusted the bad model, and 12 of 27 named snow or an equivalent as a feature the model may use. After seeing the explanations, only 3 of 27 trusted it, and 25 of 27 named snow. The authors read this as explanations exposing the spurious feature, and trust in the classifier drops with it.
Three independent evaluators coded whether each response mentioned snow, and the majority decided the result. The sample is small, so the authors present the result as indicative of the utility of explanations.
Limitations
The explanation family used in the experiments is sparse linear models. The authors note that these may be unfaithful when the model is highly non-linear near the prediction, and they leave the choice among explanation families to future work.
The pick step for images is not solved in this work. The image experiments explain single predictions of Inception, and the authors leave other image features for pick selection to future work.
The trust and model-choice checks are simulated, and the human studies use Mechanical Turk workers and one small graduate-student sample. The experiments use only K = 10 and only two sentiment datasets plus the 20 newsgroups data.
Paper info
- Authors
- Marco Tulio Ribeiro, Sameer Singh, Carlos Guestrin
- Venue
- arXiv · Preprint
- First published
- 2016-2-16
- Added
- 2026-11-11
- Updated
- 2016-8-9
- Version
- v3
- arXiv
- 1602.04938
- Category
- cs.LG · cs.AI · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Marco Tulio Ribeiro, Sameer Singh, Carlos Guestrin (2016). "Why Should I Trust You?": Explaining the Predictions of Any Classifier. arXiv:1602.04938v3. https://arxiv.org/abs/1602.04938v3
BibTeX
@misc{ribeiro2016should,
title = {{"Why Should I Trust You?": Explaining the Predictions of Any Classifier}},
author = {Marco Tulio Ribeiro and Sameer Singh and Carlos Guestrin},
year = {2016},
eprint = {1602.04938},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1602.04938v3}
}