Phase A · neuroscience battery

A7 · Dimensionality reduction (NMF/PCA)

cf. Jonas & Kording 2017

← back to the method catalogue

What it does?

Dimensionality reduction summarises high-dimensional activity by a few components. Principal component analysis (PCA) finds the directions of largest variance; non-negative matrix factorisation (NMF) finds additive, parts-based factors. Both are standard in neuroscience for turning a large population recording into a handful of interpretable 'latent factors'. We run them on the VCS state tensor, the values of all cells over time, and read off the recovered components. We then match each component to a known signal: the frame or scanline clock, a read/write pattern, the vsync flag, or a game variable. The intuition is that the strongest components should correspond to the machine's real internal signals, so the factorisation recovers the structure without any labels. The method is unsupervised and cheap, which is why it is popular. On the VCS it does moderately well: it recovers most of the known factors, and NMF's non-negativity fits the additive register basis a little better than PCA. But a large fraction of components stay unmatched or mix several true signals into one, so the decomposition is suggestive rather than exact. It finds structure that is genuinely present, without telling us how the program uses it.

A7 · Dimensionality reduction (NMF/PCA) result

Left: the frame. Right: this method's per-cell/per-component result against the ground-truth importance, with the RAM cells labelled. A7_nmf_matched_component_fraction_vs_known_vars = 0.600 — this example only (pong, state gameplay(seed=0,prefix=90)+15); the audit aggregate is below.

How it's scored

The score is the fraction of NMF or PCA components that match a known signal or variable. We decompose the state tensor into components, then match each to the machine's known internal signals, the frame or scanline clock, a read/write pattern, vsync, or a game variable, and count the matched fraction against what the oracle marks as important. Faithfulness for this method is that matched-component fraction. It is moderate: the decomposition recovers most of the known factors, and NMF's non-negativity fits the additive register basis a little better than PCA, but a substantial fraction of components stay unmatched or mix several signals into one. A secondary reconstruction-error composite gives NMF a small edge, but on the primary matched-fraction metric the two are close. The grading is always against the oracle, not against another method. There is no sprite-position hard-case here; the output is a set of components. The audit box reports the measured matched fraction across the scored games, so the number is an average over the scored set rather than the best single game.

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_phaseA.json.

AxisFormula (as computed) What it measuresMatches §3?
F
faithfulness
\(F = \rho_{\mathrm{Spearman}}\!\left(\mathrm{attr}_{\mathrm{recovery}},\ \Delta y(u)\right)\)Spearman correlation between each cell's PCA/NMF component-recovery score and the oracle causal importance over candidate cells (reported separately for PCA and NMF).✓ matches Two triads (triad_pca, triad_nmf); correlation vs oracle causal importance, not vs known-variable labels. Runner A7_dimred.jl,; record out/A7_pong.json triad_nmf.F=-0.385, triad_pca.F=-0.041.
how it's measured — call stack:
  1. F = Spearman(component recovery, oracle causal importance) — A7_dimred.jl:751
  2. score_triad for the PCA / NMF recovery maps — A7_dimred.jl:749
  3. true causal effect Δy(u) by bit-exact re-run — oracle_intervene.jl:242
S
sufficiency
\(S = \rho_{\mathrm{Pearson}}\!\left(\mathrm{attr}_{\mathrm{recovery}},\ \Delta y_{\mathrm{held\text{-}out}}(u)\right) \in [-1,1]\)Pearson correlation of the component-recovery score vs the held-out do(base+37) screen break.✓ matches Held-out predictive correlation in [-1,1] of the component-recovery score vs the held-out do(base+37) screen break: the §3 (sec:triad) form. Two triads (pca, nmf). A7_dimred.jl; record S: nmf=-0.291, pca=-0.192.
how it's measured — call stack:
  1. S = Pearson(recovery, held-out do(base+37) screen break) — A7_dimred.jl:752
  2. 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\}\)Number of oracle-causal cells over the number of dim-reduction-surfaced cells the method names.✓ matches Runner now emits M = |U*|/|U_hat| for both triad_pca and triad_nmf (M_note '|U*|=4 (oracle movers) / |U_hat|=4/6'), the paper's set-size ratio. Record out/A7_pong.json triad_pca.M=1.0, triad_nmf.M=0.667. Replaced the former 1 − variance-not-causal over-claim rate.
how it's measured — call stack:
  1. minimality_score(recovery, oracle importance) — A7_dimred.jl:767
  2. minimality_score: |U*| oracle movers / |U_hat| surfaced cells — triad_sm.jl:57
  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 (42 committed §R records), not the single example shown above. Tradition: dim_reduction. The example figure (Pong) is one of those records.

0.519F — faithfulness vs oracle (mean over 42 games, ±0.061 CI95)
n/aS — sufficiency: held-out predictive (n/a where the paper does not define this axis)
n/aM — minimality: true-minimal-set / named-set (n/a otherwise)
42committed 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; this method has no content-vs-position split (see the note below)). Click a header to sort. Every number is read from site_data.json (methods.A7_dimred.per_game).

content-F and position-F are n/a for this method. The content-vs-position split applies only to pixel-attribution methods — those that produce an attribution map over the framebuffer, whose score can be read separately on the smooth content outputs and the discrete position outputs (where the naive gradient is provably zero). This method does not attribute to a pixel output; it is graded by its own fidelity metric (A7_nmf_matched_component_fraction_vs_known_vars), reported as the F column, so there is no content or position regime to separate.

GameF (all)content-Fposition-FSMNote
Alien1.000n/an/an/an/arecovers the true causes
Air Raid0.800n/an/an/an/a
Berzerk0.800n/an/an/an/a
Demon Attack0.800n/an/an/an/a
Kangaroo0.800n/an/an/an/a
Pacman0.800n/an/an/an/a
Riverraid0.800n/an/an/an/a
Venture0.800n/an/an/an/a
Bank Heist0.600n/an/an/an/a
Beam Rider0.600n/an/an/an/a
Breakout0.600n/an/an/an/a
Centipede0.600n/an/an/an/a
Chopper Command0.600n/an/an/an/a
Freeway0.600n/an/an/an/a
Hero0.600n/an/an/an/a
Jamesbond0.600n/an/an/an/a
Montezuma's Revenge0.600n/an/an/an/a
Ms. Pac-Man0.600n/an/an/an/a
Pong0.600n/an/an/an/a
Q*bert0.600n/an/an/an/a
Seaquest0.600n/an/an/an/a
Space Invaders0.600n/an/an/an/a
Assault0.400n/an/an/an/a
Atlantis0.400n/an/an/an/a
Bowling0.400n/an/an/an/a
Boxing0.400n/an/an/an/a
Double Dunk0.400n/an/an/an/a
Fishing Derby0.400n/an/an/an/a
Ice Hockey0.400n/an/an/an/a
Krull0.400n/an/an/an/a
Kung-Fu Master0.400n/an/an/an/a
Name This Game0.400n/an/an/an/a
Phoenix0.400n/an/an/an/a
Pitfall0.400n/an/an/an/a
Road Runner0.400n/an/an/an/a
Yars' Revenge0.400n/an/an/an/a
Carnival0.200n/an/an/an/a
Frostbite0.200n/an/an/an/a
Gopher0.200n/an/an/an/a
Private Eye0.200n/an/an/an/a
Tennis0.200n/an/an/an/a
Video Pinball0.200n/an/an/an/a

Call stack — how it runs on jutari / jaxtari

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

Applied on the substrate

  1. assemble the shared gameplay-state testbed + cause-density gate — build_a7_shared_state(game) -> build_shared_testbed(game; ...) runner
  2. build_shared_testbed definition: booted checkpoint + shared output + gate — function build_shared_testbed(game; ...) runner
  3. cause-density gate counts causes with |Delta_y|>floor via the oracle — cause_density = count(>(floor), deltas) runner
  4. record a (frames x 128) RAM tape by stepping the ROM with A7's per-game settings — a7_record_ram(game, frames, actions) runner
  5. step the real emulator one frame per action while recording — env_step!(env, Int(actions[t])) jutari
  6. read RAM into the tape each frame — get_ram(env) jutari

The computation

  1. PCA (method under test): principal-component decomposition of the RAM tape — run_pca(tape) runner
  2. NMF (method under test): non-negative matrix factorization of the RAM tape into rank components — run_nmf(tape, rank; iters=300, seed=0) runner
  3. match recovered components to known ground-truth signals (scoring) — match_components(method, tape, ...) runner

Scored against the exact intervention oracle Δy(u): run_intervention(checkpoint, actions, target_frame, horizon, cause).

Implementation
tools/xai_study/phaseA_kording/A7_dimred.jl
Reference
cf. Jonas & Kording 2017
Record
A7_pong.json
All records
phaseA_kording/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.