Skip to content

learn-report: the loss family against the untrained and constant arms (held-out objectives in arms-eval) - #174

Merged
transfix merged 1 commit into
mainfrom
feat/learning-loss-arms
Nov 14, 2026
Merged

transfix merged 1 commit into
mainfrom
feat/learning-loss-arms

Conversation

@transfix

Copy link
Copy Markdown
Contributor

Closes the gap #171 named. grl-snam learn-report's loss family compared a trained run's held-out loss terms only with that run's own step 0, because a learning history holds the trained run alone. Now every arm (trained, untrained step 0, constant) is scored with the trainer's own objective on the same held-out units. The loss family is tested against the untrained and the constant arm, as the task family already was.

What changes

  • grl_snam.learning.objective (new): held-out loss terms per unit, for any arm.
    • grl-snam train: loss, goal, col, reg per held-out pair, inside the run's held-out blocks. The mean over pairs is sdf_eval.objective_terms, the obj_<term> a --val-frac history logs.
    • coef-train: loss, goal, coll per held-out start (--heldout-seed, --heldout-agents, --horizon, --grid), on the surrogate or the bicycle rollout. Each start averages the trainer's BPTT windows, as its step record does. At lr 0 the mean equals the trainer's logged step terms (tested).
    • No gradient, a forked torch RNG, and the net's train/eval mode restored.
  • grl-snam arms-eval: two opt-in cases, objective-sdf and objective-coef. Every metric has direction down, family loss, and a unit of pair or start. --label names the run. The default --cases is still coef,scorecard.
  • grl_snam.learning.arms: arms_table writes optional per-case family/unit. runs_paired_diff pools one table per training seed with a runs × units two-level bootstrap (the statistic Does base GRL-SNAM's policy learn? The coef_sdf learning check, and E1 (planted dissipation) #172 used).
  • grl-snam learn-report:
    • Claims on a loss case are family loss: loss:<case>:<term>:trained-vs-<arm>, "held-out goal (objective-sdf) is lower for trained than for untrained (paired by held-out pair, 95% CI)".
    • --arms repeats, one table per training run, and the runs pool.
    • The existing last-vs-first loss claims are unchanged.
    • Backward compatible: the report JSON only gains fields (sources.arms_tables, and unit/runs/per_run/labels in evidence); report() still takes one table; task_claims still exists. With no loss case in the table, every claim and number is what it was.
  • experiments/learning_proof/objective_arms.py scores through the library. It rebuilds docs/learning-validation/objective.json byte for byte.
  • README, "Did it learn?": the loss cases and the multi-seed commands.

On #172's retrain (5 seeds, docs/learning-validation/retrain)

arms-eval --cases objective-sdf per seed (1024 held-out pairs, seed 777, the run's held-out blocks), with arms trained = the pick, untrained = step 0, and constant = const:hist (the pick's own head means). Then learn-report on the five histories and five tables:

term trained − untrained trained − constant
loss +0.749 [+0.264, +1.348] fail +0.029 [−0.011, +0.067] fail
goal −0.062 [−0.104, −0.024] pass +0.0004 [−0.011, +0.012] fail
col +0.256 [+0.091, +0.441] fail +0.007 [−0.006, +0.019] fail
reg +0.437 [+0.042, +1.035] fail +0.068 [+0.015, +0.150] fail

Tests

  • tests/learning/test_learning_objective.py, 13 tests, about 6 s:
    • trainer parity: both coef-train loops, and sdf_eval.objective_terms;
    • RNG, grad and mode isolation;
    • split readers, including .jsonl.gz;
    • both arms-eval cases end to end, then learn-report on them;
    • the pooled bootstrap, multi-table claims, and the CLI with --arms repeated.
  • tests/learning: 73 pass, 1 skip (pycvc's nav_coef_mlp_forward).
  • black 26.5.1 and ruff 0.16 (cvcpkg) are clean on CI's paths.

… (held-out objectives in arms-eval)

#171's loss claims compared a trained run's held-out loss terms only with that run's own step 0,
because a learning history holds the trained run alone. Every arm is now scored with the
trainer's own objective on the same held-out units, and learn-report claims on those as loss
terms, as it already did for the task metric.

- grl_snam.learning.objective: per-unit held-out terms for grl-snam train (loss, goal, col, reg
  per held-out pair; the mean is the history's obj_<term>) and coef-train (loss, goal, coll per
  held-out start, surrogate or bicycle; the mean is the trainer's step record at a fixed net).
  No gradient, a forked torch RNG, the net's mode restored.
- arms-eval: opt-in cases objective-sdf and objective-coef (direction down, family "loss", unit
  "pair"/"start"); --label names the run. The default cases are unchanged.
- arms: per-case family/unit fields; runs_paired_diff, a runs x units two-level bootstrap for
  one table per training seed.
- learn-report: claims on a loss case are family "loss"
  (loss:<case>:<term>:trained-vs-<arm>); --arms repeats (one table per run, pooled). The report
  JSON only gains fields (sources.arms_tables; unit, runs, per_run, labels in evidence).
- experiments/learning_proof/objective_arms.py scores through the library; it rebuilds
  docs/learning-validation/objective.json byte for byte.
@transfix
transfix merged commit 629a651 into main Nov 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant