Skip to content

feat(unified_v14): fix high-D prior freeze (Bug 1) and deep-ResBN stiff_gate/spectral drift (Bug 2) - #659

Merged
martyn merged 5 commits into
developfrom
feat/unified-v14
Nov 25, 2026
Merged

martyn merged 5 commits into
developfrom
feat/unified-v14

Conversation

@martyn

@martyn martyn commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the opt-in unified_v14 recipe preset (UnifiedV14Optimizer / optimizer_family="unified_v14_equil", extending unified_v13's rhbi_self_coupling="feydy_atomic") to resolve two 0.12.0 regressions without altering historical presets or the public default:

  • Strict Immutability: particlegan/_unified_v11/, particlegan/_unified_v12/, unified_v13, and DEFAULT_RECIPE ("unified_v12") are untouched bit-for-bit vs origin/develop (fd1ddd68b).
  • Forge Registration: Adds candidate card configs/forge/ideas/unified-v14.json and updates compiled Forge summaries (reports/forge/technique-inventory.md, reports/forge/EXPERIMENT_MEMORY.md, reports/forge/compilation.json).

Bug 1 Fix — High-D / Large-P Prior Freeze (player == "prior")

  • Root cause (PR fix(unified_v11): restore 16/16 r4-occam-ablation-v1 via non-collapsing peak_rms, equilibrium-guarded ema_func_gain, and s_gauge deadband #606 / ee4ca6b09): st["peak_rms"] (peak_r) was still tracked on prior rows as dead code while s_p_row used the unscaled constant s_cap = 0.0061 * 128 / n_unique (~1.0e-3 at B=1024, P=1600). When per-particle row gradients are ~5e-6..5e-5 (high-D bounded / sparse-observed manifolds with normalized critics), hypot(d_norm, s_cap) crushed ||unit_r|| by ~2 orders of magnitude, freezing the prior (mean_dz = 0.00738 vs 2.19 unfrozen).
  • Fix (applied identically on both zero-sync sort+is_first and fallback _resolve_unique_sampled_rows/arange paths):
    1. Restores degree-0 scale-invariant prior row smoothing cap: s_p_row = torch.minimum(s_p_row, peak_r * 2.0).
    2. Adds a zero-sync extreme-scale guard ((g_max_r > 1e-38) & ((g_max_r < 1e-18) | (g_max_r > 1e18)), plus matching d_u_ext on cur_row_rms) so amax-factored norms prevent FP32 underflow (1e-25) and overflow (1e30/3e38) while remaining bit-exact with raw FP32 norms on normal scales (1e-18..1e18).
  • k Ablation Summary (guarded rescaling, protocol seed 0, RTX A6000):
    • k=0.50: Bug 1 mean_dz=1.58288 (214.4×), failed model_ae_gan_multimodal (prec=0.8987).
    • k=1.00: Bug 1 mean_dz=1.05147 (142.4×), failed bytegan_bigan_dictionary (255/256, rmax=0.8855).
    • k=1.50: Bug 1 mean_dz=0.82965 (112.4×), failed bytegan_bigan_dictionary (suffix <5/5, rmax=0.2079).
    • k=2.00 (selected): smallest k passing all 4 sensitivity gates with healthy/bit-exact margins while recovering Bug 1 by 89.7× (mean_dz=0.66215 vs v12's 0.00738) and maintaining exact degree-0 trajectory invariance across 1e-4..1e-25.
  • Unit Tests: tests/test_unified_v14_prior_invariance.py (degree-0 invariance 1e-4..1e-25, zero-sync vs fallback parity, normal-scale bit-exact UnifiedV12Optimizer parity, extreme-scale 1e-25/1e30/3e38 guards, zero-row / smoothing=0.0 edge cases, semantic damage control proving peak_rms is active, fresh-process checkpoint continuation).

Bug 2 Fix — Deep-ResBN False stiff_gate, Bandpass d_couple, and Critic Spectral Ceiling

Four cohesive mechanisms in UnifiedV14Optimizer (0 forbidden primitives svd/eigh/pinv/autograd.grad/new_tensor, 0 Conv2d NS, 0 neural-G Critic NS, 0 B/param non-stiff state):

  1. Floor + Period-2 Flip current_stiff_gate(): max(smoothstep01((0.056 - ema_fg)/0.006), smoothstep01((0.60 - ema_fg)/0.30) * smoothstep01((-ema_flip_cos - 0.50)/0.15)) with PR fix(unified_v11): couple Law 4 critic gains, fix deep ResBN stiff_gate, and add zero-SVD Schatten-6 critic spectral control #612 coh unmasking (strictly when stiff_gate_raw > 0 and s_therm >= 0.5) and s_therm >= 0.5 recovery guard. Prevents false stiff_gate=1.0 triggers on multi-group normalized ResBN trunks (ema_fg ~ 0.06..0.45, flip > -0.50) while preserving full stiffness damping on deep unnormalized grid100_mlp16 and grid100_res16_tanh.
  2. Decoupled G Tikhonov Fade (fg_damp): fg_damp = smoothstep01((0.30 - ema_fg)/0.12) fades s_base for secant-throttled ResBN trunks without injecting m_unit momentum or perturbing grid100_mlp16.
  3. Zero-Sync Critic-Dominance Bandpass d_couple: Reads rec._g_func_gain when g_fg < 0.75 inside 0.28 < ema_margin < 1.40 (m_gate = smoothstep01((ema_m - 0.28)/0.22) * smoothstep01((1.40 - ema_m)/0.30)), piggybacked on the existing torch._foreach_norm transfer (0 extra CUDA syncs, 0 ops when g_fg >= 0.75 on DCGAN).
  4. Zero-State Batched Exact-Deadband Schatten-6 Spectral Ceiling (tau = 2.0, lam = 0.25): Applied to 2D critic hidden weights (ndim == 2, min(r, c) >= 2) grouped by shape in both fast and slow paths (0 B/param, 0.000 ms on 4D Conv2d DCGAN, exact deadband for s1 <= 2.0). All behavior-changing state (ema_func_gain, ema_flip_cos, rec._g_func_gain, rec.ema_margin) is checkpointed and verified bit-exact across fresh-process boundaries.
  • Unit Tests: tests/test_unified_v14_deep_resbn.py.

Verification Results (Protocol Seed 0, RTX A6000, b1205d72b)

Benchmark / Suite Baseline (v11 / v12 / live v13 @ origin/develop) Final feat/unified-v14 (b1205d72b) Verdict
Pytest + Hygiene + Lint + Forge origin/develop (fd1ddd68b) 273/273 PASS (157.2s), 0 lint additions, forge validate PASS, compile --check CURRENT, 0 forbidden primitives / new_tensor, fresh-process continuation & clockfree_audit PASS PASS
Bug 1 Repro (D=512, P=1600, B=1024, 200st) v12: z_std=0.9982, mean_dz=0.00738 (296× FROZEN); v14 s=0 ref: 2.19166 z_std=1.0978, mean_dz=0.66215 (89.7× recovery vs frozen v12; exact degree-0 invariance 1e-4..1e-25, zero-sync=fallback parity) PASS
Bug 2 Repro 500st (ResBN d=2/4/8, B=1024) v12: stiff=0.996–1.000, D_s1=3.61–4.40, dz=1.16–1.51 d=8 (b1205d72b): stiff=0.000, D_s1=2.36, dz=2.8193, sw1=0.0178, varR=0.939, margin=+0.065 (d=2,4 on d65ddba5b: stiff=0.000, D_s1=2.30–2.31, sw1=0.0174–0.0180) PASS
Long ResBN d=2,4,8 5k / 10k (stream256) v12 5k: d=2,4 FROZE (s_th=0, sw1=.0237/.0242), D_s1=4.26–4.96; 10k: sw1=.0184/.0187/.0190, D_s1=4.17–4.94 5k: sw1=.0172/.0170/.0189 (-27%/-30%/-2%), stiff=0, D_s1=2.26–2.63; 10k: sw1=.0155/.0164/.0187, varR>=0.962, D_s1=2.44–2.57, dz 2.1–3.0× (caveat below) PASS*
r4-occam-ablation-v1 (16 tasks) v12/v13: 16/16 16/16 PASS — zero_tanh_rail_escape (p99@1000=0.00219, @1401=0.02182, @2000=0.01963), grid100_mlp16 (prec=0.99071, ctr=0.0713) + all 14 other tasks PASS PASS
t4-strange-architectures-v1 (7 tasks) v12: 6/7 (PR #615) 7/7 PASS — grid100_res16_tanh (prec=0.99001, ctr=0.1003, tv=0.0342 — NEW PASS), grid100_mlp16, grid100_res16_scaled_tanh, grid100, zero_tanh_smoke, zero_tanh_rail_escape, clockfree_audit PASS
bytegan_stretch (2 tasks, feydy_atomic) v13: 2/2 (hypercube8 rms=0.0445, bigan_dict 256/256, rmax=0.117) 2/2 PASS — bytegan_hypercube8 256/256, 0 coll, rms=0.04393; bytegan_bigan_dictionary 256/256, 0 coll, recon_exact=256/256, rmax=0.08494, rrms=0.00552 PASS
bcap_convolution_images (4 Conv2d) v12/v13: 4/4 4/4 PASS (img_bars4, img_stripes2, img_blobs4, img_intensity2; all hq=1.0) PASS
dcgan_performance (6/6, idle GPU 1) v12: r32=19.23, r64=21.60, r128=27.58, r256=51.75 (1243.9 MiB), b64=24.44, w128=25.53 ms 6/6 PASS: r32=20.12, r64=21.68, r128=28.51, r256=49.27 ms (1147.6 MiB: faster, -96 MiB), b64=26.24, w128=24.33 ms (0 Conv2d NS, 0 Schatten-6 on DCGAN) PASS
discriminator_stability T1–T4 (68 tasks) live v13 (unified-bytegan-bijection.json): T1 17/17, T2 28/32 (ddgan_bimodal/ae_ddgan_bimodal/interp_* pre-existing live FAIL), T3 3/3, T4 4/4 runnable 0 regressions vs live v13 (+1 NEW PASS grid100_res16_tanh): T1 17/17 (model_ae_gan_multimodal 0.96265), T2 28/32 (model_ae_ddgan_gaussian_chain final_cdf=0.07215, t1_q0=0.2227, emax=1.3738), T3 3/3, T4 4/4 runnable (+12 std incompat BLOCKED) PASS
r3-tier3-14k & r3-tier4-frontier holdouts v12/v13: 18/18 & 3–4/4 18/18 PASS (all 3 14k continuations bit-exact) & 4/4 runnable PASS (+12 std incompat BLOCKED) PASS

* Transparent long-horizon ResBN caveat: At 10k steps on stream256 ResBN d=2,4,8, while sw1, varR, D_s1, and prior dz all strictly improve over v12, ema_m rises to +0.55..+0.69 (vs v12's +0.01..+0.05) and d=8 fgG dipped to 0.054 < 0.056 triggering stiff=0.294. unified_v14 ships as an opt-in candidate preset (DEFAULT_RECIPE remains "unified_v12").

@martyn
martyn merged commit 597c671 into develop Nov 25, 2026
4 checks passed
@martyn
martyn deleted the feat/unified-v14 branch November 25, 2026 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant