Fong & Vedaldi 2017; Fong et al. 2019
Extremal, or meaningful, perturbation learns the smallest mask that most changes the output. Rather than sliding a fixed occluder, it optimises a soft mask over the inputs, searching for the smallest region whose removal most disrupts the output, subject to a bound on the mask's area. The learned mask is read as the explanation: the compact set of inputs the output really depends on. For images this yields a tight, optimised heat-map instead of a brute-force sweep. The method was designed to answer a specific criticism, that hand-placed occluders are arbitrary and can push the input off the data manifold. By optimising a bounded, smooth mask of real occlusion re-runs, it stays closer to valid interventions. We apply it to the VCS by optimising an area-limited mask over the candidate causes, each mask entry a genuine occlude-and-re-run, and comparing the learned mask to the true minimal cause set. Because every step is a real intervention, it works on a sprite's position where gradients fail, and it partly overlaps the true causes. Its faithfulness is moderate: the optimisation finds a compact set that is on the right track but does not exactly match the oracle's minimal set. It is a strong, on-manifold member of the intervention family and a fair test of whether optimising the mask beats simply sliding one.
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.469 — this example only (pong, state f90+15); the audit aggregate is below.
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.
New to explainable AI? This block explains the method as it is used on neural networks, then how we run the very same method on an Atari 2600, where — unlike for a network — we know the right answer. Every implementation step links to the code. See also the XAI primer for the shared vocabulary.
Occlusion slides a fixed grey square and reports a number for every position. That raises two questions. Why a square? Why that size? Extremal perturbation turns the question around. It asks: what is the smallest region I must remove to destroy the prediction? The answer is a mask, a map that says for each input whether it is removed. The mask is found by optimisation, not by sliding.
The mask is the explanation. A good mask is small (it points at few inputs) and extremal (removing those inputs changes the output as much as possible). Fong and Vedaldi called the 2017 version “meaningful perturbation”, because the removal should look like a plausible change (a blur, not a random noise pattern). The 2019 version fixes the mask area in advance, say 10 % of the image, and finds the best mask of exactly that size. This removes a hard-to-tune penalty weight. It is still a black-box method: it only needs to run the model on masked inputs.
Let \(m \in [0,1]^n\) be a soft mask (\(m_i = 1\): input \(i\) removed, \(0\): kept) and \(\Phi(x; m)\) the perturbed input, e.g. \(x\) blended with a blurred copy where \(m\) is high. The 2017 “deletion game” solves
\[ m^\star = \arg\min_{m}\; \lambda\,\|m\|_1 \;+\; f\big(\Phi(x; m)\big) , \]trading mask size (the \(\ell_1\) regulariser \(\|m\|_1\), weighted by \(\lambda\)) against how low the class score goes. The 2019 “extremal” version replaces the penalty by a hard area constraint \(\|m\|_1 = a\cdot n\). Both are solved by gradient descent on \(m\), with smoothness tricks so the mask does not become a noisy pattern that fools the network (an adversarial mask).
Toy example. \(f(x) = 4x_1x_2 + x_3\) at \(x = (1,1,1,1)\) (\(x_4\) unused), removal sets an input to 0, and the budget is 2 inputs. Removing one input at a time changes \(f\) by 4, 4, 1, 0. A greedy search takes \(x_1\) first (change 4). Next it tries each remaining input together with \(x_1\): adding \(x_2\) still gives 4 (the product is already dead), adding \(x_3\) gives 5. So the mask is \(\{x_1, x_3\}\), which destroys the whole output with two inputs. Note what happened to \(x_2\): it is just as important as \(x_1\), but once \(x_1\) is removed it adds nothing, so it is not in the mask. A minimal mask names a sufficient set, not all important inputs.
| The network \(f\) | The cartridge program on the bit-exact emulated Atari 2600 VCS (jutari). |
|---|---|
| The mask \(m\) over pixels | A set of candidate causes (RAM bytes, one TIA colour register, the joystick) to remove together. |
| The perturbation \(\Phi(x;m)\) | occlude! every cause in the set (RAM/TIA → 0) on a deepcopy of the checkpoint, then run 15 frames of the real ROM. |
| Gradient descent on a soft mask | Greedy forward selection on a hard mask: the VCS output is discrete, so a mask gradient would be zero. |
| Area constraint \(a\) | At most \(\lceil 0.25\cdot C\rceil\) of the \(C\) causes may be selected (--area 0.25). |
| “Is this mask right?” | IoU of the mask with the oracle's top-\(k\) true movers, plus the same correlation and deletion/insertion scores as every other method. |
Why greedy, not gradients. The original optimises a soft mask by gradient descent. On the VCS that would fail for the same reason saliency fails on the position output: the machine is a discrete index computer and \(\partial y/\partial m = 0\) almost everywhere. So the runner optimises the mask directly on the real emulator with greedy forward selection, the discrete, budget-bounded cousin of the original optimiser.
masked_abs_dy removes just that
cause and re-runs: \(|y(\text{occlude}\{i\}) - y(\text{intact})|\). This pass is literally occlusion.deepcopy the checkpoint, occlude! all of \(M\cup\{i\}\), run 15
env_step! frames, read \(y\). Add the cause with the largest change.How is this different from the oracle? The oracle probes each cause alone, with two
directions (+17 and →0). Extremal perturbation probes sets of causes, and only in the
“remove” direction. It can therefore see joint effects the oracle's per-cause map does not
contain. But it deliberately reports a minimal set, so a cause that is redundant given the
mask (like \(x_2\) in the toy) is left out, even if the oracle ranks it high. For the IoU, causes are
reduced to the cell they actually touch, because ram[i]:set and
ram[i]:occlude both zero the same byte when masked.
Cost. At most \(\lceil aC\rceil\cdot C\) greedy re-runs plus \(C\) single-cause re-runs and one intact run; every one is a full 15-frame run of the real ROM from the checkpoint.
XAI the interpretability method substrate the bit-exact emulator it runs on (jutari, Julia).
perturbation.jl:206 — The optimiser: single-cause pass, then greedy forward selection under the area budget, with the no-gain stop rule.perturbation.jl:179 — Value of one mask: deepcopy, occlude! every masked cause, run the horizon, |Δy|.perturbation.jl:257 — Maps the mask onto the per-cause axis (selected causes lifted above all others).perturbation.jl:327 — The headline score: IoU of the mask with the oracle's top-k true movers, on the touched-cell axis.perturbation.jl:359 — The area budget \(\lceil a\cdot C\rceil\); area = 0.25 by default.ig_baseline_sweep.jl:224 — The removal operator shared with occlusion, RISE, LIME and KernelSHAP.jutari_oracle.jl:176 — The poke into the emulated RAM that every mask entry performs.StellaEnvironment.jl:259 — One frame of the real machine; each mask evaluation runs 15 of them.oracle_intervene.jl:242 — The oracle's single-cause re-run, the ground truth the mask is compared with.shared_testbed_impl.jl:115 — The shared gameplay checkpoint and the position output.The figure shows the per-cause scores next to the oracle, and the record lists the selected mask. The selected causes sit on top because of the lift. Check two things. First, are the mask's causes among the oracle's tallest bars? That is what the IoU measures. Second, are there tall oracle bars outside the mask? Usually there are: the mask is a small sufficient set, not the full list of important causes, so expect a partial overlap rather than a perfect match. The method works on the position output too, since it never uses a gradient.
julia --project=jutari tools/xai_study/phaseB_attribution/perturbation.jl --games core
Writes perturbation_<game>_{content,position}.json/.npz into tools/xai_study/phaseB_attribution/out/, including the mask, its growth curve and the IoU. Change the budget with --area 0.1.
Read next: Occlusion · On-distribution counterfactual · RISE · KernelSHAP / Shapley
The score is the Pearson correlation of the learned mask with the oracle's exact causal map, together with the mask's overlap, measured as intersection-over-union, against the true minimal cause set. The grading is always against the intervention oracle. Every entry of the mask is a real occlude-and-re-run, so the method is a valid intervention and works even on a sprite's position, where the gradient family scores zero. That is why there is no position-collapse here. Its faithfulness is moderate rather than high: the area-bounded optimisation finds a compact set that partly overlaps the true causes but does not exactly match the oracle's minimal set, so both the correlation and the mask overlap are partial. Minimality is central to this method, because it explicitly seeks the smallest disruptive mask, so the score rewards a mask that is both on-target and small. The grading never compares the mask to another method's mask, only to the oracle's minimal set. The audit box reports the measured all-regime faithfulness across the 44 scored games, so the number reflects the whole scored set rather than the single game where the optimised mask happens to line up best with the true causes.
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.
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.
| Axis | Formula (as computed) | What it measures | Matches §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 perturbation.jl: extremal-perturbation mask per cause, F = pearson(attr, oracle_abs_delta); triad_extra_dict(f.pearson, attr, f.oracle_abs_delta). Record: out/perturbation_air_raid_content.json (metric_name=pearson_corr_with_oracle, value=0.55). 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:
|
| 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:
|
| 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:
|
✓ 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).
This is the method's entry in the actual cross-method audit — scored on the paper's correctness triad, each axis a mean over 44 of the 44 scored games (88 committed §R records), not the single example shown above. Tradition: intervention. The example figure (Pong) is one of those records.
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.
This method's faithfulness on each of the 44 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.perturbation.per_game).
| Game | F (all) | content-F | position-F | S | M | Note |
|---|---|---|---|---|---|---|
| Enduro | 0.921 | 0.933 | 0.910 | 0.625 | 1.000 | recovers the true causes |
| Fishing Derby | 0.812 | 0.788 | 0.836 | 0.850 | 1.000 | holds up on position |
| Phoenix | 0.782 | 0.996 | 0.569 | 0.538 | 1.000 | |
| Demon Attack | 0.707 | 0.961 | 0.454 | 0.875 | 0.875 | |
| Montezuma's Revenge | 0.701 | 0.935 | 0.468 | 0.906 | 1.000 | |
| Krull | 0.695 | 0.936 | 0.455 | 0.500 | 1.000 | |
| Riverraid | 0.647 | 0.937 | 0.358 | 0.870 | 1.000 | |
| Bowling | 0.637 | 0.760 | 0.513 | 0.881 | 1.000 | |
| Name This Game | 0.629 | 0.528 | 0.729 | 0.667 | 1.000 | holds up on position |
| Pacman | 0.614 | 0.522 | 0.705 | 0.556 | 1.000 | holds up on position |
| Boxing | 0.595 | 0.582 | 0.609 | 0.750 | 1.000 | holds up on position |
| Alien | 0.581 | 0.521 | 0.641 | 0.714 | 1.000 | holds up on position |
| Air Raid | 0.578 | 0.441 | 0.714 | 0.786 | 0.917 | holds up on position |
| Space Invaders | 0.557 | 0.679 | 0.435 | 0.917 | 0.833 | |
| Q*bert | 0.554 | 0.935 | 0.173 | 0.476 | 1.000 | |
| Freeway | 0.519 | 0.489 | 0.550 | 0.500 | 1.000 | holds up on position |
| Frostbite | 0.493 | 0.560 | 0.425 | 0.125 | 1.000 | |
| Ice Hockey | 0.480 | 0.512 | 0.447 | 0.455 | 0.875 | |
| Carnival | 0.472 | 0.945 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Tennis | 0.470 | 0.940 | 0.000 | 0.469 | 1.000 | position gradient vanishes |
| Kangaroo | 0.467 | 0.934 | 0.000 | 0.469 | 1.000 | position gradient vanishes |
| Bank Heist | 0.467 | 0.696 | 0.237 | 0.833 | 1.000 | |
| Gopher | 0.465 | 0.531 | 0.400 | 0.929 | 1.000 | |
| Ms. Pac-Man | 0.452 | 0.577 | 0.326 | 0.475 | 1.000 | |
| Pong | 0.402 | 0.469 | 0.335 | 0.389 | 0.875 | |
| Jamesbond | 0.402 | 0.489 | 0.314 | 0.893 | 0.964 | |
| Double Dunk | 0.396 | 0.555 | 0.237 | 0.538 | 1.000 | |
| Atlantis | 0.393 | 0.527 | 0.260 | 0.400 | 0.875 | |
| Private Eye | 0.347 | 0.507 | 0.188 | 0.960 | 1.000 | |
| Skiing | 0.340 | 0.571 | 0.110 | 0.450 | 1.000 | |
| Kung-Fu Master | 0.336 | 0.482 | 0.190 | 0.800 | 0.958 | |
| Pitfall | 0.326 | 0.479 | 0.173 | 0.882 | 0.875 | |
| Road Runner | 0.320 | 0.000 | 0.641 | 0.447 | 1.000 | holds up on position |
| Centipede | 0.314 | 0.628 | 0.000 | 0.450 | 0.875 | position gradient vanishes |
| Assault | 0.311 | 0.441 | 0.181 | 0.905 | 0.917 | |
| Breakout | 0.299 | 0.488 | 0.109 | 0.550 | 1.000 | |
| Video Pinball | 0.276 | 0.352 | 0.199 | 0.500 | 1.000 | |
| Yars' Revenge | 0.260 | 0.520 | 0.000 | 0.464 | 1.000 | position gradient vanishes |
| Chopper Command | 0.252 | 0.000 | 0.503 | 0.452 | 1.000 | holds up on position |
| Asterix | 0.251 | 0.233 | 0.269 | 0.150 | 1.000 | |
| Venture | 0.243 | 0.486 | 0.000 | 0.474 | 1.000 | position gradient vanishes |
| Berzerk | 0.214 | 0.428 | 0.000 | 0.481 | 0.833 | position gradient vanishes |
| Seaquest | 0.145 | 0.000 | 0.289 | 0.479 | 1.000 | |
| Hero | 0.044 | 0.000 | 0.087 | 0.417 | 1.000 | no true-cause signal |
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.
env_reset! / env_step! jutaribuild_shared_testbed jutarimasked_abs_dy runnerocclude! -> intervene_ram! / intervene_tia! jutari intervene_ram! jutari_oracle.jl:174, intervene_tia! jutari_oracle.jl:185extremal_mask runnersnapshot jutariScored against the exact intervention oracle Δy(u): run_intervention.
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.