Manuscript revision and pending experiment work, snapshot before restructuring

Clarity pass over the main text (36-item audit), Discussion rewrite and cut,
acknowledgements, Souly et al. as ref 62, lettered SI panels, model section
moved under Results; plus the untracked curriculum/society/compose/smol
configs, runners, figures, stats and tests that the SI already cites.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y64o8FKP7rCuXzC48pxpMm
This commit is contained in:
Giorgio Gilestro 2026-09-13 16:54:09 +01:00
parent e4804adabc
commit 84124de143
450 changed files with 52813 additions and 1202 deletions

View file

@ -62,3 +62,16 @@ python figures/plot_llm_merge.py results/llm_merge_hpc
- **The definitive "firm up the sign" run** (not yet coded) also wants: several seeds with mean±CI;
more task families; and a dilution-resistant / offspring-selected ("directed sex") merge. `merge_hpc.yaml`
only bumps the base model for now — enough to reduce noise, but the code changes are the real fix.
## Array jobs added 2026-09-11
- `hpc/llm_curriculum_controls.pbs` — seeds 23 of the two declinable-merge controls (forced stop
`curriculum_v5_stop3`, decorrelated curriculum `curriculum_v5_decor`); ~20 min (stop3) / ~40 min
(decor, two arms) per element on one L40S.
- `hpc/llm_7b_seeds.pbs` — seeds 23 of the three 7B runs, chained merge → moe_hard → directed_hard
per element so the hard specialists are trained once; ~33 min per seed. Output lands in
`results/llm_<name>_hpc/s{seed}/` (seed 1 was moved to `s1/`; `figures/_figlib.load_seed_bundles`
reads either layout).
- Gotcha met today: the 7B base was not in `$EPHEMERAL/hf_cache`; `snapshot_download` on the login
node took 19 s. Do not detect its completion with `pgrep -f snapshot_download` from a `bash -lc`
wrapper whose own command line contains that string.

38
hpc/llm_7b_seeds.pbs Executable file
View file

