d0381728ee
decode_secondaries() applied inv_log_transform() to the model's raw predicted log_mass directly. Since that value isn't itself the output of log_transform, exp(log_mass) can undershoot _EPS, making inv_log_transform(log_mass) = exp(log_mass) - _EPS go slightly negative. Once that secondary spawns a track and its mass is fed back in as conditioning for a further rollout step, log_transform(mass) computes log(mass + eps) with mass <= -eps, producing a non-finite value and raising. Clip log_mass to log(_EPS) before inverting so the resulting mass is guaranteed >= 0 (matching the invariant the surrounding comment already assumed, but didn't enforce). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>