Status: PLAN, awaiting user approval. Owner: Claude Code session 019KatSF. Experiment record: /astro/armin/koji/syndiff/dev_runs/training_fixes_20261005/README.md. Evidence behind every motivation below: /astro/armin/koji/syndiff/dev_runs/training_audit_20261005/README.md (figures fig1–fig6, epsilon/*.png).
The 10-04 model-closure fits (25 K5 A3 folds over F1/F2/C1/C4/S22, plus the F1 confirmation arms) were audited on 2026-10-05:
So the order is: fix the training code (Phase 0), measure how far the current endpoints still move when run to a true plateau (Phase 1), then decide the noise model (Phase 2) and the penalty weight (Phase 3) on converged fits. Phase 1 comes before the weight decisions because (a) it tells us whether the 10-04 verdicts survive, (b) it sets the step budget for the scans, and (c) ε must be re-measured on converged held-out residuals.
Where. New worktree /home/kshukawa/syndiff_pipeline/.claude/worktrees/training-fixes, branch training-fixes-20261005, from 3609d46 (paper-pin-chain, the exact code of the 10-04 runs; scene_fit.py is identical on paper1-integration). Nothing changes in the live checkout or in any running pipeline. Every new behaviour is opt-in through a flag, so with the flags off the fitter is bit-identical to 3609d46.
Running mean of the loss over the last $w$ steps and its relative decrease over a lag $K$:
$$\bar L_t=\frac1w\sum_{j=0}^{w-1}L_{t-j},\qquad s_t=\frac{\bar L_{t-K}-\bar L_t}{|\bar L_t|}.$$
A stage reaches a plateau when $s_t<\tau_L$ (proposed $\tau_L=10^{-4}$, i.e. 0.01% per 500 steps) and the physical quantities have stopped moving over the same lag (checked every 500 steps with one diagnose call):
$$\Delta_{\rm wcs}=\max_i\lVert \mathbf x_i(t)-\mathbf x_i(t-K)\rVert<\tau_x,\qquad \Delta_f=\operatorname{median}_i\left|\frac{f_i(t)-f_i(t-K)}{f_i(t)}\right|<\tau_f.$$
On a plateau the learning rate of every bucket is multiplied by $\gamma=0.3$ and the window restarts; after $R=2$ reductions the next plateau ends the stage. This removes the sawtooth instead of stopping on it.
Also: the step caps become safety limits (20,000 per stage); the stop reason (plateau/cap) is written to history.jsonl and fit_meta.json, and a capped stage is labelled not converged; the gradient norm is logged per optimizer bucket (WCS, ePSF, colour), so we can see which parameters are still moving (needed to explain the confirmation fits' |g| jump from 5 to 200).
The thresholds $\tau_L,\tau_x,\tau_f$ are provisional. Phase 1 validates them by running every fit 2,000 steps past its stop and checking that the post-stop drift is below the thresholds.
The data term is an average over $N$ pixels, the penalty is not, so the same λ means a different strength in each scene. New form:
$$\mathcal L=\frac1N\sum_p\ell_p+\lambda_{\rm lp}\,\frac{N_{\rm ref}}{N}\,R_{\rm lp}[P].$$
n_pix in the history).n_pix, so that F1 fold 0 is numerically unchanged.With this, λ chosen on K5 folds carries over unchanged to the all-star fit and to every field.
$$\sigma_{{\rm eff},p}^2=s^2\sigma_p^2+\left(\epsilon\,\hat m_p\right)^2.$$
$\sigma_{\rm eff}$ replaces $\sigma$ in both the loss and the island flux solve, so fluxes and shape are fitted with the same weights. The stop window restarts after each refresh. The fit has converged when, in addition, one refresh changes the median $\sigma_{\rm eff}$ by less than 1%.
lambda-lap and lambda-pixel-lap are set to 0 in the new recipe (they contribute ~10⁻⁹ of the loss today). Code kept.
Gate 0: tests pass; diff reviewed by me line by line; you approve before Phase 1 runs.
Question. How far do the 10-04 endpoints move when run to a true plateau, and do two starting points then agree?
Recipe. Exactly the 10-04 A3 recipe (paper1_dataset: A3 + XP u, λ_lp 3×10⁸ (normalised = unchanged on F1 fold 0), no floor, no width, no background, no rejection) plus the Phase-0 stop rule. Same strict K5 scenes and training-only initialisations as 10-04, so each run starts exactly where its 10-04 counterpart started.
Fits (4, from scratch, not resumed — resuming would reset Adam and refresh the nuisance flux prior):
| Fit | Why |
|---|---|
| F1 fold 0, original start | Reference; has the full 10-04 checkpoint learning curve |
| F1 fold 0, spatial-mean/header start | Route agreement at convergence (10-04: 0.59‰ flux, χ² ratio 1.0035 at the cap) |
| F2 fold 0 | Second field; hit the cap in both stage 2 and stage 3 |
| S22 fold 1 | Slowest stage 2 of all folds (still descending at 3000) |
Each fit continues 2,000 steps past its stop at the final learning rate to validate the stop thresholds.
Measured, 10-04 cap endpoint vs plateau endpoint (same held-out cohort, same scorer): loss; held-out and in-training median core χ² per T bin; per-star flux change (‰, by T); WCS shift at star positions (mpx); colour coefficients; ePSF difference images; route agreement (two F1 starts: flux ‰, χ² ratio, WCS).
Figures (all inspected before reporting): learning curves to plateau with the 10-04 cap marked; matched held-out residual stacks cap vs plateau per T bin on a shared scale, plus their difference; ePSF plateau − cap images per tile; flux-change and WCS-shift maps; standard residual grid for each plateau fit (added to canvas UMr38JDhzXGZtTjv9kfCKC).
Resources. 8 CPUs, 16–24 GB per fit (10-04 measured 7.3–9.8 GB, CCD19 needed 24 GB). Expected 5k–20k steps at 0.5–0.7 s/step → 1–4 h each, run in parallel.
Gate 1 (report to you): if the endpoint moves more than the 10-04 contrasts (CCD19 +0.37%, width +1.85%) or the two starts still disagree by more than 0.5‰ in flux, the 10-04 verdicts are re-opened and must be re-run under the new rule. Phase 1 also gives the step budget for Phases 2–3.
Gate 2: you approve (ε, s).
With (ε, s) fixed: F1 K5 at plateau, $\lambda_{\rm lp}=3\times10^8\times\{10^{-3},10^{-2},10^{-1},1,3\}$ (25 fits). The range is wide because the floor cuts the data's information on the ePSF core by $\times10^{-3}$–$10^{-2}$ and leaves the wings unchanged (audit epsilon/lambda_rescale.png). Then F2 K5 at the chosen value and its two neighbours (15 fits). Only if the best single λ leaves the core over-smoothed or the wings memorised: a per-zone λ (the penalty already has three radius zones) as a follow-up, with its own approval.
Gate 3: you approve λ_lp.
localpoly_20260930.Every number comes with the residual stacks it was measured on (data − model per T bin and CCD cell, shared scale).
| Phase | Fits | Wall time (parallel on Condor) |
|---|---|---|
| 0 code + tests | 0 (20-step checks) | ~half a day of coding + review |
| 1 plateau | 4 | 1–4 h |
| 2 noise model | ≤3 sequential + 20 | ~1 day |
| 3 λ | 25 + 15 | ~1 day |