@ -0,0 +1,38 @@
#!/bin/bash
# Seeds 2-3 for the three single-seed 7B runs (manuscript review 2026-09-11): llm_merge_hpc
# (Fisher-Muller), llm_moe_hard_hpc (union vs fusion, hard) and llm_directed_hard_hpc (directed
# selection, hard). One element per seed; the hard pair stays sequential because directed reuses the
# hard specialists moe trains (models/llm/spec_*_hard_s{seed}). Seed 1 took 8 + 24 min on one L40S.
# Output lands in results/llm_<name>_hpc/s{seed}/ (seed 1 was moved to s1/).
# submit: qsub hpc/llm_7b_seeds.pbs status: qstat -u $USER -t
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=01:30:00
#PBS -N lam_7b_seeds
#PBS -J 2-3
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
SEED=$PBS_ARRAY_INDEX
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
echo "seed=$SEED start=$(date)"
mkdir -p configs/llm/_gen
for NAME in merge moe_hard directed_hard; do
CFG="configs/llm/_gen/${NAME}_hpc_s${SEED}.yaml"
python - "$SEED" "$NAME" "$CFG" <<'PYEOF'
import sys, yaml
seed, name, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open(f"configs/llm/{name}_hpc.yaml"))
cfg["seed"] = seed
cfg["output"] = {"dir": f"results/llm_{name}_hpc/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
echo "== $NAME seed=$SEED $(date)"
python -m llm.experiment "$CFG"
done
echo "done: $(date)"

43
hpc/llm_compose.pbs Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
# The composition campaign (prereg tasks/prereg-llm-compose-v3.md): one (seed, arm) per array
# element. Seed 1 runs locally on the A4000 as the hedge; this array covers seeds 2-3 x 3 arms.
# Each element trains its own founders (cached per seed under models/, first writer wins via the
# adapter_config.json check) and checkpoints every generation, so a requeued element resumes.
# submit: qsub hpc/llm_compose.pbs status: qstat -u $USER -t
# index -> seed = 2 + (i-1)/3, arm = (dry grounded dry_cat)[(i-1)%3]
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=08:00:00
#PBS -N lam_compose
#PBS -J 1-6
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
ARMS=(dry grounded dry_cat)
I=$((PBS_ARRAY_INDEX - 1))
SEED=$((2 + I / 3))
ARM=${ARMS[$((I % 3))]}
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
echo "seed=$SEED arm=$ARM start=$(date)"
CFG="configs/llm/_gen/compose_s${SEED}_${ARM}.yaml"
mkdir -p configs/llm/_gen
python - "$SEED" "$ARM" "$CFG" <<'EOF'
import sys, yaml
seed, arm, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open("configs/llm/compose_s1.yaml"))
cfg["seed"] = seed
cfg["arms"] = [arm]
cfg["batch_size"] = 32 # L40S has 46 GB; the A4000 setting is 16
cfg["score_batch_size"] = 8
cfg["output"] = {"dir": f"results/llm_compose/s{seed}_{arm}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
EOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

34
hpc/llm_cull.pbs Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
# Differential reproduction in the six-generation population (manuscript revision 2026-09-12):
# configs/llm/curriculum_v5_cull.yaml (isolated + declinable society, both with culling), one element
# per seed 1-3, ~1.5 h each. Output results/llm_curriculum_v5_cull/s{seed}/.
# submit: qsub hpc/llm_cull.pbs status: qstat -u $USER -t
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=03:00:00
#PBS -N lam_cull
#PBS -J 1-3
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
mkdir -p configs/llm/_gen
SEED=$PBS_ARRAY_INDEX
echo "seed=$SEED start=$(date)"
CFG="configs/llm/_gen/curriculum_v5_cull_s${SEED}.yaml"
python - "$SEED" "$CFG" <<'PYEOF'
import sys, yaml
seed, out = int(sys.argv[1]), sys.argv[2]
cfg = yaml.safe_load(open("configs/llm/curriculum_v5_cull.yaml"))
cfg["seed"] = seed
cfg["batch_size"] = 48
cfg["train_batch_size"] = 4
cfg["output"] = {"dir": f"results/llm_curriculum_v5_cull/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

45
hpc/llm_curriculum.pbs Executable file
View file

@ -0,0 +1,45 @@
#!/bin/bash
# The curriculum society campaign (prereg tasks/prereg-llm-society-v4.md, v5 families): one (seed, arm)
# per array element, seeds 2-3 x 4 arms = 8 elements; seed 1 runs locally as the hedge. Baselines run
# once per seed in the `isolated` element (they are cheap and need no partner). Each element checkpoints
# every generation and resumes if requeued.
# submit: qsub hpc/llm_curriculum.pbs status: qstat -u $USER -t
# index -> seed = 2 + (i-1)/4, arm = (isolated society society_dry seed_bank)[(i-1)%4]
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=06:00:00
#PBS -N lam_curriculum
#PBS -J 1-8
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
ARMS=(isolated society society_dry seed_bank)
I=$((PBS_ARRAY_INDEX - 1))
SEED=$((2 + I / 4))
ARM=${ARMS[$((I % 4))]}
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
echo "seed=$SEED arm=$ARM start=$(date)"
CFG="configs/llm/_gen/curriculum_v5_s${SEED}_${ARM}.yaml"
mkdir -p configs/llm/_gen
python - "$SEED" "$ARM" "$CFG" <<'EOF'
import sys, yaml
seed, arm, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open("configs/llm/curriculum_v5_s1.yaml"))
cfg["seed"] = seed
cfg["arms"] = [arm]
cfg["baselines"] = ["sequential", "single_shot_merge", "joint"] if arm == "isolated" else []
cfg["batch_size"] = 48 # L40S: 46 GB
cfg["train_batch_size"] = 4
cfg["output"] = {"dir": f"results/llm_curriculum_v5/s{seed}_{arm}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
EOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

42
hpc/llm_curriculum_controls.pbs Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# Curriculum controls (manuscript review 2026-09-11): seeds 2-3 of (a) the forced-stop arm
# `curriculum_v5_stop3` and (b) the decorrelated curriculum `curriculum_v5_decor` (isolated + veto arms
# in one element, ~1 h). Seed 1 of each runs locally. Pairs against the existing v5 seeds 2-3.
# submit: qsub hpc/llm_curriculum_controls.pbs status: qstat -u $USER -t
# index -> seed = 2 + (i-1)/2, config = (stop3 decor)[(i-1)%2]
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=02:30:00
#PBS -N lam_ctrl
#PBS -J 1-4
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
NAMES=(stop3 decor)
I=$((PBS_ARRAY_INDEX - 1))
SEED=$((2 + I / 2))
NAME=${NAMES[$((I % 2))]}
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
echo "seed=$SEED config=$NAME start=$(date)"
CFG="configs/llm/_gen/curriculum_v5_${NAME}_s${SEED}.yaml"
mkdir -p configs/llm/_gen
python - "$SEED" "$NAME" "$CFG" <<'PYEOF'
import sys, yaml
seed, name, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open(f"configs/llm/curriculum_v5_{name}.yaml"))
cfg["seed"] = seed
cfg["batch_size"] = 48 # L40S: 46 GB (matches the v5 seeds 2-3 runs)
cfg["train_batch_size"] = 4
cfg["output"] = {"dir": f"results/llm_curriculum_v5_{name}/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

38
hpc/llm_curriculum_timing.pbs Executable file
View file

@ -0,0 +1,38 @@
#!/bin/bash
# Conflict-arrival curricula (manuscript revision 2026-09-12): seeds 1-3 x {early, early_obl, late,
# late_obl} = 12 elements. early/late = isolated + declinable society (~40 min); *_obl = obligate
# society only (~20 min). Output results/llm_curriculum_v5_<name>/s{seed}/.
# submit: qsub hpc/llm_curriculum_timing.pbs status: qstat -u $USER -t
# index -> seed = 1 + (i-1)/4, name = (early early_obl late late_obl)[(i-1)%4]
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=01:30:00
#PBS -N lam_timing
#PBS -J 1-12
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
mkdir -p configs/llm/_gen
NAMES=(early early_obl late late_obl)
I=$((PBS_ARRAY_INDEX - 1))
SEED=$((1 + I / 4))
NAME=${NAMES[$((I % 4))]}
echo "seed=$SEED config=$NAME start=$(date)"
CFG="configs/llm/_gen/curriculum_v5_${NAME}_s${SEED}.yaml"
python - "$SEED" "$NAME" "$CFG" <<'PYEOF'
import sys, yaml
seed, name, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open(f"configs/llm/curriculum_v5_{name}.yaml"))
cfg["seed"] = seed
cfg["batch_size"] = 48 # L40S: 46 GB (matches the v5 seeds 2-3 runs)
cfg["train_batch_size"] = 4
cfg["output"] = {"dir": f"results/llm_curriculum_v5_{name}/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

0
hpc/llm_directed.pbs Normal file → Executable file
View file

0
hpc/llm_hard.pbs Normal file → Executable file
View file

0
hpc/llm_merge.pbs Normal file → Executable file
View file

0
hpc/llm_moe.pbs Normal file → Executable file
View file

0
hpc/llm_smoke.pbs Normal file → Executable file
View file

25
hpc/llm_smol.pbs Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
# Second base lineage (manuscript revision 2026-09-12): merge_seeds (Fisher-Muller, 5 seeds) and
# moe_hard_seeds (headroom rule, 3 seeds) on SmolLM2-1.7B-Instruct. Pre-download the model on the login
# node first: HF_HOME=$EPHEMERAL/hf_cache uv run python -c "from huggingface_hub import
# snapshot_download; snapshot_download('HuggingFaceTB/SmolLM2-1.7B-Instruct')"
# submit: qsub hpc/llm_smol.pbs
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=02:30:00
#PBS -N lam_smol
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
mkdir -p configs/llm/_gen
echo "start=$(date)"
for NAME in merge_seeds_smol moe_hard_seeds_smol; do
echo "== $NAME $(date)"
python -m llm.experiment "configs/llm/${NAME}.yaml"
done
echo "done: $(date)"

0
hpc/llm_society.pbs Normal file → Executable file
View file

42
hpc/llm_society_v2.pbs Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# The v2 society campaign (prereg tasks/prereg-llm-society-v2.md §9): one (seed, arm) per array
# element on one L40S each, 16 elements = 4 seeds x 4 arms. Each element is self-contained: founders
# are trained inline and cached per seed (the four arm-elements of a seed share them via the
# filesystem; the first to arrive trains, the others wait on the adapter_config.json check), the loop
# checkpoints every generation and resumes, so a killed element is re-queued with the same index and
# picks up where it stopped. ~6 h per element at k_inherit=300 (prereg §9); 8 h walltime.
# submit: qsub hpc/llm_society_v2.pbs status: qstat -u $USER -t
# index -> seed = 1 + (i-1) // 4, arm = (full no_grounding no_sex no_diversity)[(i-1) % 4]
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=08:00:00
#PBS -N lam_society_v2
#PBS -J 1-16
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
ARMS=(full no_grounding no_sex no_diversity)
I=$((PBS_ARRAY_INDEX - 1))
SEED=$((1 + I / 4))
ARM=${ARMS[$((I % 4))]}
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
echo "seed=$SEED arm=$ARM start=$(date)"
# One config per (seed, arm): generated from the seed template so the resolved config is exact.
CFG="configs/llm/_gen/society_v2_s${SEED}_${ARM}.yaml"
mkdir -p configs/llm/_gen
python - "$SEED" "$ARM" "$CFG" <<'EOF'
import sys, yaml
seed, arm, out = int(sys.argv[1]), sys.argv[2], sys.argv[3]
cfg = yaml.safe_load(open(f"configs/llm/society_v2_s{seed}.yaml"))
cfg["arms"] = [arm]
cfg["output"] = {"dir": f"results/llm_society_v2/s{seed}_{arm}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
EOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

33
hpc/llm_speciation_seeds.pbs Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# Seeds 2-3 of the LLM speciation tier (manuscript revision 2026-09-12; Fig. 5C-D was single-seed).
# One element per seed; output results/llm_speciation/s{seed}/ (seed 1 moved to s1/). Adapters go to
# a seed-specific scratch dir, so the elements can run concurrently.
# submit: qsub hpc/llm_speciation_seeds.pbs status: qstat -u $USER -t
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=01:30:00
#PBS -N lam_spec_seeds
#PBS -J 2-3
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export UV_CACHE_DIR="$EPHEMERAL/uvcache"
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader
mkdir -p configs/llm/_gen
SEED=$PBS_ARRAY_INDEX
echo "seed=$SEED start=$(date)"
CFG="configs/llm/_gen/speciation_s${SEED}.yaml"
python - "$SEED" "$CFG" <<'PYEOF'
import sys, yaml
seed, out = int(sys.argv[1]), sys.argv[2]
cfg = yaml.safe_load(open("configs/llm/speciation.yaml"))
cfg["seed"] = seed
cfg["batch_size"] = 32 # L40S: 46 GB
cfg["output"] = {"dir": f"results/llm_speciation/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
python -m llm.experiment "$CFG"
echo "done: $(date)"

35
hpc/llm_veto.pbs Executable file
View file

@ -0,0 +1,35 @@
#!/bin/bash
# Veto-arm replication (prereg tasks/prereg-llm-society-v4.md §8f): the v5 `society` arm with
# "keep the parent unchanged" as an admissible offspring. Seeds 2-3 pair against the existing v5
# isolated/society/seed_bank runs for those seeds. Seed 1 ran locally.
# submit: qsub hpc/llm_veto.pbs status: qstat -u $USER -t
#PBS -l select=1:ncpus=8:mem=64gb:ngpus=1:gpu_type=L40S
#PBS -l walltime=04:00:00
#PBS -N lam_veto
#PBS -J 2-3
cd "$PBS_O_WORKDIR"
export HF_HOME="$EPHEMERAL/hf_cache"
export HF_DATASETS_CACHE="$EPHEMERAL/hf_cache/datasets"
export TOKENIZERS_PARALLELISM=false
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
source .venv/bin/activate
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
echo "seed=$PBS_ARRAY_INDEX start=$(date)"
CFG="configs/llm/_gen/veto_s${PBS_ARRAY_INDEX}.yaml"
mkdir -p configs/llm/_gen
python - "$PBS_ARRAY_INDEX" "$CFG" <<'PYEOF'
import sys, yaml
seed, out = int(sys.argv[1]), sys.argv[2]
cfg = yaml.safe_load(open("configs/llm/curriculum_v5_veto.yaml"))
cfg["seed"] = seed
cfg["batch_size"] = 48
cfg["train_batch_size"] = 4
cfg["output"] = {"dir": f"results/llm_curriculum_v5_veto/s{seed}"}
yaml.safe_dump(cfg, open(out, "w"), sort_keys=False)
PYEOF
python -m llm.experiment "$CFG"
echo "done: $(date)"