Guided backpropagation is a variant of saliency that changes how the signal flows backward through the network. At each rectifier it keeps only the positive contributions and zeroes the negative ones, on both the forward activation and the backward gradient. The effect is a much sharper, cleaner-looking saliency map, which is why the method became popular for visualising what a network 'sees'. The intuition is that suppressing the negative evidence isolates the features that positively drive the output. We apply the same rectified-backward rule to the VCS and correlate the resulting map with the true causal map. A well-known concern, raised by Adebayo and colleagues, is that guided backprop can act more like an edge detector than a true explanation, producing similar maps even when the model is randomised. We run exactly that sanity check on the machine itself. On smooth content outputs the method partly tracks the true cause. On a sprite's position it hits the gradient wall: the position is a discrete strobe-timed step, so the underlying gradient is zero, and the rectified backward path leaves it at zero here rather than restoring any signal. Combined with its failure of the randomisation check, this makes guided backprop a revealing case: it looks sharp and convincing yet does not depend on what the program actually computes.
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.464 — 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.
Vanilla saliency maps of image classifiers look grainy. Positive and negative gradient signals mix as they flow back through the network. Guided backpropagation changes one rule in the backward pass to clean this up. At every ReLU (rectified linear unit, \(\max(0, z)\), the standard on/off nonlinearity of deep nets) it lets a gradient through only if the unit was active in the forward pass and the gradient arriving from above is positive. Negative signals (“this feature argues against the class”) are thrown away.
The result looks spectacular: crisp, edge-like pictures of the object. That is why the method became popular. But it is no longer the gradient of anything. It is a hand-modified signal. Adebayo et al. (2018) asked a simple question: does the map change if we destroy the model? For guided backprop it barely does. The map behaves more like an edge detector applied to the input than an explanation of the network. This test, the model-randomisation sanity check, is part of our experiment, run on the machine itself.
Take one ReLU unit \(h = \max(0, z)\) and let \(g = \partial y/\partial h\) be the gradient arriving from above. The three backward rules differ only in what they send down to \(z\):
\[ \text{backprop: } \mathbb{1}[z>0]\,g, \qquad \text{deconvnet: } \mathbb{1}[g>0]\,g, \qquad \text{guided: } \mathbb{1}[z>0]\,\mathbb{1}[g>0]\,g . \]Guided backprop combines the two masks. Applied at every ReLU of the network it yields a map \(G(x)\) that, unlike saliency, is not the derivative \(\nabla f(x)\).
Toy example. Two inputs, two hidden ReLUs, one output: \(h_1 = \max(0, 2x_1 + x_2)\), \(h_2 = \max(0, x_1 - x_2 + 1)\), \(y = h_1 - h_2\). At \(x = (1, 1)\): \(h_1 = 3\), \(h_2 = 1\), \(y = 2\). Both units are active. From above, \(\partial y/\partial h = (1, -1)\).
The ranking flipped. \(h_2\) inhibits the output and \(x_2\) acts partly by reducing that inhibition. Guided backprop discards inhibition, so it cannot see this. Check the truth directly: raising \(x_2\) by 0.1 raises \(y\) by 0.2, raising \(x_1\) by 0.1 raises it by only 0.1. Here the vanilla gradient was right and the “cleaner” map was wrong.
| The network \(f\) | The Atari 2600 VCS running the ROM, emulated bit-exactly by jutari; its differentiable twin is JuTari.Diff. |
|---|---|
| The ReLUs | There are none. The soft VCS's nonlinearities are straight-through round/clamp (identity backward), the stop-gradient branch estimator, and the distance-softmax read used only in the relaxation study. So the guided rule is applied once, to the assembled gradient over RAM. |
| The input \(x\) | The 128 RAM bytes at the intervention frame \(f^*\). |
| The output \(y\) | A content output (one RAM byte read one-hot) and a position output (screen pixels changed versus the un-intervened frame, made differentiable by the bilinear sampler). |
| Randomising the weights | Randomising the program: every ROM byte is replaced by a random byte, except the CPU's reset/interrupt vectors so the console still boots. |
| “Is the map right?” | The intervention oracle: poke each cause, re-run the real ROM, measure \(|\Delta y|\). |
Our substrate has no deep stack of ReLUs. The runner says so plainly, and implements guided backprop as the rectification rule \(g \mapsto g\odot\mathbb{1}[g>0]\) applied to the gradient \(\partial y/\partial u\) over the RAM vector \(u\), followed by an absolute value. It returns the guided map and the vanilla \(|\partial y/\partial u|\), so the effect of the rule can be measured directly.
soft_ram_peek(ram, idx), whose gradient is the one-hot
vector \(e_{\text{idx}}\). It has no negative entries, so there is nothing to suppress: the guided
map equals vanilla saliency exactly. The runner records this as guided_equals_vanilla.
The byte idx is the candidate the oracle shows to be most causally active, the same
choice as the SmoothGrad runner, so only the backward rule differs.guided_demo_rectifies applies it
to a small linear surrogate with mixed-sign weights and asserts that every negative entry is
zeroed.randomize_rom fills the cartridge with random bytes but keeps the
last 6 bytes of each 4 KB bank (the 6502 reset/IRQ/NMI vectors). Three randomised programs are
booted and replayed to \(f^*\). The runner counts how many RAM bytes differ from the real game,
recomputes the guided map, and measures its cosine similarity to the real map. The scrambled programs
reach very different RAM states. Yet the content map is identical, because the one-hot Jacobian
does not depend on what the program computed. The runner classifies this as a genuine failure
(“model-invariant saliency, constant Jacobian”), not as a harness error.XAI the interpretability method substrate the bit-exact emulator it runs on (jutari, Julia).
guided_backprop.jl:336 — The guided rule: keep positive gradient entries, zero the negative ones.guided_backprop.jl:347 — One Zygote gradient over RAM, then the rule; returns guided and vanilla maps side by side.guided_backprop.jl:368 — Proof the rule is wired: a mixed-sign surrogate whose negative gradients must be suppressed.guided_backprop.jl:443 — Model randomisation for the VCS: random ROM bytes, CPU vectors preserved.guided_backprop.jl:479 — The Adebayo sanity check: cosine/Spearman of the map under program randomisation, with a failure-mode diagnosis.guided_backprop.jl:564 — One output: oracle → guided map → scores → deletion/insertion → control → sanity check.SoftStep.jl:106 — The one-hot RAM read: a linear unit with a non-negative gradient, so the guided rule has nothing to remove.StraightThrough.jl:28 — The straight-through round: one of the soft VCS's actual nonlinearities (exact forward, identity backward). Not a ReLU.shared_testbed_impl.jl:357 — The bilinear sampler; its triangular kernel has slopes of both signs.oracle_intervene.jl:242 — The ground truth: poke a cause, re-run the real ROM, read the output.On the content output the guided bars are the vanilla saliency bars, exactly. Any agreement with the oracle is saliency's agreement. On the position output the map is often empty, either because the naive gradient is zero or because the rule removed a negative sampler slope. Then look at the sanity-check box. A cosine similarity near 1 between the real and the scrambled-program maps means the map does not depend on the program. A faithful map must change when the model is destroyed; this one stays the same. The oracle, by contrast, re-runs the program and would see the difference at once.
julia --project=jutari tools/xai_study/phaseB_attribution/guided_backprop.jl --games core --sanity
Writes guided_backprop_<game>_{content,ball_pixel}.json/.npz and guided_backprop_core_summary.json into tools/xai_study/phaseB_attribution/out/. The sanity check boots three randomised ROMs per output; pass --no-sanity for a faster smoke run.
Read next: Vanilla gradient (saliency) · SmoothGrad · Grad×Input / DeepLIFT · Occlusion
The score is the Pearson correlation of the guided-backprop map with the oracle's exact causal map, reported raw, and the grading is always against the intervention oracle. On smooth content outputs the rectified backward pass partly tracks the true cause. The hard case is a sprite's position: it is a discrete strobe-timed step, so the naive gradient is provably zero, and here the method's rectified path leaves it at zero rather than restoring any signal. On top of that, guided backprop fails the Adebayo program-randomisation sanity check on the machine itself. We scramble the ROM so the program boots to a completely different state, and the content-path map stays essentially unchanged, because its Jacobian is a constant one-hot pointing at the read index, independent of what the program computes. A faithful explanation must change when the model changes; this one does not. So even where it looks sharp, it is model-invariant, which the intervention oracle exposes at once by distinguishing the two programs. Between the zero position gradient and the failed sanity check, its cross-game faithfulness stays low. The audit box reports the measured all-regime faithfulness across the scored games.
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 guided_backprop.jl: attr = guided-backprop per cause, F = pearson(attr, oracle_abs_delta); triad_extra_dict(f.pearson, attr, f.oracle_abs_delta). Record: out/guided_backprop_air_raid_content.json (metric_name=pearson_corr_with_oracle, 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:
|
| 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: gradient. 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.guided_backprop.per_game).
| Game | F (all) | content-F | position-F | S | M | Note |
|---|---|---|---|---|---|---|
| Enduro | 0.500 | 1.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Space Invaders | 0.500 | 1.000 | 0.000 | 0.556 | 1.000 | position gradient vanishes |
| Tennis | 0.500 | 1.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Montezuma's Revenge | 0.500 | 1.000 | 0.000 | 0.938 | 1.000 | position gradient vanishes |
| Riverraid | 0.500 | 1.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Kangaroo | 0.500 | 0.999 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Krull | 0.500 | 1.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Q*bert | 0.500 | 0.999 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Demon Attack | 0.477 | 0.955 | 0.000 | 0.875 | 1.000 | position gradient vanishes |
| Fishing Derby | 0.474 | 0.948 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Phoenix | 0.455 | 0.909 | 0.000 | 0.577 | 1.000 | position gradient vanishes |
| Bank Heist | 0.450 | 0.900 | 0.000 | 0.833 | 1.000 | position gradient vanishes |
| Boxing | 0.408 | 0.817 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Ms. Pac-Man | 0.405 | 0.810 | 0.000 | 0.475 | 1.000 | position gradient vanishes |
| Skiing | 0.405 | 0.810 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Double Dunk | 0.399 | 0.797 | 0.000 | 0.538 | 1.000 | position gradient vanishes |
| Name This Game | 0.394 | 0.788 | 0.000 | 0.417 | 1.000 | position gradient vanishes |
| Alien | 0.390 | 0.779 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Pacman | 0.388 | 0.776 | 0.000 | 0.556 | 1.000 | position gradient vanishes |
| Gopher | 0.388 | 0.776 | 0.000 | 0.929 | 1.000 | position gradient vanishes |
| Atlantis | 0.386 | 0.773 | 0.000 | 0.400 | 1.000 | position gradient vanishes |
| Yars' Revenge | 0.385 | 0.771 | 0.000 | 0.464 | 1.000 | position gradient vanishes |
| Video Pinball | 0.385 | 0.770 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Ice Hockey | 0.384 | 0.767 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Private Eye | 0.379 | 0.758 | 0.000 | 0.960 | 1.000 | position gradient vanishes |
| Breakout | 0.375 | 0.750 | 0.000 | 0.550 | 1.000 | position gradient vanishes |
| Jamesbond | 0.374 | 0.747 | 0.000 | 0.893 | 1.000 | position gradient vanishes |
| Freeway | 0.373 | 0.747 | 0.000 | 0.567 | 1.000 | position gradient vanishes |
| Kung-Fu Master | 0.372 | 0.745 | 0.000 | 0.800 | 1.000 | position gradient vanishes |
| Venture | 0.372 | 0.743 | 0.000 | 0.474 | 1.000 | position gradient vanishes |
| Bowling | 0.344 | 0.688 | 0.000 | 0.881 | 1.000 | position gradient vanishes |
| Frostbite | 0.242 | 0.484 | 0.000 | 0.150 | 1.000 | position gradient vanishes |
| Pong | 0.232 | 0.464 | 0.000 | 0.389 | 1.000 | position gradient vanishes |
| Air Raid | 0.180 | 0.360 | 0.000 | 0.036 | 1.000 | position gradient vanishes |
| Berzerk | 0.048 | 0.096 | 0.000 | 0.481 | 1.000 | position gradient vanishes |
| Seaquest | 0.009 | 0.017 | 0.000 | 0.479 | 1.000 | position gradient vanishes |
| Assault | 0.000 | 0.000 | 0.000 | 0.905 | 1.000 | position gradient vanishes |
| Asterix | 0.000 | 0.000 | 0.000 | 0.150 | 1.000 | position gradient vanishes |
| Carnival | 0.000 | 0.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Centipede | 0.000 | 0.000 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Chopper Command | 0.000 | 0.000 | 0.000 | 0.476 | 0.500 | position gradient vanishes |
| Hero | 0.000 | 0.000 | 0.000 | 0.444 | 0.500 | position gradient vanishes |
| Pitfall | 0.000 | 0.000 | 0.000 | 0.882 | 1.000 | position gradient vanishes |
| Road Runner | 0.000 | 0.000 | 0.000 | 0.105 | 0.500 | position gradient vanishes |
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 jutaricontent_read -> soft_ram_peek jutari-diff call site tools/xai_study/phaseB_attribution/guided_backprop.jl:320guided_backprop_over_ram runnerZygote.gradient(readf, x) Zygote_st_sampler_position_read runner-diffScored against the exact intervention oracle Δy(u): run_intervention.
On jaxtari (JAX / GPU): the same differentiable path has a bit-exact JAX sibling (Theorem 1, forward-exact) for batched GPU runs — JAX-equivalent differentiable path (bit-exact per Theorem 1, for GPU batching): jaxtari/jaxtari/diff/soft_step.py, soft_mem.py, straight_through.py
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.