neural: grounding refinement + all five Layer-1.5 figures

Grounding refinement (18 reps): forward-KL is the operative neural
collapse metric, not H or tail-survival. The RNN's smoothing keeps
spurious tail modes alive, so tail_truth_mass_alive is flat/non-monotone
in g and H stays ~0.8 of H*; only forward-KL falls monotonically (dry
2.08 -> g=0.2: 0.75, paired t up to 3.3). The sharp g* << 1 is an
exact-operator feature carried by the histogram bridge (0.047); the
trained RNN confirms the SIGN and softens the sharpness (half the KL gap
closes by g~0.04, but full recovery needs g~0.19). Blueprint 3.5's
directional claim holds; the pre-registered 95%-of-H*/tail falsifier is
not met because those are the wrong metrics for a smoothing model.

Robustness: a fully-degenerate RNN can emit only invalid codewords, so
measure_distribution now returns a terminal-collapse sentinel (fixation
on the dominant mode) instead of crashing a long sweep. Edge test added
(94 tests green).

Figures: plot_{bridge,collapse,grounding,architectures,recombination}.py,
each a pure function of its committed bundle, wired into `make figures`
(glob plot_*.py minus plot_E[1-6]/_*). bridge sits on the exact H_eq
curve (g*=0.047); recombination shows max-merge rising while mean-distill
stays flat; architectures shows the collapse/rescue signs across
histogram/GRU/MLP.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-07-05 08:14:19 +01:00
parent d22dd9d535
commit b8da418034
23 changed files with 680 additions and 26 deletions

View file

@ -78,5 +78,14 @@ def measure_distribution(X: np.ndarray, oracle: Oracle, K: int) -> np.ndarray:
counts = np.bincount(modes, minlength=K)[:K].astype(float)
total = counts.sum()
if total <= 0:
raise ValueError("measure_distribution received an empty sample")
# Terminal-collapse sentinel: a fully-degenerate neural model can wander off the
# valid-token manifold and emit *only* invalid codewords. That is maximal collapse
# (the model fixed onto no real mode at all), so record it as fixation on the
# dominant mode — H=0, tail dead, large forward-KL — rather than crashing the run.
# Only reachable in extreme dry collapse; a healthy gen-0 model never triggers it
# (so the fidelity gate still catches genuine underfitting). Reason: keep a long
# multi-replicate sweep robust to one unlucky lineage.
p = np.zeros(K, dtype=float)
p[0] = 1.0
return p
return counts / total