Layer 1.5: architecture-general neural existence proof

Re-scopes Layer 2 into a cheaper, architecture-general neural collapse proof
before the LLM rung. Realises the same Wright–Fisher abstractions in real trained
generative models on a fully-synthetic sandbox with an exact oracle, reusing
knowledge.metrics/truth/seeding and the output contract so neural curves overlay
the Layer-1 analytic curves.

  - src/neural/: synthetic token-grammar sandbox (lossless identity + stochastic
    style), ExactOracle, HistogramModel bridge, generation loop, experiment runner
  - HARD GATE passed: histogram lineage reproduces Layer 1 exactly (neutral decay,
    exact H_eq, tracks run_lineage) — tests/test_neural_validation.py
  - torch models: autoregressive RNN + MLP (VAE implemented, not yet fidelity-
    passing); determinism seeding derived from the SeedSequence stream
  - N0 bridge (neural g*=0.047 ≈ Layer-1 0.048), N1 collapse-in-weights, N2 phase
    boundary, N5 architecture-generality (collapse + grounding-rescue in histogram
    + RNN + MLP). Manifests/configs committed; parquet gitignored, hashes tracked
  - additive backward-compatible save_artifacts extension; Makefile neural targets

Finding: neural smoothing partially resists H-collapse, so forward-KL and tail
survival are the sharp neural collapse metrics (H is smooth, per Layer 1).

92 tests green. Remaining (tasks/todo.md): N4 merge, N2 refine, N3/N6, VAE
fidelity, MNIST tier, figures. LLM/LoRA rung and C3 deferred.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-07-04 21:02:49 +01:00
parent 1721d047fa
commit 840b6b00b3
35 changed files with 3679 additions and 23 deletions

42
configs/neural/N0.yaml Normal file
View file

@ -0,0 +1,42 @@
experiment: N0_bridge_histogram
kind: gen_lineage
seed: 20260704
n_replicates: 60
generations: 200
# Bridge / harness-faithfulness check (Layer 1.5 build-order Stage B): run the E2 grounding
# phase-boundary sweep through the NEURAL runner with the histogram model, which is exactly
# neutral Wright-Fisher drift with immigration. Stationary H must track the closed form
# H_eq = H* * m(2n+m-1)/(n+2nm+m^2) and reproduce a critical g* << 1 — i.e. the neural
# plumbing reproduces the analytic core before any real network is trained. R=1 so every
# grounding policy reduces to the proportional immigration model H_eq is derived for.
synthetic:
K: 200
R: 1
tail: zipf
zipf_s: 1.1
tail_frac: 0.5
tail_threshold: 1.0e-3
init: truth
style_len: 2
style_vocab: 4
id_base: 2
model:
kind: histogram
dynamics:
n: 200
grounding: {m: 0, policy: proportional} # m is overwritten per g by the sweep
remint: {enabled: false, period: null, H_gate: null}
metrics:
kl_floor: 1.0e-9
support_eps: 1.0e-9
sweep:
- param: g
values: [0.0, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.4]
output:
dir: results/N0

50
configs/neural/N1.yaml Normal file
View file

@ -0,0 +1,50 @@
experiment: N1_collapse_in_weights
kind: gen_lineage
seed: 20260704
n_replicates: 5
# N1 (Layer 1.5, maps to Layer-1 E1 / blueprint C1): does model collapse appear in REAL
# trained weights under dry recursive self-training, and does a little grounding arrest it?
# An autoregressive RNN is retrained each generation on n samples drawn from the previous
# generation's RNN (drift), optionally mixed with m verifier-grounded samples. Expect: the
# dry arm (g=0) loses diversity (H falls) and forgets the tail (forward-KL to truth rises,
# tail_mass shrinks); grounded arms hold. Falsifier: dry inheritance does not degrade in
# real weights -> the neural collapse claim is unsupported at this scale.
generations: 25
synthetic:
K: 256
R: 1
tail: zipf
zipf_s: 1.3
tail_frac: 0.5
tail_threshold: 1.0e-3
init: truth
style_len: 3
style_vocab: 5
id_base: 2
model:
kind: rnn
hidden: 128
embed: 24
epochs: 25
lr: 2.0e-3
batch_size: 256
n_eval: 12000
dynamics:
n: 200
grounding: {m: 0, policy: proportional} # m overwritten per g by the sweep
remint: {enabled: false, period: null, H_gate: null}
metrics:
kl_floor: 1.0e-9
support_eps: 1.0e-9
sweep:
- param: g
values: [0.0, 0.02, 0.05, 0.1]
output:
dir: results/N1

