$ the-wire · showcase
JAX stats functions learn to propagate NaN, python-genai resumes streaming after mid-stream cutoffs
By RepoJournal · Filed · About Google · Composed from the cited sources · methodology
Two quiet correctness days: JAX's scipy.stats wrappers stop silently swallowing NaN and stop dropping batch dimensions, while python-genai hardens streaming continuation around checkpoints, finish reasons, and token accounting.
[jax] Propagate NaN in jax.scipy.stats.uniform and truncnorm google/jax
by Jake VanderPlas
Several uniform and truncnorm functions used to turn NaN inputs into finite values, because `jnp.select` fell through to its default of 0 or support masks were applied after the NaN had already been dropped; Jake VanderPlas notes that `uniform.pdf(nan)` returned 1.0 and `truncnorm.cdf(nan, -1, 2)` returned 1.0. The fix changes `uniform.cdf` to `clip((x - loc) / scale, 0, 1)`, which propagates N...
[jax] Fix multinomial.logpmf/pmf for batched x and n google/jax
by Jake VanderPlas
`jax.scipy.stats.multinomial.logpmf` had two batched-input bugs: it tested support with `jnp.sum(x)`, reducing over all axes instead of only the category axis, so every row returned `-inf`; and it called `promote_args_numeric("multinomial.logpmf", x, n)`, which attempts to shape-broadcast `x` of shape `(..., k)` against `n`. If you have been seeing all-`-inf` logpmf on batched inputs, this is why.
[pallas:fuser] Fixed inverted last-dimension index check in `_reshape_pull_rule` google/jax
The Pallas fuser's `_reshape_pull_rule` checked `not isinstance(last, int) and last != 0`, which skipped the zero check for Python `int` indices and raised `TracerBoolConversionError` when `last` was a JAX tracer. The last-dimension index check is now the right way round.
fix: resume streaming generation from the latest checkpoint continuation token on mid-stream errors or cutoffs googleapis/python-genai
Streaming generation now resumes from the latest checkpoint continuation token when a stream errors or is cut off mid-flight, rather than dropping the partial response.
fix: clear intermediate CONTINUATION finish_reason in streaming continuation googleapis/python-genai
Intermediate CONTINUATION finish reasons are cleared as a stream progresses, so callers only see the final reason rather than a synthetic one from a mid-stream hop.
feat: accumulate streaming continuation usage metadata and expose initial_prompt_token_count googleapis/python-genai
Continuation usage metadata now accumulates across streaming continuations, and `initial_prompt_token_count` is exposed, giving a direct read on prompt tokens before continuation work begins. Related coverage on the long tail: the `Chat` class now delegates continuation handling straight to `Models` rather than reimplementing it, and billable token count fields were added alongside the usage me...