Numerically-guarded log(1 - exp(x)) for x < 0 (x = a mean log-prob, so
exp(x) ∈ (0,1) and comfortably below 1 — average per-token logp is well
negative). Clamp 1 - exp(x) to >= eps so the log never hits -inf in the
pathological near-zero case. Caller owns the result.
Numerically-guarded log(1 - exp(x)) for x < 0 (x = a mean log-prob, so exp(x) ∈ (0,1) and comfortably below 1 — average per-token logp is well negative). Clamp
1 - exp(x)to >= eps so the log never hits -inf in the pathological near-zero case. Caller owns the result.