plots: dejargon, drop redundant titles, emit png+svg+pdf, CSV re-render

Audit of all 4 plot scripts (plot_dynamics/substrate/emergence/deploy_overlay):
- One save_fig(fig, path) helper in figs.py writes png+svg+pdf (vector for the
  paper, png for the blog). All scripts call it.
- arm_label() map: reader-facing names only -- route2->route, drop 'knob'/'the
  cheat' from titles and the train-vs-deploy story (adapter on/off, reward hack).
- Titles off by default (the paper/blog caption carries it); --title re-enables
  for standalone research use.
- dump_data CSV now carries every plotted series; plot_dynamics --from-csv
  re-renders the three figures from the committed CSV with no logs (logs/ and
  out/runs/ are gitignored; out/figs/*.csv is tracked). Round-trip verified.
- Commit the regenerated dyn_sub4 figures in all 3 formats + the CSV.

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-06-03 02:44:39 +00:00
parent 17a8792340
commit 87cca9a603
15 changed files with 8854 additions and 62 deletions
+17 -10
View File
@@ -27,13 +27,18 @@ import matplotlib.pyplot as plt
import numpy as np
from loguru import logger
from projected_grpo.figs import save_fig
# arm -> (display label, colour). Order = legend/bar order (baseline first).
# Reader-facing names only -- "route2"/"grad" are internal tags. The grad-mask
# routing arm is the one we report, so it is plain "route"; the failed
# activation-mask variant is disambiguated, not version-numbered.
ARM = {
"vanilla": ("vanilla", "#444444"),
"projected": ("erase", "#c1432b"),
"routing": ("route", "#33508c"),
"routing2_act": ("route2 act", "#2f7d4f"),
"routing2_grad":("route2 grad", "#b8860b"),
"vanilla": ("vanilla", "#444444"),
"projected": ("erase", "#c1432b"),
"routing": ("route (v1)", "#33508c"),
"routing2_act": ("route (act-mask)", "#2f7d4f"),
"routing2_grad":("route", "#b8860b"),
}
# mode display order: in-dist first, then held-out.
MODE_ORDER = ["run_tests", "file_marker", "stdout_marker", "sentinel", "eq_override"]
@@ -79,6 +84,8 @@ def main() -> None:
ap.add_argument("jsons", nargs="*", type=Path,
help="per_mode_deploy.json paths; default globs out/runs/*sub4*/")
ap.add_argument("--out", type=Path, default=Path("out/figs/deploy_overlay.png"))
ap.add_argument("--title", action="store_true",
help="draw the suptitle (off by default: the caption carries it)")
args = ap.parse_args()
paths = args.jsons or sorted(Path("out/runs").glob("*sub4*/per_mode_deploy.json"))
@@ -97,12 +104,12 @@ def main() -> None:
_panel(a2, records, modes, arms, "deploy_solve",
"DEPLOY solve rate by mode (higher = better)", "deploy solve rate")
a1.legend(fontsize=8, frameon=False, loc="upper right")
n_seed = {r.get("seed") for r in records}
fig.suptitle(f"Per-mode deploy overlay ({len(arms)} arms, seed {sorted(n_seed)}) -- "
f"quarantine deleted = shipped model", fontsize=11)
args.out.parent.mkdir(parents=True, exist_ok=True)
if args.title:
n_seed = {r.get("seed") for r in records}
fig.suptitle(f"Per-mode deploy overlay ({len(arms)} arms, seed {sorted(n_seed)}) -- "
f"quarantine deleted = shipped model", fontsize=11)
fig.tight_layout()
fig.savefig(args.out, dpi=140, bbox_inches="tight")
save_fig(fig, args.out)
logger.info(f"wrote {args.out} ({len(arms)} arms x {len(modes)} modes)")