Code and data associated with "The evolution of sex for artificial intelligence - A population-genetic framework for multigenerational model populations". Gilestro, 2026
Find a file
Giorgio Gilestro e4804adabc SI: adopt the clearer rewrite, with factual corrections; fix two build bugs it exposed
Prose: adopted the simplified rewrite for the Reproducibility preamble, SI
Text S1 and S2, and the two tables. It reads better - shorter sentences, no
shouty caps, no self-commentary in the proposition headings.

Fact-checked against the artifacts before adopting. Corrections:
- Table S2 said grounding retention used "18+ replicates per point". E2 uses
  100 lineages; 18 is the *neural* grounding sweep. (Pre-existing error,
  faithfully carried over by the rewrite.)
- The emergent parents' 0.535/0.474 are the accuracies at the LONGEST
  divergence (t_div=3200), not overall means (0.595/0.545); now qualified.
  Verified merge holds 0.954-0.956 at every divergence, residual exactly
  0.000 in both emergent conditions.
- Dropped an invented run date (2026-08-11; the run is from 2026-09-06) and
  an internal project-phase reference ("Phase 3").
- The llm_speciation duration question is no longer open - it ran, and found
  no isolation from over-training (1-12 epochs); text updated.
- Restored the confidence-weighting numbers the rewrite dropped: paired
  bootstrap contrast |rho| = -0.021, CI [-0.130, +0.059] (re-derived), plus
  the nuance that the weighting does sharpen the level contrast.
- "Minimal model" -> "biological model"; "LLM tier in progress" -> done.
- Trimmed an unverifiable citation ("neuron-identifiability approaches...")
  to the reference the bibliography actually carries.

Two rendering bugs the LaTeX version exposed, both pre-existing:
- Greek and several math symbols were absent from build.py's unicode map, so
  alpha and epsilon were rendering as missing-glyph boxes in the SI. Added
  Greek, set membership, superscripts, proper minus. Both PDFs now contain
  zero missing glyphs.
- inline() split on code spans BEFORE applying emphasis, so any italic
  containing `code` was torn into fragments - visible in the main text as a
  literal "is*" and mis-scoped italics on p. 3. Code spans are now stashed
  behind sentinels first. This fixed the manuscript, not just the SI.
- A leading markdown H1 leaked into the body as literal text; the wrapper
  supplies the title, so it is now skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BkRLcc18rwT2Lysu6PbG7v
2026-09-07 17:13:02 +01:00
configs llm_society campaign: 4 seed-configs (N=8, G=10, 4 arms) + CX3 PBS array 2026-09-07 13:59:32 +01:00
figures third review round: mathematical corrections + operator separation + headline calibration 2026-09-06 19:29:09 +01:00
hpc llm_society campaign: 4 seed-configs (N=8, G=10, 4 arms) + CX3 PBS array 2026-09-07 13:59:32 +01:00
notebooks Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
paper SI: adopt the clearer rewrite, with factual corrections; fix two build bugs it exposed 2026-09-07 17:13:02 +01:00
results third review round: mathematical corrections + operator separation + headline calibration 2026-09-06 19:29:09 +01:00
src llm_society pilot v1 diagnosis + v2 knobs: raise inheritance fidelity, add elitism 2026-09-07 12:38:15 +01:00
tasks Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
tests llm_society: the composed society at LLM scale (C3) — loop, tests, smoke green 2026-09-07 11:55:19 +01:00
.gitignore neural: real-MNIST external-validity tier (collapse + grounding) 2026-07-05 09:19:36 +01:00
.python-version Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
CLAUDE.md hard benchmark: the 7B "fusion wins / no headroom" results were saturation artefacts 2026-07-05 19:13:26 +01:00
Makefile SI Methods: a full experimental-procedures appendix 2026-09-07 16:04:52 +01:00
pyproject.toml Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
README.md Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
reproduce.sh Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
REPRODUCING.md Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00
uv.lock Reproducibility pass: figure map, one-command reproduce.sh, notebooks, Makefile gaps 2026-09-07 15:50:50 +01:00

The evolution of sex for artificial intelligence

A population-genetic framework for multigenerational model populations. Knowledge transmission between generations of learning agents is modelled literally as a WrightFisher process, not by analogy: a model's knowledge is a distribution p_t over K discrete items, a fixed true distribution p* has a rare tail, and each generational step is "sample from the parent (drift) + mix in fresh real samples (grounding/immigration) + refit". Model collapse is the loss of rare alleles under drift — and the remedies population genetics knows for drift (immigration, recombination, selection, population structure) become engineering levers for model populations.

The framework is developed at three tiers of increasing realism:

Tier What it is Hardware
Biological model WrightFisher simulator over knowledge distributions; closed forms, bitwise reproducible laptop
Trained networks RNN / MLP / VAE on a synthetic mode universe with an exact oracle; convolutional VAE on MNIST one GPU
Language models LoRA specialists on Qwen2.5-Instruct (0.5B / 7B) with an exact-match verifier one GPU / L40S

Reproduce

Start here: REPRODUCING.md — the authoritative map from every manuscript figure panel back to the artifact, config, and seed that produced it, plus the determinism policy and artifact-hash verification.

curl -LsSf https://astral.sh/uv/install.sh | sh   # one-time, if needed

./reproduce.sh          # env -> tests -> biological-model tier at committed seeds -> figures
./reproduce.sh --with-gpu   # ... and the trained-network + language-model tiers

Or tier by tier:

make env             # build .venv from the committed, hash-pinned uv.lock
make test            # correctness + closed-form scientific validation (the spine of trust)
make layer1          # the biological model: E1-E12, E14, learning kernel
make figures         # per-experiment figures, from committed parquets (no re-simulation)
make paper-figures   # the manuscript's Fig. 1-7 + rebuild the PDF body

make help is not defined, but every target carries a ## description — grep '##' Makefile.

Notebooks

make env-notebooks && jupyter lab notebooks/
  • 01_biological_model.ipynb — builds the WrightFisher model from scratch, checks it against the closed forms (geometric diversity decay, the immigrationdrift equilibrium), and derives the grounding threshold and its per-item observation floor. Runs on a laptop in under a minute.
  • 02_paper_figures.ipynb — verifies artifact hashes, then regenerates and displays every manuscript figure from the committed artifacts.

Layout

src/knowledge/   biological-model tier (imported as `knowledge`)
src/neural/      trained-network tier
src/llm/         language-model tier
configs/         one YAML per experiment: layer1/ neural/ llm/ (each declares its master seed)
figures/         plot_*.py — per-experiment diagnostics, read results.parquet only
paper/pnas/      the manuscript: main.md, make_figs.py (Fig. 1-7), build.py, si.md
notebooks/       executable walkthroughs
hpc/             PBS job scripts for the 7B tier (Imperial CX3)
tests/           correctness + test_scientific_validation.py (the closed forms as assertions)
results/         run artifacts: results.parquet (gitignored) + resolved_config.yaml + manifest.json

Design documents: paper/blueprint.md (the normative build spec) and paper/results-summary.md (plain-language + technical summary of every result).

The engineering contract

  • Reproducibility is a requirement, not a preference. The environment is a uv venv built from a committed, hash-pinned uv.lock; the biological-model tier is bitwise reproducible from a single master seed, and the GPU tiers are statistically reproducible with per-seed points reported.
  • One master seed per config, with all sub-randomness derived via SeedSequence.spawn. No code touches global RNG state; a run is a pure function of its resolved config.
  • No magic numbers in code. Every parameter lives in a YAML resolved at run time, and the resolved config is written next to the results.
  • Every run writes the same triple: results.parquet + resolved_config.yaml + manifest.json (seed, git commit, library versions, row count, SHA-256 of the results).
  • Every figure is a pure function of a committed artifact — figure scripts never re-simulate.
  • The scientific-validation tests are the spine of trust. They assert that the simulator reproduces the closed forms to within 0.5%. If they fail, the science is wrong, not just the code.