Anchors · explainable AI

Also known as: anchor explanations

On this page 7

Anchors are a model-agnostic local explanation method in explainable AI that describes a single prediction with an if-then rule: a small set of feature conditions which, when they hold, keep the model’s prediction the same with high probability, regardless of the values of the remaining features. A rule such as “if income is above 60,000 and no missed payments, then approve” is said to anchor the prediction.

The method was introduced in 2018 by Ribeiro, Singh and Guestrin, the authors of LIME, as high-precision model-agnostic explanations. It addresses a weakness of linear surrogate explanations: their unclear scope. An anchor states exactly where the explanation applies and how reliable it is there, which makes it one of the most readable tools in the Explainable AI toolbox. The approach is also referred to as anchor explanations.

How an anchor rule is defined

An anchor is defined by two quantities computed over a perturbation distribution around the instance being explained. Precision is the probability that the model returns the original prediction for perturbed samples that satisfy the rule. Coverage is the share of samples from the distribution that satisfy the rule at all, which measures how widely the rule applies.

The method searches for a rule whose precision exceeds a user-set threshold, commonly 0.95, and among such rules prefers the one with the highest coverage. Shorter rules usually cover more cases, so the objective naturally rewards concise explanations.

QuantityMeaningTypical setting or range
Precision thresholdRequired probability that the prediction holds0.90 to 0.99, default 0.95
CoverageShare of perturbed samples matching the ruleFrom under 1% to over 50%
Confidence levelStatistical certainty that precision exceeds the thresholdControlled by a delta parameter, often 0.1
Rule lengthNumber of conditions in the anchorUsually 1 to 5 predicates
ToleranceAllowed error in precision estimatesSmall epsilon such as 0.15
Key quantities in an anchor explanation

How the search for anchors works

Finding an anchor is a combinatorial search problem, because the number of possible feature-condition combinations grows quickly. The original algorithm builds rules bottom-up with beam search: it starts from an empty rule, adds one predicate at a time, and keeps the most promising candidates at each step.

Evaluating each candidate requires querying the model on many perturbed samples. To keep this affordable, the method treats candidate selection as a multi-armed bandit problem and uses the KL-LUCB algorithm, which samples more heavily from candidates whose precision is still uncertain. The search stops when a rule passes the threshold with the required statistical confidence.

How perturbations are generated depends on the data type, as the following table shows.

Data typePredicate formPerturbation method
TabularFeature in a discretized binResample unfixed features from training data
TextSpecific word is presentReplace other words with UNK or similar words
ImagesSuperpixel is keptReplace other superpixels with noise or blur
Structured eventsField equals a valueDraw other fields from a reference set
Perturbation strategies by data type

Anchors compared with other local explanations

Anchors differ from feature attribution methods such as LIME and KernelSHAP in the form of the answer: attribution assigns a numeric weight to every feature, while an anchor gives a sufficient condition and ignores everything else. This makes anchors closer to rule-based reasoning that domain experts already use.

MethodOutput formScope statedMain strength
AnchorsIf-then rule with precisionYes, via coverageClear validity boundary
LIMELinear feature weightsNoShows direction of influence
KernelSHAPAdditive Shapley valuesNoTheoretical consistency guarantees
Counterfactual explanationMinimal change that flips outputSingle alternative pointActionable recourse
Anchors versus related local explanation methods

In user studies reported by the original authors, people given anchors predicted model behavior on new instances more accurately and with less effort than people given linear explanations, mainly because they knew when not to apply the explanation. Anchors are complementary to contrastive explanations: an anchor says why the prediction stays, a counterfactual says what would change it.

Practical use and tooling

Anchors fit situations where stakeholders need short, auditable statements about individual decisions, such as credit adverse-action review, claim triage or content moderation appeals. Open-source implementations exist in the original anchor library and in the Alibi Explain package, which supports tabular, text and image data.

  • Discretize numeric features thoughtfully, because bin edges become the conditions a reader will see.
  • Report precision and coverage next to every rule so readers can judge its reliability.
  • Fix the random seed and sample budget when anchors are used for audit records.
  • Aggregate many anchors across instances to sketch a rough global picture of model behavior.

Limitations of anchor explanations

The precision guarantee holds only with respect to the chosen perturbation distribution. If perturbations produce unrealistic samples, a rule can look reliable while saying little about real inputs, a concern related to explanation faithfulness. Results also depend on discretization choices, which can hide thresholds the model actually uses.

ProblemCauseMitigation
Very low coverageInstance lies near a decision boundaryReport it and add a counterfactual
Long, complex rulesMany interacting featuresLower precision slightly or regroup features
Unstable resultsSampling noise in the bandit searchIncrease sample budget and fix seeds
High compute costThousands of model queries per instanceBatch queries and cache predictions
Common problems and mitigations

Anchors also do not reveal how much each condition matters or which features push toward the opposite class, so practitioners often pair them with an attribution method when a full picture is required.

In everyday language

An anchor is a short rule that explains one decision made by an AI model. It says: as long as these few facts are true, the answer stays the same. Other details do not matter much.

Imagine a bank model that approves a loan. The anchor might say that a high income and a clean payment history are enough for approval. It also tells you how often the rule is right and how many people it fits. So you know when you can trust it and when you cannot.

Seen in the real world

An insurance company uses a gradient-boosted classifier to flag motor claims for manual fraud review. Investigators complained that SHAP bar charts were hard to discuss with claimants, so the analytics team added anchor explanations to the review screen, set at a precision threshold of 0.95.

For one flagged claim, the anchor read: if the policy is less than 30 days old and the claimed repair cost is above the 90th percentile for that vehicle model, then the claim is flagged, with precision 0.97 and coverage 4%. The investigator could check both facts in seconds and explain the review to the customer in one sentence.

Over a quarter, the team found that average review preparation time fell noticeably, and that low-coverage anchors reliably pointed to borderline cases that deserved a closer look rather than an automatic decision.