ctde_v0.probe_frontier_align¶
probe_frontier_align
¶
Probe: does the frontier-attention explorer tool actually point at the frontier?
STANDALONE CPU diagnostic (NO training). For a explorer_tool == 'frontier_attn'
checkpoint it replays the trained policy (the SAME un-jitted rollout step as
render.py / ppo._single_rollout) and, per (step, agent), recomputes two things
DIRECTLY off the saved Actor.frontier_attn params and each agent's own belief/obs:
(i) the module's own attention weights
attn = softmax( q(z_i) · k(feats_i) / √d ) over the K compass sectors
(exactly FrontierAttn.sector_logits internals — nets.py:429), and
(ii) the TRUE per-sector frontier mass
feats = sector_frontier_features(obs_i, K, sharp) (nets.py:320),
whose column 1 (feats[:,1]) is the frontier DENSITY toward each sector — the
honest "how much uncovered ground actually lies that way".
It then answers three questions:
- ALIGNMENT — how often does argmax(attn) land on argmax(true frontier), over the
DIRECTIONAL sectors 1..K-1 ('here'=0 excluded)? Chance is 1/(K-1). If alignment ≈
chance the learned attention is NOT tracking the frontier; the module's frontier-
positivity would then come only from the hand-derived
fracmultiplier, not from anything the network learned. - GATE — what is
alpha = softplus(log_alpha)?alpha ≈ 0means the whole tool is dialed OFF (its additive bias is ~0) — a real, publishable finding on its own. - INFLUENCE — on what fraction of (step, agent) does adding the frontier bias actually
FLIP the (masked) goal argmax vs. the bare
goal_head? If it rarely flips, the tool is inert regardless of alignment.
Outputs (under --out): a matplotlib panel gallery (frontier heatmaps with the K
compass sectors overlaid, annotated with per-sector frac + attn, and the argmax-attn vs
argmax-frontier arrows), an alpha gauge, a per-rung alignment bar, an index.html
(styled after make_report.py) and summary.json with a one-line verdict.
JAX_PLATFORMS=cpu PYTHONPATH=.:../../../FiedlerValueEstimation /Users/bijanmehr/Project.Zymera/zymera_lab/.venv/bin/python -m ctde_v0.probe_frontier_align --run-dir runs/frontier/seed0/pen0.0 --out probe_out --seeds 0,1,2 --sample-stride 10