From 5ae918763988c965f02211853cc6c19afb582add Mon Sep 17 00:00:00 2001 From: wassname <1103714+wassname@users.noreply.github.com> Date: Wed, 10 Jun 2026 05:00:12 +0000 Subject: [PATCH] fix(tablelog): stale arm gates hid qmass + per-token cols in streaming view The streaming StepLogger gated on the dead literal arm=='routing' (qmass) and exact arm=='routingV' (missed routingV_per_token). arm is never 'routing' (the arm property maps routeV->routingV), so qmass was computed into the row dict but only ever surfaced in the end-of-run dump, never streamed. Gate all routeV cols on is_route={routingV, routingV_per_token}; fold qmass in. (GPT-flagged, verified.) Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com> --- src/vgrout/tablelog.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/vgrout/tablelog.py b/src/vgrout/tablelog.py index 6a461cd..f9c1059 100644 --- a/src/vgrout/tablelog.py +++ b/src/vgrout/tablelog.py @@ -93,10 +93,11 @@ class StepLogger: def __init__(self, arm: str, modes: list[str], mode_code: dict[str, str], show_ablate: bool = False) -> None: - # arm in {vanilla, projected, routing}; only projected/routing actually - # project the gradient, so the cin/cout/fired diagnostics are theirs alone - # (in vanilla they'd be counterfactual noise -> omitted). - projects = arm in ("projected", "routing") + # cin/cout/fired are the ERASE diagnostics (hack-ward fraction before/after the + # projection); only the erase arm projects, so they're its alone. routeV reports + # keep/resid/rout instead (added below). vanilla reports neither. + projects = arm == "projected" + is_route = arm in ("routingV", "routingV_per_token") cols: list[_Col] = [ _Col("step", 4, "step", "d", "GRPO step"), _Col("ref_eq", 6, "ref_eq", ".2f", "vanilla-equiv step (cum_gens/256)"), @@ -139,22 +140,20 @@ class StepLogger: # [lower, upper] (edges logged at band construction). Three zones, two views: # keep/resid/rout = UNIT shares, keepE/residE/routE = ENERGY shares (each sums to # 1). leak = hack alignment that slipped past into the deployed knob. - if arm == "routingV": + if is_route: cols += [ - _Col("keep", 6, "keep", ".2f", "unit share with cos below the band -> kept whole in the deployed knob (left)"), + _Col("qmass", 6, "qmass", ".2f", "quarantine energy share ||g_quar||/(||g_keep||+||g_quar||): fraction of the update parked in the throwaway quarantine adapter"), + _Col("keep", 6, "keep", ".2f", "unit share with cos below the band -> kept whole in the deployed adapter (left)"), _Col("resid", 6, "resid", ".2f", "unit share with cos inside the band -> partially routed (residual middle)"), _Col("rout", 6, "rout", ".2f", "unit share with cos above the band -> fully routed into quarantine (right)"), _Col("keepE", 6, "keepE", ".2f", "energy-weighted keep: share of grad ENERGY in the kept zone"), _Col("residE", 6, "residE", ".2f", "energy-weighted resid: share of grad ENERGY in the partially-routed zone"), _Col("routE", 6, "routE", ".2f", "energy-weighted rout: grad ENERGY share fully routed (~quarantine mass; the routed total is routE..routE+residE)"), - _Col("leak", 6, "leak", "+.2f", "hack-ward cosine left in the deployed knob after routing; ~0 = stripped clean, >0 = hack leaked through (under-routed)"), + _Col("leak", 6, "leak", "+.2f", "hack-ward cosine left in the deployed adapter after routing; ~0 = stripped clean, >0 = hack leaked through (under-routed)"), ] - if arm == "routing": - cols.append( - _Col("qmass", 6, "qmass", ".2f", "quarantine energy share ||g_quar||/(||g_keep||+||g_quar||): fraction of the update parked in the throwaway knob")) # Per-step deploy proxy only exists when rollout_ablate_frac>0 generates a knob-off # slice; without it the slice is empty (0/0), so drop the columns. - if arm in ("routing", "routingV") and show_ablate: + if is_route and show_ablate: cols += [ _Col("hack_abl", 6, "hk_abl", "frac", "per-step deploy proxy: hack rate on the ablated (deploy-mode) rollout slice; train prompts, noisier than hk_dep"), _Col("solve_abl", 6, "slv_abl", "frac", "per-step deploy proxy: solve rate on the ablated (deploy-mode) rollout slice; train prompts"),