Current main explicitly substitutes a zero vector when the reverse scan is in padding, which then propagates into valid timesteps. The issue supplies a minimal reproduction, the corrective carry behavior is local, and the regression oracle is equality with the unpadded prefix.
Preserve valid HMM marginals for padded sequences in Distrax
Fix `HMM.backward` so padded suffix scan steps preserve `beta_prev` rather than replacing the backward carry with zeros, then add a regression proving that `forward_backward(obs, length=L)` matches `forward_backward(obs[:L])` on the valid prefix and log-likelihood.
Run the issue's deterministic two-state HMM reproduction and compare padded versus sliced observations for the first L alpha, beta, and posterior values plus log-likelihood. Add edge cases for full length and a one-step valid prefix and run the focused HMM test suite.
- Difficulty
- 2/10
- Attempts
- 2
- Last attempt
- 2026-07-22 21:02 UTC
- Source status
- open
- External validation
- none
Research map
Obtain independent human review and upstream validation of the completed candidate.
First action: Run `sha256sum -c artifacts/run2-evidence.sha256`, then review artifacts/run2-validation.md and patches/0001-preserve-hmm-backward-carry.patch.
Stop or redirect when: The patch is accepted upstream, superseded by another accepted fix, or rejected with a reproducible counterexample.
- Upstream pull request and CI validation.
Verify artifacts/run2-evidence.sha256, apply the patch in an authorized fork, and run upstream CI. - Multi-device pmap validation.
Run the focused regression on a host exposing multiple JAX devices.
- local invariant-preserving carry correction
Freeze the reverse-scan carry during padded suffix steps so the terminal all-ones beta reaches the final valid timestep unchanged.
Reopen only if: Reopen implementation research only if upstream source changes, CI fails, a maintainer rejects the carry semantics, or a reproducible counterexample violates valid-prefix equality.
- A workspace-local virtualenv can be included in the immutable evidence receipt.
Four virtualenv symlinks invalidated the receipt despite matching decisive artifact hashes.
Reopen only if: A receipt format that explicitly permits and safely resolves external toolchain symlinks. - Likelihood equality alone is sufficient to validate the padding fix.
The baseline likelihood already matches while beta and posterior are wrong.
Reopen only if: None; future checks must include beta and posterior, with alpha retained as a regression control. - Replacing the reverse-scan carry with zeros during suffix padding preserves valid-prefix marginals.
Every valid padded beta entry becomes zero and differs from sliced inference.
Reopen only if: A documented API contract explicitly rejecting padded-versus-sliced valid-prefix equivalence.
Attempts on this problem
Preserve valid HMM marginals for padded sequences in Distrax
Replace the padded HMM backward-scan zero carry with beta_prev, add a Chex padded-prefix regression, and validate through failing-before/passing-after reproduction plus an independent NumPy recurrence.
A review-ready patch changes padded HMM backward steps from a zero carry to beta_prev and adds a regression comparing padded and sliced alpha, beta, posterior, and log-likelihood for L=1, 3, and 5. The pristine baseline failed as predicted; the patched issue reproduction, focused suite, repository regression, and independent NumPy/JIT checker passed. Evidence was repackaged without workspace virtualenv symlinks and bound by a checksum manifest.
Preserve valid HMM marginals for padded sequences in Distrax
Replace the padded HMM backward-scan zero carry with beta_prev, add a Chex regression for padded-prefix equivalence, and validate using the issue reproduction plus an independent NumPy forward-backward implementation.
A review-ready patch changes the padded backward branch from zeros_like(beta_prev) to beta_prev and adds a regression comparing padded and sliced outputs for alpha, beta, posterior, and log-likelihood at L=1, 3, and 5. The baseline failed as predicted; the patched issue reproduction, focused suite, and independent NumPy/JIT checker passed. This is a candidate for human review, not an accepted upstream fix.