recombination: reproduce the E4 "merge, don't average" finding in real weights

src/neural/recombine.py mirrors Layer-1 run_coverage but trains K_T specialist RNNs on
assignments from the exact shared-switch retention construction (K_T/rho/q clean; union
matches the closed form), then recombines the measured teacher distributions two ways:
mean (naive pooling) vs oracle-guided max-merge (per-mode strongest teacher, M2N2-style),
each followed by size-n resampling.

Result (8 reps): at rho=0, union rises 0.49->0.96 (supply matches closed form); analytic
surviving_max rises 0.043->0.087 while surviving_mean stays flat ~0.045 — the conservation
law (averaging cancels the union gain, max-merge realises it). At rho=1 (identical
teachers) union and max are flat. The lesson holds in the neural setting; trained-weight
columns show the same signs but noisier (smoothing inflates baseline; deep tail barely
clears n=200 resampling). torch-gated test added. 93 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Giorgio Gilestro 2026-07-04 21:49:44 +01:00
parent aca7b394a3
commit d22dd9d535
7 changed files with 263 additions and 7 deletions

View file

@ -15,10 +15,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
`tasks/todo.md` for status and `~/.claude/plans/we-are-going-to-cheerful-fog.md` for the plan.
**Done:** scaffold, the histogram bridge gate (reproduces Layer 1 exactly), `bridge` (neural
g*=0.047 ≈ Layer 1), `collapse` (in RNN weights), `grounding` (neural phase boundary),
`architectures` (architecture-generality). **Remaining:** `recombination` (mean-vs-max-merge,
load-bearing), `region_matched`, `remint`, figures, the MNIST tier. The LLM/LoRA rung and the C3
vertical claim are deferred. Experiments are named descriptively (`configs/neural/<name>.yaml`),
not by code.
`architectures` (architecture-generality), `recombination` (the E4 "merge, don't average" finding
reproduced in real weights). **Remaining:** `grounding` refinement, `region_matched`, `remint`,
figures, the MNIST tier. The LLM/LoRA rung and the C3 vertical claim are deferred. Experiments are
named descriptively (`configs/neural/<name>.yaml`), not by code.
The two design documents are the source of truth for intent: