Skip to content

Phase 4g: IRED learned landscape works — geometry beats softmax 4/5 seeds (flips the 4e caveat) - #2

Merged
dkjo8 merged 4 commits into
mainfrom
phase-4g-ired
Jul 27, 2026
Merged

Phase 4g: IRED learned landscape works — geometry beats softmax 4/5 seeds (flips the 4e caveat)#2
dkjo8 merged 4 commits into
mainfrom
phase-4g-ired

Conversation

@dkjo8

@dkjo8 dkjo8 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Implements the Phase-4e priority lever — a genuinely learned, multi-basin landscape — and uses it to flip the softmax caveat.

Result (5 seeds, learned IRED landscape)

reasoner ΔAURC vs scalar energy ΔAURC vs best softmax baseline
basin-center (v0.0.1) +0.085, wins 5/5 −0.011, wins 0/5
IRED (learned) +0.159±0.051, wins 5/5 +0.007±0.005, wins 4/5

Under a learned multi-basin landscape, geometry beats a well-calibrated softmax on 4/5 seeds (only seed 3 ties), where the basin-center reasoner lost 0/5 — confirming the hypothesis that the simple landscape, not the geometry idea, was the limiter. Margin is small but consistent; reported measuredly.

What made it work

The DSM objective was stuck (score net never fit). The fix is an IREM-style contrastive + stationarity objective: contrastive puts the correct anchor below competitors/random, and a stationarity term ||∇E(μ_y)||→0 makes anchors genuine attractors — the piece DSM lacked — so annealed Langevin descent reaches them. ID accuracy rises from chance to 0.72–0.90.

Contents (opt-in, non-breaking)

  • energy/mlp_ebm: energy_form="learned" + per-class anchor codebook; train/losses.ired_loss_fn (contrastive+stationarity+decode); inference/optimizer.annealed_langevin + [inference] sampler="annealed"; config knobs (ired_stat_weight, …).
  • configs/experiments/arithmetic_ired.toml, configs/sweeps/ired_seeds.toml; tests (test_ired, test_annealed_sampler). Default basin_center unchanged.
  • Paper updated (abstract, experiments, conclusion) to report the flip honestly; rebuilds via tectonic. Docs updated.

92 tests green, ruff clean. Merges the current main (paper) in.

🤖 Generated with Claude Code

David Khachatryan Johansson and others added 4 commits July 27, 2026 12:53
…reaking)

The Phase-4e lever: test whether a genuinely learned multi-basin landscape lets restart geometry
beat softmax confidence. Scaffolded and honest about its current status.

- config: [train] objective = "basin_center" (default) | "ired" + IRED hyperparams.
- energy/mlp_ebm.py: energy_form="learned" (fully-learned scalar field + ridge, no fixed bowl) and a
  per-class latent anchor codebook (nn.Embed); default stays "bowl".
- train/losses.py: ired_loss_fn — denoising score matching toward the true-class anchor across a
  noise schedule + reachability (anchors below random z0) + anchor/basin decode. train_ebm selects
  the objective; basin_center path unchanged.
- configs/experiments/arithmetic_ired.toml + tests/test_ired.py (default is basin_center/bowl; IRED
  trains without error and infers valid preds — accuracy NOT asserted). 89 tests green, ruff clean.

HONEST STATUS: the objective trains cleanly (anchors decode, reachability gap -> 0) but does NOT yet
reason — DSM stays high and ID accuracy is ~chance, because the shared fixed-step Langevin sampler
doesn't reliably reach the correct basin (classic EBM-sampling gap). Making it work needs annealed
Langevin sampling at inference (step ∝ σ², descending noise) + a stronger score net; the 4e stress
test is therefore not re-run under IRED yet. Kept on this branch and NOT merged; main/v0.0.1 remain
on the working basin-center reasoner. See docs/EXPERIMENTS.md (Phase 4g) + SESSION_HANDOFF.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…as the score net

Second bounded attempt at making the IRED landscape reason.

- inference/optimizer.py: annealed_langevin — simulated-annealing Langevin with a geometric
  explore->settle per-step schedule (same return signature as langevin_descent, so the trajectory/
  geometry path is unchanged). A general, reusable inference option.
- config + restarts.solve: opt-in [inference] sampler = "langevin" (default) | "annealed"; solve
  dispatches. arithmetic_ired.toml uses the annealed sampler.
- tests/test_annealed_sampler.py: settles into a bowl minimum, record_z shapes, solve dispatch +
  default unchanged. 92 tests green, ruff clean.

FINDING (honest): annealed sampling did NOT fix IRED accuracy (still ~chance). Root cause diagnosed:
the denoising-score-matching loss is stuck (dsm ~16 of a trivial ~24 for d=24, flat across epochs
and samplers) — the score network isn't fitting under the double-grad DSM objective, so the learned
energy has no useful gradient field regardless of sampler. The blocker is the score net, not the
sampler. Real next step: a sigma-conditioned NCSN-style score network (a redesign, not a tuning
tweak). Phase-4e stress test still not re-run under IRED (meaningless at chance accuracy). Remains
on this branch / draft PR #2, NOT merged; main/v0.0.1 keep the working basin-center reasoner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replaces the stuck DSM objective with an IREM-style contrastive + stationarity objective, which is
the breakthrough: driving ||grad_z E(mu_y)|| -> 0 makes the class anchors genuine *attractors*, so
annealed Langevin descent reaches the correct basin (the DSM attempts left anchors low-energy but
not stationary, so descent never settled there).

- train/losses.ired_loss_fn: contrastive (E(mu_y) below wrong-class anchor and random z0 by a
  margin) + stationarity (anchors are local minima) + anchor/basin decode; anti-collapse ridge.
- config: ired_stat_weight (the key knob); train_ebm passes it.
- configs/experiments/arithmetic_ired.toml: tuned working config (ridge .15, stat_weight 5, decode
  2, epochs 55, annealed sampler 20x10) -> ID ~0.72-0.90. + configs/sweeps/ired_seeds.toml (5 seeds).
- test_ired.py updated to the new metrics. 92 tests green, ruff clean.

RESULT (5 seeds, learned IRED landscape): geometry beats scalar energy 5/5 (dAURC +0.159±0.051) AND
beats the best softmax-confidence baseline (MSP/temp/entropy) on 4/5 seeds (dAURC +0.007±0.005, CIs
excluding 0; seed 3 ties). Under the Phase-1 basin-center reasoner geometry lost to softmax 0/5 — so
a genuinely learned multi-basin landscape flips the Phase-4e caveat, confirming the hypothesis that
the simple landscape (not the geometry idea) was the limiter. Margin is small but consistent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	.claude/CLAUDE.md
#	docs/SESSION_HANDOFF.md
@dkjo8
dkjo8 marked this pull request as ready for review July 27, 2026 13:50
@dkjo8 dkjo8 changed the title [WIP] Phase 4g: IRED-style landscape training (opt-in, does not yet reason) Phase 4g: IRED learned landscape works — geometry beats softmax 4/5 seeds (flips the 4e caveat) Jul 27, 2026
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@dkjo8
dkjo8 merged commit 37c6a25 into main Jul 27, 2026
1 check passed
@dkjo8
dkjo8 deleted the phase-4g-ired branch July 27, 2026 13:50
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