Phase B · attribution / XAI

LIME

Ribeiro et al. 2016

← back to the method catalogue

What it does?

LIME explains one prediction by fitting a simple model nearby. Around the input of interest it generates many perturbed versions, records the output for each, and then fits a sparse linear surrogate to that local data. The weights of the surrogate are read as the explanation: which inputs, locally, push the output up or down. The idea is that even a complicated system is roughly linear in a small neighbourhood, so a linear fit there is both faithful and easy to read. LIME is model-agnostic and one of the most cited attribution methods. We apply it to the VCS by perturbing the candidate causes around the live state, re-running the program to get outputs, and fitting a local linear model whose weights we correlate with the true causal map. Because the perturbations are real re-runs, LIME works on a sprite's position where gradients fail. It fits both content and position structure reasonably well, so it lands among the more faithful attribution methods. Its main caveats are the usual ones: the explanation depends on how the neighbourhood is sampled and on the surrogate's fit quality, so it can be unstable across runs. On the VCS we can check its surrogate against the exact answer, which is a test the method never gets on a real network.

LIME result

Top row (image domain, as in Paper 1): the game frame, then the oracle's true causal region and this method's attributed region — each painted onto the frame through the screen footprint of the RAM cells it implicates (brighter = more important). A faithful method's heat matches the oracle's. Bottom: per-cell importance — oracle (green) vs method (blue) — and the deletion/insertion faithfulness curves (perturb the ranked causes and watch the output move). Note: the image-domain overlay footprints are illustrative, computed on the pre-redesign boot frame; the bars, curves and all reported numbers come from the re-run records on the shared gameplay states. pearson_corr_with_oracle = 0.686 — this example only (pong, state f90+15); the audit aggregate is below.

Reading this example's causal region

This example explains the content of RAM $36 (byte 54) — the most causally-active concept byte at this state. Its strongest true-causes are: RAM $36 (the play area — ball / paddles); RAM $31 (17% of its footprint sits in the score band, the rest in the play area). The score digits appear in the region because RAM $31 reaches them: perturbing it over the 30-frame NOOP window changes the game outcome, and hence the score — a downstream effect, not direct rendering.

How it's scored

The score is the Pearson correlation of the local linear surrogate's weights with the oracle's exact causal map, reported raw, and the grading is always against the intervention oracle. LIME fits a sparse linear model to real re-runs of the machine around the live state, so its perturbations are valid interventions and it works on a sprite's position where the gradient family scores zero. That is why there is no position collapse here. It fits both content and position structure reasonably well, so it lands among the more faithful attribution methods. The surrogate also reports its own fit quality, the local R-squared, which acts as an internal check on how linear the neighbourhood really is. The main caveats the score reflects are the usual ones for LIME: the explanation depends on how the neighbourhood is sampled and on the surrogate's fit, so it can vary across runs, and we report that stability alongside the correlation. The grading never compares LIME to another method, only to the oracle. The audit box reports the measured all-regime faithfulness across the 42 scored games, so the number reflects the whole scored set. On the VCS we can test the surrogate against the exact answer, which a real network never allows.

The score is measured against the §1 intervention oracle — never against another interpretability method. F (faithful) is always vs the oracle; see the execution stack. How each of F / S / M is actually computed for this method (and whether it matches the paper) is in the box just below; the numbers are in the In the audit box under it.

How F, S, M are computed here

The exact formula this method uses for each score, read from its runner, and whether it matches the paper's §3 (F ∧ S ∧ M triad) definition. From the committed audit fsm_math_phaseB.json.

AxisFormula (as computed) What it measuresMatches §3?
F
faithfulness
\(F = \rho_{\mathrm{Pearson}}\!\left(\mathrm{attr},\ |\Delta y(u)|\right)\)Raw Pearson correlation between the method's per-cause attribution magnitudes and the oracle's true absolute causal effects |Delta_y(u)|, scored separately for the content and position output regimes.✓ matches lime.jl: pr = pearson(attr, odelta); a stability sweep over K seeds reports corr mean/std but the headline F is the single-run pearson; triad_extra_dict(f.pearson, attr, f.oracle_abs_delta). Record: out/lime_air_raid_content.json (value=0.79). Scorer pilot_ig_vs_oracle.jl pearson() (raw Statistics.cor, zero-variance->0); F = pearson(attr, oracle_abs_delta) where oracle_abs_delta = abs.(cmap.delta) (true |Delta_y| per cause). Also reports spearman, precision@k, deletion/insertion AUC (paper's auxiliary F metrics). Per-regime split: separate *_content.json and *_position.json records, each carrying its own extra.triad.{F,S,M}.
how it's measured — call stack:
  1. per-cause LIME attribution — lime.jl:331
  2. raw Pearson of attribution vs oracle |Δy(u)| — pilot_ig_vs_oracle.jl:173
  3. assemble the F∧S∧M triad record — lime.jl:689
  4. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242
S
sufficiency
\(S = \dfrac{\#\{\,u_{\mathrm{held}}:\ |\hat{y}-y|\le\varepsilon\,\}}{|\mathrm{held\text{-}out}|}\in[0,1]\)Fit Delta_y = a*attr + b on a calibration half of the do(u) causes, predict the disjoint held-out half, and report the fraction of held-out causes whose predicted output lands within an epsilon band of the oracle's bit-exact re-run.✓ matches common/triad_sm.jl sufficiency_score() (interleaved calib/held split by seed, least-squares 1-D fit Delta_y~a*attr+b on calib, epsilon = max(0.5, 0.10*heldout_spread)); assembled in triad_extra_dict(). The new §3 (sec:triad) admits the fraction-within-tolerance [0,1] special case of the held-out predictive test, which this held-out do(u) fit-then-predict estimator satisfies, so it matches. (Detail: epsilon is a self-scaled band 0.10*spread; the [-1,1] correlation form is available but this method reports the [0,1] hit fraction.)
how it's measured — call stack:
  1. sufficiency_score: fit Δy=a·attr+b on a calib half, predict held-out within ε — triad_sm.jl:111
  2. assemble the F∧S∧M triad record (calls sufficiency_score) — triad_sm.jl:173
  3. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242
M
minimality
\(M = |U^{\star}| / |\hat{U}| \in (0,1]\quad U^{\star}=\{u:\Delta y(u)>0\},\ \hat{U}=\{u:|\mathrm{attr}(u)|>\tau\}\)Ratio of the number of oracle causal movers (causes with nonzero true Delta_y) to the number of cells the method names above 1e-6 of its own max attribution; null when the oracle finds no mover or the method names nothing.✓ matches common/triad_sm.jl minimality_score() with name_frac=1e-6, mover_floor=0.0; the above-threshold named set is used (topk kept but not passed), see triad_extra_dict(). This is the paper's M = |U*|/|U_hat| in (0,1] (standardized everywhere), so it matches the new §3. (Detail: |U*| is taken as all oracle movers with Delta_y>0, an upper bound on the strictly-smallest reproducing subset, so M can be optimistic.)
how it's measured — call stack:
  1. minimality_score: |U*| oracle movers / |U_hat| named cells — triad_sm.jl:57
  2. assemble the triad record (calls minimality_score) — triad_sm.jl:178
  3. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242

✓ matches = the same quantity as §3; ◐ partial = the same kind of estimator but a differing detail; ✗ does not match = a different quantity (see the note). Definitions: F = agreement with the oracle's true causal effects Δy(u); S = held-out predictive score in [−1, 1]; M = |U*|/|Û| (true-minimal-set size / named-set size).

In the audit

This is the method's entry in the actual cross-method audit — scored on the paper's correctness triad, each axis a mean over all 42 scored games (84 committed §R records), not the single example shown above. Tradition: gradient. The example figure (Pong) is one of those records.

0.644F — faithfulness vs oracle (mean over 42 games, ±0.065 CI95)
0.655S — sufficiency: held-out predictive (n/a where the paper does not define this axis)
0.557M — minimality: true-minimal-set / named-set (n/a otherwise)
84committed records aggregated
0.00human-plausibility proxy

F faithfulness (scored vs the oracle for every method) · S sufficiency (held-out predictive score in [−1, 1]; a negative value means the explanation predicts held-out interventions worse than the unperturbed baseline; reported for the predictive methods across all three phases where the calibration/held-out split is defined) · M minimality (true-minimal-set / named-set; where the method names a cause set) — n/a otherwise, per the paper's F ∧ S ∧ M triad.

Source: leaderboard.json · the whole leaderboard is on the methods page and the Paper 2 audit.

Results per game

This method's faithfulness on each of the 42 scored games (all-regime F, and the content vs position split). Click a header to sort. Every number is read from site_data.json (methods.lime.per_game).

GameF (all)content-Fposition-FSMNote
Fishing Derby0.9580.9480.9680.9500.722recovers the true causes
Riverraid0.9331.0000.8670.8700.432recovers the true causes
Krull0.9300.9990.8600.8460.190recovers the true causes
Montezuma's Revenge0.9230.9750.8710.8750.400recovers the true causes
Name This Game0.8940.7881.0000.9171.000recovers the true causes
Beam Rider0.8820.7660.9970.8330.700recovers the true causes
Space Invaders0.8781.0000.7560.9170.294recovers the true causes
Bowling0.8730.9040.8430.8810.225recovers the true causes
Boxing0.8440.8170.8700.6670.795holds up on position
Alien0.8430.7790.9070.7140.750holds up on position
Gopher0.8040.7760.8330.9290.762holds up on position
Ice Hockey0.7830.7370.8290.6360.500holds up on position
Air Raid0.7690.7910.7470.5000.769
Phoenix0.7650.9090.6220.4621.000
Pacman0.7500.7760.7250.4441.000
Demon Attack0.7320.7670.6980.8750.350
Private Eye0.7320.7270.7370.9600.229holds up on position
Kung-Fu Master0.7100.7450.6760.8000.806
Frostbite0.7020.5800.8240.5000.395holds up on position
Q*bert0.6930.9990.3870.5001.000
Jamesbond0.6840.7270.6400.8930.288
Freeway0.6680.4580.8790.6000.536holds up on position
Bank Heist0.6630.9000.4270.8330.900
Atlantis0.6400.6320.6480.4500.417holds up on position
Breakout0.6320.7500.5150.5500.806
Pong0.6200.6860.5540.3890.281
Ms. Pac-Man0.5820.8100.3520.4750.816
Pitfall0.5610.4160.7060.8530.344holds up on position
Video Pinball0.5430.7700.3150.5000.500
Road Runner0.5410.1410.9410.4740.167holds up on position
Tennis0.5001.0000.0000.5000.817position gradient vanishes
Kangaroo0.5000.9990.0000.5000.767position gradient vanishes
Double Dunk0.4620.7380.1860.8080.583
Assault0.3960.0920.6990.9050.263holds up on position
Yars' Revenge0.3850.7710.0000.4640.712position gradient vanishes
Centipede0.3790.7570.0000.4500.472position gradient vanishes
Seaquest0.3570.0000.7140.4790.413holds up on position
Berzerk0.3520.6950.0100.4810.260position gradient vanishes
Chopper Command0.3430.0000.6870.4520.400holds up on position
Carnival0.3310.6610.0000.4740.403position gradient vanishes
Hero0.2910.0490.5320.4170.280holds up on position
Venture0.2260.4510.0000.4740.500position gradient vanishes

Call stack — how it runs on jutari / jaxtari

The path from this method's runner (main) into the bit-exact VCS substrate, and the computation it involves. Every step links to the exact source on main. From callstack_phaseB.json.

Applied on the substrate

  1. env reset + per-frame step of the bit-exact VCS (masked re-runs step the horizon) — env_reset! / env_step! jutari
  2. shared gameplay-state testbed — build_shared_testbed jutari

The computation (intervention path)

  1. masked forward: absent cells -> 0 via the oracle's occlude! (RAM->0), step the horizon, read y — masked_read_y -> intervene_ram! jutari intervene_ram! call at lime.jl:145 -> jutari_oracle.jl:174
  2. draw the perturbation design matrix Z (Bernoulli present-mask, anchor row = all-present) and outputs — lime_sample runner
  3. LIME locality kernel pi(z) = exp(-cosine_dist(z,1)^2 / sigma^2) — lime_weights runner
  4. fit the weighted ridge linear surrogate; coefficients are the attributions — fit_weighted_linear runner
  5. snapshot RAM+screen after each masked re-run — snapshot jutari

Scored against the exact intervention oracle Δy(u): run_intervention.

Implementation
tools/xai_study/phaseB_attribution/lime.jl
Reference
Ribeiro et al. 2016
Record
lime_pong_content.json
All records
phaseB_attribution/out

The figure is generated from the committed record by docs/gen_method_figures.py; the game frame and each RAM cell's screen footprint are produced by render_scenes.jl / cell_footprints.jl.