Repository navigation
Score multi-head search with the full appearance model #113
Description
Note
🤖 Claude Opus 5.5 responding on behalf of Victor Sandu
Multi-head search ranks layouts with fitted optics only, so on profiles with real calibration evidence it can pick layouts the full appearance model predicts are worse. The gain check in #100 stops those builds from shipping, but it can't find better layouts, so they fall back to single-head.
Evidence. These use the measured profile in tests/assets/performance/8-colors-frontlit-2026-08-26 (26 Palette Proofs and one Stack Matrix).
On the cats image, Layer-based, Balanced search, change from single-head in mean CIEDE2000 (lower is better):
| Heads | Engine expects | Full model predicts |
|---|---|---|
| 2 | −0.59 | +0.04 |
| 3 | −0.82 | −0.12 |
| 4 | −0.84 | −0.35 |
| 6 | −0.94 | −0.05 |
The engine also ranks head counts differently: 6 heads looks best to it, while the full model prefers 4.
On a 64-color palette from the Rocco test image at 0.08/0.4 mm layers, the layouts it picked at 3 and 4 heads are predicted to be worse than single-head by 0.13 to 2.69, in both grouping modes. At 2 heads it finds no window.
Why not score every candidate. On the k-logo stack, one full-model prediction takes about 30–45 µs, while simulating a whole stack takes about 30 µs. With 27 occupied surface layers, a candidate costs about 39× more: a Balanced window (65,536 orders) goes from about 2 s to about 78 s. Applying that ratio to cats at 6 heads (about a minute today) gives roughly 47 minutes. That last figure is an estimate; I didn't run it.
Proposed approach (judgment, not yet tested).
- Keep the fitted-optics simulation for the broad search, but keep the top candidates per window.
- Re-rank those candidates with the full model, and use it for the final per-color reconciliation.
- Tune the candidate count against runtime on the measured-profile cases and Rocco.
Done when:
- On
catsand the Rocco palette with real proofs, predicted gains improve over the fitted-optics search, and builds clear the gain check at least as often. - The added Balanced runtime is measured and acceptable at 2–8 heads.
MIN_MULTI_HEAD_PREDICTED_GAIN(currently 0.25, a judgment call) has been revisited against the new results.
analyzeWindowLUT in src/lib/multiHeadAnalysis.ts already applies the full model, but nothing in the app calls it. This work should either reuse that path or remove it.
Activity
vycdev commentedon Oct 31, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of Victor Sandu
This cleanup should also cover the test-only code in
src/lib/multiHeadAnalysisColorFirst.ts. At the top of the stack (#102), nothing else insrcuses these, so they're clutter rather than bugs:analyzeMultiHeadWindowsColorFirst(about 67 lines), plus the file header comment that recommends it as a drop-in.colorAssignmentsanduniqueLayerCountfields onColorFirstResult, plus theselectedAssignmentsandgroupAssignmentsbookkeeping that only exists to fillcolorAssignments.Their tests go with them. If the re-ranking work ends up needing any of this, keep that part.
vycdev commentedon Nov 1, 2026
Note
🤖 Codex (gpt-6.1-sol) responding on behalf of vycdev
Resolved by #118, merged into
developasc0ef02c1acd297261f0a1008f3216996556c9717.Multi-head search now nominates bounded 32-entry shortlists with cheap fitted optics, then uses the full appearance model and usage-weighted CIEDE2000 for window selection and per-region reconciliation. Fully scored assignments are reused when their physical context matches. Calibrated previews, the 0.25 gain gate, safe single-head fallback, original home layers, zero-weight colors, regional priorities, and #114's physical scheduling/dithering behavior are preserved.
Unused analyzers/result bookkeeping were removed, useful coverage was replaced with deterministic regressions, and the changelog and all 12 usage guides were updated.
Validation: 1,050 tests passed, plus lint and the full build. The post-#114 replay covered 2–8 heads in both grouping modes across the controlled measured-profile cats/Rocco cases; all 28 reproduced the recorded paths, predicted gains, and fallback outcomes. Benchmark evidence and limitations.
Fresh Exact cats reproducibility and warmed repeated timing validation remain tracked separately in #117.