Add optimizer relax displacement diagnostics

This commit is contained in:
Meta Vens 2026-04-23 22:51:05 +01:00
commit 863b518e1e
9 changed files with 276 additions and 6 deletions

View file

@ -153,6 +153,21 @@ Next after that:
- add a focused ablation runner for pinned badge/emblem cases before cutting more behavior
- collapse duplicated adjacency / motif / line voices only after ablation shows which stage owns each idea
The next pass turned that "put relax on trial" note into an actual measurement seam:
- `SolverArtifacts` now carries stage diagnostics for continuous runs, including the exact selected-source displacement field for `snap`, `relax_handoff`, `relax_mode`, and `final_output`
- `run.json` now includes `optimizer_displacement` metrics, and diagnostics directories now write color-coded displacement previews for those stages
- the pinned cleaned-badge comparison under `artifacts/optimizer-relax-purpose-check/` runs the same fixed lattice twice: once with normal relax and once with `relax_iterations=0`
What that test says:
- `relax` still helps a little on the real badge objective: final source-fidelity improves from `0.07549` without relax to `0.07451` with relax
- but the displacement field does **not** become clearly smoother in the way the original design story promised
- on that same pinned badge run, final orthogonal displacement jitter is `1.7154` with relax versus `1.6783` without it, and final local residual is `1.1548` with relax versus `1.1312` without it
- the honest read is that the current relax stage behaves more like a soft consensus / handoff stabilizer over fixed local candidate trays than a true large-swath phase adjustment mechanism
That means the next optimizer cuts should treat `relax` as a measurable subsolver with a narrower actual job, not as a sacred phase-field story we keep around out of nostalgia.
The next optimizer simplification pass should use that map as its cutting checklist instead of guessing from scattered helper names.
## High-value regression case

View file

@ -463,6 +463,26 @@ Recent cut:
This is wet plaster and half-seated stones.
Nothing is fully committed yet. Each slot is allowed to say, "I'm 60% this dark edge stone, 30% the slightly duller one, 10% the safer interior stone." The wall is still trembling, but the trembling starts to synchronize. Temperature drops. The slurry thickens. Shapes that looked independent begin leaning into each other like bones finding their sockets.
### Measured reality
The original design goal for `relax` was larger than "soften local choices." It was supposed to let the machine adjust phase smoothly over broad swaths of the canvas instead of only making tiny local corrections.
The current instrumentation in `continuous.py` says the truth is weaker than that story.
On the pinned cleaned-badge run at `126x126`, phase `(0.0, -0.2)`, `steps=48`:
- with `relax_iterations=24`, final source-fidelity lands at `0.07451`
- with `relax_iterations=0`, final source-fidelity lands at `0.07549`
- so `relax` does help a little
But the displacement-field diagnostics do **not** show a dramatic large-scale phase-smoothing effect:
- final orthogonal displacement jitter is `1.7154` with relax versus `1.6783` without it
- final local residual is `1.1548` with relax versus `1.1312` without it
- final dominant-offset ratio is `0.6296` with relax versus `0.6380` without it
So the current `relax` earns a small fidelity gain, but it does not look like a true broad-swatch phase transport stage. It behaves more like a soft consensus pass over a fixed tray of local candidates, then hands that consensus to greedy refine.
## Stage 8: Greedy discrete refine
Function:
@ -601,7 +621,7 @@ That is much simpler than the surrounding names make it sound.
If we keep pruning, the highest-value cuts look like this:
1. Put relax on trial.
The soft relaxation stage still seems useful, but the relax-mode bonus was dead weight. The next question is which remaining relax terms are actually earning their keep.
The soft relaxation stage still seems useful, but the current measurements say it is not really acting like a large-scale phase smoother. The next question is which remaining relax terms are actually earning their keep, and whether the surviving benefit comes from handoff stabilization rather than regional phase drift.
2. Collapse duplicate structure voices.
Adjacency, motif, and line are important, but they should not need three near-parallel dialects unless they are truly doing different work.
3. Decide whether snap still needs both portraits everywhere.