Skip to content

Trainer: subsample train coverage metrics (train_metrics_every, default 10) - #9

Merged
davek44 merged 2 commits into
mainfrom
train-metrics-every
Oct 16, 2026
Merged

davek44 merged 2 commits into
mainfrom
train-metrics-every

Conversation

@davek44

@davek44 davek44 commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Train coverage r, r2 and spec are now updated on every train.train_metrics_everyth batch of each dataset (default 10; 1 restores every batch). Train loss and gene metrics still cover every batch.

Why. Train metrics are only logged, and early stopping uses them only when there is no validation data. At high track counts their per-step update is expensive. At 9-18 scale (8361 tracks × 24576 bins, batch 2), the update costs about 145 ms of a 1.61 s A100 step, roughly 9%. Spec is 55% of that and r + r2 the remaining 45%. Every 10th batch brings it under 1%, about 20 GPU-hours per 50-epoch fold. These figures were measured on a 4090 and scaled to the A100 by memory bandwidth. The in-step cost matched the standalone timing: +81 ms versus 79 ms.

Details

  • The counter is per dataset, so each dataset's first batch of every epoch is always scored. The sampler shuffles batches across datasets, so the sample can't alias with dataset order.
  • Gene metrics stay on every batch. They have no length axis, so they're cheap, and gene R² raises at epoch end on fewer than two observations, which a sparse sample could hit.
  • Runs without validation data now select model_best from sampled train metrics.

Testing

  • test_train.py and test_spec_metrics.py pass, except test_train_gene.
  • test_train_gene fails its learning-floor check (valid r < 0.1) on unmodified main too, and it also passed once on this branch, so it looks flaky.

🤖 Generated with Claude Code

davek44 and others added 2 commits October 15, 2026 21:04
…s_every, default 10)

Train loss still covers every batch. At 8361 tracks the per-step metric
update costs ~9% of an A100 training step; every 10th batch cuts it to <1%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sampled batches can hold fewer than two valid genes, and gene R2 raises on
fewer than two observations at epoch end. Gene metrics have no length axis,
so they cost little; only coverage r/r2/spec are subsampled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davek44
davek44 merged commit 417bbb8 into main Oct 16, 2026
2 of 3 checks passed
@davek44
davek44 deleted the train-metrics-every branch October 16, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant