You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
read crashes in GradSNR.observe when the set of parameters with gradients changes between steps #19
self.m is sized by the first observed set. On a later step where a different subset of trunk parameters received grads, flat has a different length and the EMA update raises:
RuntimeError: The size of tensor a (333697) must match the size of tensor b (333568) at non-singleton dimension 0
Reproduced on unmodified main (efd4a16): train.py --device cpu read <corpus-dir> --weights-dir <dir> --save dies early into a multi-subject read once the active gradient set varies (the delta in my config was 129 elements — consistent with intermittently-used params such as deeper sampled rows / halting-adjacent tensors).
Since recurrence depth is sampled during training (mean 3.87 of 6 rows in my run), intermittent-grad parameters are the norm, not a corner case — any long read eventually hits this. The SNR is explicitly report-only ("Reported, not acted on"), so telemetry ends up killing training.
Minimal fix sketch that keeps semantics — reset the EMA when the observed set changes size:
Hit this too during a replication run. The varying element is the halting head: halt.weight + halt.bias = d_model + 1 elements. That's your 129 at d_model 128, and 257 at d_model 256 for me. A step whose sampled depth is 1 forces lam = 1 on the only row, so the halting head gets no gradient that step. At the shipped train_steps_mean 12.8 that's ~3e-6 per step, but at smaller depths it's routine (~1.4% of steps at mean 4.3).
I'd suggest zero-filling rather than resetting the EMA. A missing grad is a zero grad for that step, and a reset would throw the meter's history away on every depth-1 step:
Since you offered to PR this, I hope you don't mind that I've opened #20 with the zero-fill version plus a regression test. It credits your report, and it ran ~8 GPU-hours of read without issue. If you'd rather land your own, I'm happy to close it.
Thanks — your root-cause analysis is sharper than mine. The depth-1/lam=1 mechanism explains the intermittency precisely, and zero-fill is the right fix: a missing grad is a zero grad for that step, while my local workaround (resetting the EMA on shape change) threw the meter's history away on every depth-1 step.
Please keep #20 — there's nothing worth landing from my side. If it merges, a Co-authored-by trailer would be appreciated, since the repro and diagnosis came from our run.
Activity
dreddnafious commentedon Sep 23, 2026
Hit this too during a replication run. The varying element is the halting head:
halt.weight+halt.bias= d_model + 1 elements. That's your 129 at d_model 128, and 257 at d_model 256 for me. A step whose sampled depth is 1 forceslam = 1on the only row, so the halting head gets no gradient that step. At the shippedtrain_steps_mean12.8 that's ~3e-6 per step, but at smaller depths it's routine (~1.4% of steps at mean 4.3).I'd suggest zero-filling rather than resetting the EMA. A missing grad is a zero grad for that step, and a reset would throw the meter's history away on every depth-1 step:
Since you offered to PR this, I hope you don't mind that I've opened #20 with the zero-fill version plus a regression test. It credits your report, and it ran ~8 GPU-hours of
readwithout issue. If you'd rather land your own, I'm happy to close it.nekomario28 commentedon Sep 23, 2026
Thanks — your root-cause analysis is sharper than mine. The depth-1/lam=1 mechanism explains the intermittency precisely, and zero-fill is the right fix: a missing grad is a zero grad for that step, while my local workaround (resetting the EMA on shape change) threw the meter's history away on every depth-1 step.
Please keep #20 — there's nothing worth landing from my side. If it merges, a
Co-authored-bytrailer would be appreciated, since the repro and diagnosis came from our run.fix volotat#19: count a missing gradient as zeros in GradSNR.observe