Part XXI — Explainable AI & Model Interpretability · Chapter 12

Anchors: rule-based explanations

Hook

LIME — short for Local Interpretable Model-agnostic Explanations — fits a straight line near one point and hopes it's still roughly right a little further away. What if, instead of hoping, you could state a simple rule and guarantee it holds — as long as you're honest about how much of the input space it actually covers?

Intuition

Toggle between a simple one-condition rule and a stricter two-condition rule. The simple rule covers more of the space, but the prediction it "guarantees" is often wrong. The stricter rule covers less, but never lies.

Formalize

An anchor is a rule AA such that, with precision at least a chosen threshold τ\tau (commonly 0.950.95), every point satisfying AA gets the same prediction as the instance being explained:

precision(A)={x:A(x) holds and f(x)=f(instance)}{x:A(x) holds}τ\text{precision}(A) = \frac{|\{x : A(x) \text{ holds and } f(x) = f(\text{instance})\}|}{|\{x : A(x) \text{ holds}\}|} \geq \tau
  • AA — the anchor: a rule (a conjunction of conditions on the input) being evaluated.
  • precision(A)\text{precision}(A) — the fraction of points satisfying the rule that get the same prediction as the instance being explained.
  • xx — a point in the input space being checked against the rule.
  • instance — the specific input whose prediction is being explained (i.e. f(instance)f(\text{instance})).
  • τ\tau — the minimum precision the anchor must clear, commonly 0.950.95.
coverage(A)={x:A(x) holds}all x\text{coverage}(A) = \frac{|\{x : A(x) \text{ holds}\}|}{|\text{all } x|}
  • coverage(A)\text{coverage}(A) — the fraction of the entire input space that satisfies the rule, regardless of prediction.
  1. Search for the smallest sufficient rule

    Anchors search for the smallest rule that clears the precision bar — not the most precise rule possible, just the smallest one that's precise enough.

  2. Coverage is spent, not sacrificed

    Coverage is traded away for precision only as far as actually necessary, never further — every extra condition that isn't needed to clear τ\tau is left out.

Play
0.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.01.01.00.00.00.00.01.01.01.00.00.00.00.01.01.01.0
Model prediction across the (x1,x2) grid — warm means predicted 1

The model's true positive region is a small corner of the grid, not a whole half-plane. A rule that only checks one condition sweeps in a lot of that corner's neighbors that don't actually belong — only the full conjunction traces the region exactly.

Worked example

Model: predict 11 only when x1>3x_1 > 3 and x2>3x_2 > 3. Instance: (5,5)(5, 5), predicted 11. Grid: x1,x2{0,,6}x_1, x_2 \in \{0,\dots,6\}:

  1. A plausible-looking rule that isn't reliable

    "x1>3x_1 > 3" alone is satisfied by 2121 of the 4949 grid points — but the model only predicts 11 for 99 of them. Precision =9/210.429= 9/21 \approx 0.429: barely better than a coin flip, nowhere near a usable guarantee.

  2. Adding the second condition fixes it completely

    "x1>3x_1 > 3 and x2>3x_2 > 3" is satisfied by exactly 99 points — and the model predicts 11 for all 99 of them, by construction. Precision =1.0= 1.0 exactly.

  3. The cost: less of the space is covered

    Coverage drops from 21/490.42921/49\approx0.429 to 9/490.1849/49\approx0.184. The anchor is smaller and less general, but it's the smallest rule that actually clears a 0.950.95 precision bar — the single condition never could.

Checkpoint

None of these three rules appeared earlier. Find the one that clears the anchor algorithm's 0.95 precision requirement.

Pick a rule to try it
Summary
anchor=argminA: precision(A)τ(coverage(A))\text{anchor} = \arg\min_{A:\ \text{precision}(A)\geq\tau} \big(-\text{coverage}(A)\big)

A linear local explanation always applies "everywhere," it just gets less accurate as you move away from the point — there's no line where it stops being valid. An anchor draws that line explicitly: inside the rule, the prediction is guaranteed (to within the precision threshold); outside it, the anchor makes no claim at all. That honesty about its own boundary is the entire trade this method makes. The capstone that closes this part runs every explainability method built so far against one model, side by side.