50
configs/neural/N2.yaml Normal file
View file

@ -0,0 +1,50 @@
experiment: N2_grounding_phase_boundary_neural
kind: gen_lineage
seed: 20260704
n_replicates: 5
# N2 (Layer 1.5 headline, maps to Layer-1 E2): the grounding phase boundary in REAL weights.
# Sweep the grounding fraction g = m/(n+m) and locate the neural critical g* at which
# stationary diversity is restored. Layer 1 found g* = 0.048 << 1. The neural regime (finite
# model capacity, a smaller K so gen-0 fidelity holds) will not reproduce that value exactly
# -- the claim is directional (blueprint 3.5): a critical g* << 1 exists in trained weights,
# i.e. a little grounding protects most of the diversity. Falsifier: stationary H flat in g,
# or only restored as g -> 1.
generations: 30
synthetic:
K: 256
R: 1
tail: zipf
zipf_s: 1.3
tail_frac: 0.5
tail_threshold: 1.0e-3
init: truth
style_len: 3
style_vocab: 5
id_base: 2
model:
kind: rnn
hidden: 128
embed: 24
epochs: 25
lr: 2.0e-3
batch_size: 256
n_eval: 12000
dynamics:
n: 200
grounding: {m: 0, policy: proportional} # m overwritten per g by the sweep
remint: {enabled: false, period: null, H_gate: null}
metrics:
kl_floor: 1.0e-9
support_eps: 1.0e-9
sweep:
- param: g
values: [0.0, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2]
output:
dir: results/N2

54
configs/neural/N5.yaml Normal file
View file

@ -0,0 +1,54 @@
experiment: N5_architecture_generality
kind: gen_lineage
seed: 20260704
n_replicates: 5
# N5 (a new Layer-1.5 axis, no Layer-1 counterpart): is collapse ARCHITECTURE-GENERAL?
# Run the same dry-vs-grounded protocol across three genuinely different learners that
# share only the generative-collapse operator: the exact histogram (= Wright-Fisher, the
# analytic anchor), an autoregressive GRU (recurrent), and an autoregressive MLP (feed-
# forward). Expect the same SIGN in all: dry (g=0) loses diversity / forgets the tail;
# grounding arrests it. Falsifier: the signs appear only for the histogram -> real neural
# inductive biases break the Wright-Fisher mapping. (The sequence VAE is implemented but
# excluded here: it does not clear the gen-0 fidelity gate on the Zipf-codeword task, so
# its collapse would be confounded with underfitting; see tasks/todo.md.)
generations: 22
synthetic:
K: 256
R: 1
tail: zipf
zipf_s: 1.3
tail_frac: 0.5
tail_threshold: 1.0e-3
init: truth
style_len: 3
style_vocab: 5
id_base: 2
model:
kind: rnn # overwritten per arm by the model.kind sweep
hidden: 192
embed: 24
epochs: 25
lr: 2.0e-3
batch_size: 256
n_eval: 12000
dynamics:
n: 200
grounding: {m: 0, policy: proportional} # m overwritten per g by the sweep
remint: {enabled: false, period: null, H_gate: null}
metrics:
kl_floor: 1.0e-9
support_eps: 1.0e-9
sweep:
- param: model.kind
values: [histogram, rnn, mlp]
- param: g
values: [0.0, 0.05]
output:
dir: results/N5