Shrikumar et al. 2017
Grad times Input, in the DeepLIFT family, sharpens plain saliency by multiplying the gradient at each input by the input's own value. The product answers a slightly different question than the bare gradient: not just how sensitive the output is to an input, but how much that input, at its actual value, contributes to the output. DeepLIFT frames this as a difference from a reference, and the multiplication gives the method a completeness-like property, so the attributions sum to the change in the output. For images this tends to produce cleaner, less diffuse maps than raw saliency. We apply it to the VCS by multiplying each cause's gradient by its recorded value and correlating the result with the true causal map. On outputs that flow smoothly into the picture, the input factor concentrates the attribution onto the genuine causal byte and improves on plain saliency. On a sprite's position it inherits the same wall as every gradient method: the position is a discrete step set by strobe timing, so the underlying gradient is zero and multiplying by the input cannot create signal where there is none. The method is popular because it keeps the speed of a gradient while adding a contribution interpretation, so it is a fair, stronger member of the gradient family to test.
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. deeplift_pearson_corr_with_oracle = 0.822 — this example only (pong, state f90+15); the audit aggregate is below.
This example explains the score (score@RAM $31). Its strongest true-cause is: RAM $31 (17% of its footprint sits in the score band, the rest in the play area). Because it explains the score, its only true-cause is RAM $31, so the region covers the score and the ball but not the paddle: the paddle cell (RAM $36) is not causal for the score, so it is legitimately absent.
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 answers one question: how sensitive is the output to each input? That is useful, but it ignores how big the input actually is. A pixel can be very sensitive and still be black (value 0). Then it contributes nothing to the score right now. Gradient×Input fixes this by multiplying the two: the attribution of input \(i\) is its gradient times its own value. The result reads as “how much of the output this input is responsible for, at the value it has”.
DeepLIFT (Deep Learning Important FeaTures) generalises the idea. It picks a reference (or baseline) input that means “nothing there”, for example an all-black image. It then splits the difference between the output at the real input and the output at the reference among the inputs. The pieces add up exactly to that difference. This property is called completeness (DeepLIFT calls it “summation-to-delta”). With an all-zero reference and a linear model, DeepLIFT and Grad×Input give the same numbers. That is the setting we use on the Atari.
As in vanilla saliency, write the network as \(y = f(x)\). Grad×Input and DeepLIFT (rescale rule) assign input \(i\)
\[ A^{\text{G}\times\text{I}}_i = x_i\,\frac{\partial f}{\partial x_i}(x), \qquad A^{\text{DL}}_i = (x_i - x^0_i)\; m_i ,\]where \(x^0\) is the reference and \(m_i\) is a multiplier. For a linear unit \(m_i = \partial f/\partial x_i\). Through a nonlinearity such as a ReLU, the rescale rule uses the finite slope \(m = \Delta \text{out}/\Delta \text{in}\) between reference and input instead of the infinitesimal one. The product of input and gradient is the first-order Taylor term \(\nabla f(x)\cdot x\): for a linear function with zero bias it is exactly \(f(x) - f(0)\).
Toy example 1 (linear). Let \(f(x) = 2x_1 - x_2 + 0.5x_3\) at \(x = (4, 1, 0)\). The gradient is \((2, -1, 0.5)\). Saliency says \(x_1\) matters most, then \(x_2\), then \(x_3\). Grad×Input gives \((8, -1, 0)\): \(x_3\) gets zero, because it is switched off. The sum is \(8 - 1 + 0 = 7 = f(x) - f(0)\). Completeness holds.
Toy example 2 (nonlinear). Let \(f(x) = x^2\) at \(x = 3\), reference \(x^0 = 0\). The gradient is 6, so Grad×Input says 18. But the output only changed by \(f(3) - f(0) = 9\). DeepLIFT's rescale multiplier is \((9 - 0)/(3 - 0) = 3\), giving \(3 \cdot 3 = 9\): complete. So Grad×Input is complete only for linear pieces; DeepLIFT repairs this by using finite differences.
| The network \(f\) | The Atari 2600 VCS running the game ROM, emulated bit-exactly by jutari; its differentiable twin is the SOFT path JuTari.Diff. |
|---|---|
| The input \(x\) | The 128 RAM bytes at the intervention frame \(f^*\) (after 90 frames of seeded random play), as floats 0–255. |
| The reference \(x^0\) | The all-zeros RAM vector, the “absent” state. With this reference DeepLIFT and Grad×Input coincide byte for byte. |
| The output \(y\) | A content output (one RAM byte read one-hot) and a position output (screen pixels changed versus the un-intervened frame 15 frames later, made differentiable by the bilinear sampler). |
| “Is the attribution right?” | The intervention oracle: poke each cause, re-run the real ROM, measure \(|\Delta y|\). |
The runner computes three maps from one gradient: Grad×Input \(u \odot \partial y/\partial u\), DeepLIFT \((u - 0)\odot \partial y/\partial u\), and vanilla saliency \(|\partial y/\partial u|\) as the contrast. Here \(u\) is the RAM vector. Because the reference is all zeros, the first two are identical. The record's headline number is the DeepLIFT correlation with the oracle.
soft_ram_peek(ram, s), a one-hot dot product. Its
gradient is the one-hot vector \(e_s\), so Grad×Input is a single spike of height
\(u_s\) at byte \(s\). Completeness is exact: \(\sum_i A_i = u_s = y(x) - y(0)\). The runner
checks this numerically. Note what the input factor can and cannot do here: it only rescales
the one spike saliency already had. The ranking of causes is unchanged, unless \(u_s = 0\).
Then the attribution vanishes entirely.select_content_cell refuses a zero
byte. It also tests each candidate on the real VCS: poke it to value+17, run 15 frames, and keep
only bytes whose own change survives to the readout. Otherwise the game could overwrite the poke
within the horizon and leave an all-zero oracle map. A score byte is preferred when it qualifies.e2e_gradient.jl also multiplies its through-the-machine
gradient (see vanilla saliency) by the RAM at \(f^*\). It reads the
content byte the saliency runner uses and has no non-zero guard. So the failure mode above shows up
for real. In Seaquest that byte holds 0 at \(f^*\), and the e2e Grad×Input score is exactly 0,
while the e2e saliency on the same gradient scores 0.017. The same happens for Q*bert's position
output.XAI the interpretability method substrate the bit-exact emulator it runs on (jutari, Julia).
gradxinput.jl:303 — The method: Grad×Input x .* g, DeepLIFT (x .- x0) .* g, saliency abs.(g).gradxinput.jl:272 — One Zygote backward pass through the one-hot content read gives \(\partial y/\partial u\).gradxinput.jl:316 — Completeness check: \(|\sum A - (y(x) - y(x^0))|\), asserted to be ~0.gradxinput.jl:237 — Picks a non-zero, causally persistent content byte (tested on the real VCS) so the input factor cannot trivially zero it.gradxinput.jl:643 — Position output: the gradient is taken through the bilinear sampler instead of the (zero) naive read.gradxinput.jl:594 — One game: shared testbed → oracle map → three attribution maps → scores → positive control.SoftStep.jl:106 — The forward-exact one-hot RAM read; its gradient is the one-hot vector \(e_s\).shared_testbed_impl.jl:357 — The bilinear sampler: a sprite whose column is a continuous function of one RAM byte.oracle_intervene.jl:242 — The ground truth: poke a cause, re-run the ROM 15 frames, read the output.StellaEnvironment.jl:259 — One frame of the bit-exact machine, used by the oracle and the deletion/insertion curves.Compare the Grad×Input bars with the vanilla saliency page. On the content output both show one spike at the same byte; Grad×Input's spike is just taller or shorter, scaled by the byte's value. So its agreement with the oracle tracks saliency closely. A one-byte map can only partly match an oracle that lights up several causes over 15 frames. On the position output, expect much weaker agreement: the sampler restores a gradient, but it points at one byte, and that byte is not always the one the oracle ranks first. Completeness holds exactly on content, yet it does not make the map more faithful. Summing to the right total says nothing about whether the total is split among the right causes.
julia --project=jutari tools/xai_study/phaseB_attribution/gradxinput.jl --games core
Writes gradxinput_deeplift_<game>_{content,position}.json/.npz and a per-output summary into tools/xai_study/phaseB_attribution/out/. Each game re-runs the real ROM once per cause for the oracle and twice per cause for the deletion/insertion curves, so expect minutes per game on one CPU core.
Read next: Vanilla gradient (saliency) · Integrated Gradients · Expected Gradients · SmoothGrad
The score is the Pearson correlation of the Grad-times-Input, DeepLIFT-style attribution with the oracle's exact causal map, reported raw. Faithfulness for this method is that correlation, and the grading is always against the intervention oracle rather than another method. Multiplying the gradient by the input concentrates the attribution onto the genuine causal byte, so on smooth content outputs it improves on plain saliency and scores well. The hard case is the same as for the whole gradient family. A sprite's position is a discrete step set by strobe timing, so the naive gradient there is provably zero, and multiplying a zero gradient by the input is still zero. The audit turns on the differentiable sampler to give the method a fair chance on position, but the restored gradient is faithful on only a minority of games, so the position score stays low while the content score stays high. The completeness property, that attributions sum to the output change, does not rescue the position regime. The audit box reports the all-regime faithfulness, which averages the strong content result and the weak position result across the 44 scored games, so the single number sits between the two.
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 gradxinput.jl: pr = pearson(attr, cmap.abs_delta); metric_name=deeplift_pearson_corr_with_oracle. Record: out/gradxinput_deeplift_air_raid_content.json (value=0.90). 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.gradxinput.per_game).
| Game | F (all) | content-F | position-F | S | M | Note |
|---|---|---|---|---|---|---|
| Krull | 0.804 | 1.000 | 0.608 | 0.538 | 1.000 | |
| Seaquest | 0.762 | 0.813 | 0.710 | 0.958 | 1.000 | |
| Gopher | 0.761 | 0.776 | 0.746 | 0.929 | 1.000 | |
| Pacman | 0.642 | 0.803 | 0.481 | 0.611 | 1.000 | |
| Bowling | 0.628 | 0.908 | 0.348 | 0.905 | 1.000 | |
| Ice Hockey | 0.576 | 0.964 | 0.188 | 0.545 | 1.000 | |
| Pong | 0.550 | 0.822 | 0.278 | 0.500 | 1.000 | |
| Video Pinball | 0.542 | 0.923 | 0.160 | 0.500 | 1.000 | |
| Centipede | 0.500 | 1.000 | 0.000 | 0.550 | 1.000 | position gradient vanishes |
| Enduro | 0.500 | 1.000 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Space Invaders | 0.500 | 1.000 | 0.000 | 0.528 | 1.000 | position gradient vanishes |
| Tennis | 0.500 | 1.000 | 0.000 | 0.531 | 1.000 | position gradient vanishes |
| Kangaroo | 0.500 | 0.999 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Q*bert | 0.500 | 0.999 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Chopper Command | 0.499 | 0.998 | 0.000 | 0.952 | 1.000 | position gradient vanishes |
| Pitfall | 0.498 | 0.997 | 0.000 | 0.912 | 1.000 | position gradient vanishes |
| Road Runner | 0.491 | 0.982 | 0.000 | 0.526 | 1.000 | position gradient vanishes |
| Boxing | 0.487 | 0.817 | 0.156 | 0.542 | 1.000 | |
| Private Eye | 0.487 | 0.970 | 0.003 | 0.960 | 1.000 | position gradient vanishes |
| Demon Attack | 0.477 | 0.955 | 0.000 | 0.875 | 1.000 | position gradient vanishes |
| Skiing | 0.476 | 0.952 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Assault | 0.475 | 0.950 | 0.000 | 0.952 | 1.000 | position gradient vanishes |
| Hero | 0.474 | 0.947 | 0.000 | 0.889 | 1.000 | position gradient vanishes |
| Carnival | 0.469 | 0.938 | 0.000 | 0.526 | 1.000 | position gradient vanishes |
| Bank Heist | 0.455 | 0.911 | 0.000 | 0.833 | 1.000 | position gradient vanishes |
| Phoenix | 0.455 | 0.909 | 0.000 | 0.577 | 1.000 | position gradient vanishes |
| Jamesbond | 0.447 | 0.865 | 0.028 | 0.893 | 1.000 | |
| Alien | 0.430 | 0.860 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Yars' Revenge | 0.422 | 0.845 | 0.000 | 0.464 | 1.000 | position gradient vanishes |
| Riverraid | 0.411 | 0.823 | 0.000 | 0.478 | 1.000 | position gradient vanishes |
| Ms. Pac-Man | 0.411 | 0.822 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Double Dunk | 0.408 | 0.817 | 0.000 | 0.538 | 1.000 | position gradient vanishes |
| Name This Game | 0.407 | 0.815 | 0.000 | 0.417 | 1.000 | position gradient vanishes |
| Kung-Fu Master | 0.402 | 0.805 | 0.000 | 0.800 | 1.000 | position gradient vanishes |
| Freeway | 0.398 | 0.747 | 0.049 | 0.500 | 1.000 | |
| Fishing Derby | 0.384 | 0.769 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Asterix | 0.383 | 0.765 | 0.000 | 0.500 | 1.000 | position gradient vanishes |
| Breakout | 0.375 | 0.750 | 0.000 | 0.600 | 1.000 | position gradient vanishes |
| Atlantis | 0.365 | 0.730 | 0.000 | 0.450 | 1.000 | position gradient vanishes |
| Montezuma's Revenge | 0.362 | 0.724 | 0.000 | 0.438 | 1.000 | position gradient vanishes |
| Venture | 0.349 | 0.698 | 0.000 | 0.474 | 0.750 | position gradient vanishes |
| Berzerk | 0.287 | 0.555 | 0.020 | 0.444 | 1.000 | position gradient vanishes |
| Frostbite | 0.272 | 0.484 | 0.059 | 0.150 | 1.000 | |
| Air Raid | 0.220 | 0.211 | 0.228 | 0.393 | 1.000 |
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_output -> soft_ram_peek jutari-diff call site tools/xai_study/phaseB_attribution/gradxinput.jl:268content_grad_over_ram runnerZygote.gradient(r -> content_output(r, score_idx), ...) Zygoteattributions_over_ram runnerposition_grad_over_ram runner_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.