MachineSex/tests
Giorgio Gilestro 8da0dac007 llm_moe: the union operator (route/max-merge) vs fusion — and the regime flips at scale
Adds the union-preserving recombination operator that llm_merge lacked (E8's max,
not mean): keep each specialist LoRA intact and SELECT the right one per prompt
(MoE router: oracle, or training-free nearest-centroid over base embeddings) or
per module (max_merge = winner-take-all by delta norm). src/llm/moe.py, kind
llm_moe, reuses the cached specialists.

Result — a clean regime boundary for "merge, don't average":
- 0.5B: union wins. Routing 0.74 / worst-family 0.43 > soup 0.64 / 0.26, with no
  dilution (recovers each specialist's own-family peak). E8's max > mean in real
  weights, because at a weak base averaging dilutes.
- 7B (Imperial CX3, L40S, 9 min): the ordering INVERTS. Fusion wins — soup 0.87 >
  routing 0.84 > max_merge 0.78. Routing is capped at the best parent per family;
  fusion blends and, given a capable base, COMPOSES beyond any parent (soup lists
  0.62 > spec 0.57). Selection can't synthesise better than its best component;
  averaging-that-composes can.

So "merge, don't average" (E4/E8) is a weak-parent / small-model law, not
universal: union wins under dilution, fusion wins under composition. Refines E8
(its additive-landscape max>mean assumed no compositional headroom). The operator
to want is fusion-that-composes + offspring selection = the directed-sex ideal
(E10) — the natural next experiment.

Honest riders: the learned router is trivially perfect (lexically-distinct
families), and router-free max_merge is the weakest union (not input-adaptive).
+2 router unit tests (127 green). Results in results/llm_moe{,_hpc}/ (parquet
gitignored per the reproducibility contract).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 17:53:47 +01:00
..
test_analysis.py Layer 1 complete: E3-E6 + E2 analysis add-ons 2026-07-04 18:54:42 +02:00
test_correctness.py Layer 1 core: Wright-Fisher knowledge-transmission model with E1-E2 2026-07-04 18:10:18 +02:00
test_dynamic_society.py society: the dynamic Lamarckian society — the vertical claim (E11 / C3) 2026-07-05 12:34:01 +01:00
test_genotype.py society: make the sexual-transmission model rigorous (E9 epistasis, E10 directed sex) 2026-07-05 11:13:37 +01:00
test_kernel.py knowledge: learning kernel — model the estimator bias, not just sampling 2026-07-05 10:23:33 +01:00
test_llm.py llm_moe: the union operator (route/max-merge) vs fusion — and the regime flips at scale 2026-07-05 17:53:47 +01:00
test_mnist.py neural: real-MNIST external-validity tier (collapse + grounding) 2026-07-05 09:19:36 +01:00
test_neural_correctness.py neural: grounding refinement + all five Layer-1.5 figures 2026-07-05 08:14:19 +01:00
test_neural_torch.py recombination: reproduce the E4 "merge, don't average" finding in real weights 2026-07-04 21:49:44 +01:00
test_neural_validation.py Layer 1.5: architecture-general neural existence proof 2026-07-04 21:02:49 +01:00
test_scientific_validation.py Layer 1 core: Wright-Fisher knowledge-transmission model with E1-E2 2026-07-04 18:10:18 +02:00