Phase 4g: IRED learned landscape works — geometry beats softmax 4/5 seeds (flips the 4e caveat) - #2
Merged
Merged
Conversation
…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
marked this pull request as ready for review
July 27, 2026 13:50
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
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)||→0makes 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). Defaultbasin_centerunchanged.tectonic. Docs updated.92 tests green, ruff clean. Merges the current
main(paper) in.🤖 Generated with Claude Code