You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Verify NG init-basin vs Newton bit-parity via Fortran load_* init-matching #24
Definitively separate "different random-init basin" from "residual Newton/M-step bit-parity
gap" for the NG backend, by starting both implementations from the same initial
parameters and comparing trajectories.
Background
Per the #21 investigation (see .context/issue-21/root_cause.md), the corrected NG M-step is
faithful (Fortran's converged solution is a stable fixed point of it), but a full fit from the
Python numpy init converges to a worse local optimum (LL ~ -3.46, corr ~0.5) than Fortran's
(-3.40, corr 0.9997). The remaining blocker is the Newton phase: at lrate=1.0 the Python Newton
amplifies a ~0.005 residual via near-marginal positive-definite pairs and diverges, where
Fortran takes a small stable step and breaks through. It is not yet proven whether the -3.46
basin is (i) purely init-driven or (ii) a residual Newton curvature bit-parity gap.
Approach
Fortran seeds its RNG deterministically from the seed param (amica17.f90:222) and supports load_W/load_A/load_sphere/load_mu/load_beta/load_rho/load_alpha/load_gm/load_c
(reads from indirparam, same float64 column-major format as the output files).
Generate the Python model's exact init (A/mu/beta/rho/alpha/gm/c, seed=42).
Write them to Fortran's load files (mind the W/A transpose: Fortran W = inv(A_python).T;
sources match index-for-index because _forward uses X.T @ W).
Set load_*=1, fix_init=1, run Fortran; compare its trajectory/endpoint to the Python
model started from the identical init.
Outcome
If both reach the same solution -> the -3.46 gap is init-basin; the fix is init/Newton, not a
formula bug.
If Fortran reaches -3.40 and Python -3.46 from the same init -> a residual M-step/Newton
bit-parity bug remains; localize it per-iteration.
Part of epic #9; follow-up to #21 (chosen path: implement the proven fixes first, track this
verification separately).
Activity
Merge PR #25: fix Fortran parity in NG + NumPy backends (issue #24)
Compress Known Issues section in AGENTS.md
AGENTS.md: squash-merge policy + refresh Known Issues (#47)
Add per-model bias c update for multi-model AMICA
Add per-model bias c update for multi-model AMICA (#27) (#49)
Return best iterate from AMICATorchNG.fit (#51)
Return best iterate from AMICATorchNG.fit (#51) (#53)
docs: consolidate dev docs into .context
docs: consolidate dev docs into .context (#58)
feat: component sharing in AMICATorchNG (#60)
fix: address #68 review findings for component sharing
feat: component sharing (share_comps) in AMICATorchNG (#68)
Phase A: Stabilize float32 AMICATorchNG via ufp/y guard (#78)
Remove dead numpy_impl newton module (#279)
Record the parity test's real historical block size
Add OOM-safe block-size auto-tuner (#296)
Phase 6: end-to-end validation across backends (#332)
Phase 7: normalize component rows in doscaling (#340)