Back to the index · evidence, table by table: training length and stability
These notes concern the level stage of the model (health component, per-person frailty, PC-excluded polygenic scores; 20 signatures, 348
diseases), fitted in batches of 10,000 people. It is the first stage of the manuscript backbone; src/train_slope_3way.py adds the
polygenic age slope on top of it. The genetic level of the health component, including its sex coefficient, is estimated in this stage and then
held fixed in the manuscript model, so this stage is where it is determined. The evidence, table by table, is on the page training length and stability (notebook
notebooks/figstability.ipynb). Dated 18 November 2026. Aggregate results only.
Every setting below, from the number of epochs to the order in which parameters are learned, is tuned to the dataset, the way a learning rate or a penalty is. These notes record how we tune them on UK Biobank and how to tune them on new data.
What the manuscript used. 300 epochs per batch, without the warmup described in section 3. All 40 batch fits behind the manuscript were checked for the pattern in section 2: none is fully in that state, and two are partway.
The recipe trains for a fixed number of epochs, chosen on held-out people. That is an early stop by design. It is not convergence of the training loss.
The model writes each person's loading as lambda = reference + G * gamma + delta. The likelihood sees only lambda. The person-specific
term delta has about ten million free entries per batch and a weak prior, so it keeps fitting the training batch for as long as training
runs. The training loss therefore falls at 300 epochs, at 2,000, and beyond. That says delta is fitting the batch more closely. It says
nothing about gamma or about prediction.
Measured with the backbone trained on one batch and frozen at each epoch, the person terms refitted on a disjoint batch, and scores taken on the years after enrolment:
| epochs | training loss | held-out NLL | observed / expected | 10-year AUC (median, 28 groups) |
|---|---|---|---|---|
| 50 | 61.6 | .00942 | 2.83 | .659 |
| 150 | 54.5 | .00872 | 1.43 | .676 |
| 300 | 48.8 | .00869 | 1.11 | .679 |
| 600 | 40.6 | .00878 | 0.80 | .672 |
| 2000 | 36.0 | .00979 | 0.43 | .660 |
gamma in simulation, the non-centered fit recovers it at a correlation of about 0.95 from 100 to 600 epochs and about 0.5
by 2,000. The centered fit stays near 0.8. The figure of about 0.95 is at the early stop; training much longer does not reproduce it.Rules.
src/convergence2000_348_heldout.py), and stop where calibration is closest to 1 with held-out NLL still
on its floor.gamma as the mean over batches, with the epoch stated. Its size changes along the training path. One batch is noisy: across
batches the polygenic block correlates at about 0.2 overall and about 0.6 for its strongest cells; the mean over 39 batches has
reliability of about 0.9.A person with no diagnoses can be explained by the health component, or by a large sex coefficient that places men in one quiet signature
and women in another. Both fit the training data about equally. The health component fills late in training and gamma moves early, so
small differences decide which explanation is reached.
How to check a fit. After training, read two things from the checkpoint (src/sig_mass_one_ckpt.py, src/sig_mass_by_batch_f3way40.py):
| check | typical | warning |
|---|---|---|
norm of the sex row of gamma over the 20 disease signatures |
about 4 | above 5.5 |
| men's share of loading on the health component (mean over ages) | about 0.64 | below 0.5 |
| men's share on the male parking signature | about 0.05 | above 0.15 |
| women's share on the female parking signature | about 0.01 | above 0.05 |
The trainer src/train_nokappa_v3_inithealthy.py has an opt-in flag. With it, the sex row of gamma stays at its starting value for the
first 150 epochs and is then released; everything else, including the polygenic rows, trains as usual. The model and its likelihood are
unchanged. Without the flag the trainer behaves exactly as before.
SEX_WARMUP=150 FRAILTY=1 EXCLUDE_PCS=1 RESID_GLOBAL=1 INIT_SEED=0 \
python src/train_nokappa_v3_inithealthy.py --start_index 0 --end_index 10000 --num_epochs 375 \
--save_every 0 --learning_rate 0.1 --W 1e-4 --healthy_curve diseasefree --healthy_alpha 0.6 --hr_shift \
--healthy_ref 1.5 --healthy_genetics --gamma_health_init regress --e_matrix E_matrix_corrected.pt \
--data_dir <your data> --output_dir <your output>
Train to about 375 epochs. That is where calibration on held-out people is right under the warmup: observed over expected is 1.16 at 300, 1.03 at 350, 0.99 at 375 (on each of three random starts) and 0.96 at 400. The original recipe is calibrated at about the same point (0.99 at 400), so the warmup does not delay the fit. A fit stopped at 300, under either recipe, is not yet calibrated.
What it changed in our tests.
| original recipe | with the warmup | |
|---|---|---|
| three seeds on one batch | one in the parked state | all three agree, in training and held out |
| men's health share across six batches chosen to span the spread | 0.41 to 0.86 | 0.69 to 0.71 |
| men's share on the parking signature, same six batches | 0.01 to 0.32 | 0.02 to 0.03 |
| 10-year AUC within sex, median over 221 diseases | 0.630 | 0.630 |
| observed / expected by epoch, one batch scored on another | 1.12 at 300, 1.05 at 350, 0.99 at 400 | 1.16 at 300, 1.03 at 350, 0.99 at 375, 0.96 at 400 |
| 10-year AUC (median over 280 diseases) where calibration is right | 0.642 at 400 | 0.645 at 375 |
| three random starts at the stop: observed / expected on held-out people | 1.11, 1.10, 1.30 at 300 | 0.99, 0.99, 0.99 at 375 |
| pooled backbone of four fits, held out: observed / expected | 1.13 | 1.04 |
| pooled backbone of four fits, held out: 10-year AUC within sex, median | 0.632 | 0.631 |
| pooled backbone of four fits, held out: 1-year AUC, the manuscript's 28 groups | 0.928 | 0.950 |
| pooled backbone of four fits, held out: 10-year AUC, the manuscript's 28 groups | 0.684 | 0.679 |
| the same comparison on a second group of held-out people: observed / expected | 1.12 | 1.03 |
An alternative. Average gamma over the first-stage batch fits and refit with it held fixed (GAMMA_FREEZE_FROM=<pooled file>, built
by src/pool_backbone_348.py). Two seeds then give the same fit, and held-out prediction matches the original recipe at 300 epochs. It takes
on the quality of the fits that are averaged, so those are checked first.
What carries over and what does not. The reasoning holds on any dataset. The numbers do not.
| holds anywhere | has to be re-derived on your data |
|---|---|
| the likelihood sees only the total loading, so the training loss cannot choose the stop | the stopping epoch (here: AUC highest near 300, calibration right near 375 to 400) |
the size of gamma depends on where training stops |
the length of the warmup (150 epochs here) |
| a health component plus a covariate that marks a group can produce a group sink | how often a fit parks, and the warning thresholds in section 2 |
| compare backbones on held-out people, within sex for sex-specific diseases | the prior weight and learning rate |
Everything here was measured on UK Biobank with 348 diseases and batches of 10,000 people. A different cohort, disease list or batch size changes how quickly the health component fills and how dense the records are, and with them every number in the right-hand column. In our own experience the same recipe behaved differently with a larger disease list.
Procedure for a new dataset. About a day of compute.
gamma over batches.When applying the warmup to new data.
gamma is less than half the size it has in the
original recipe. Do not compare sex effects, or anything scaled by them, across the two.gamma still depends on the stopping epoch, and one batch's gamma is still noisy. Those are
handled by the stop and by averaging over batches.