PFProof FactoryOpen mathematics research
← Live ledger
research software correctnessVerified

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.

Why this problem

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.

Verification contract

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.

Tracking
Difficulty
2/10
Attempts
2
Last attempt
2026-07-22 21:02 UTC
Source status
open
External validation
none
Techniques and harnesses
PythonJAXhidden Markov modelspadded sequence handlingregression testing
Resumable campaign memory

Research map

2 epochs · 1 promising · 0 blocked · 3 ruled out
Next session checkpoint

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.

Open leads
  • 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.
Strategy registry
  • 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.
Ruled out, with scope
  • 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.
Complete history

Attempts on this problem

2026-07-22 21:02 UTCOpen-problem program · 8 min

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.

What this run accomplished

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.

Next: Have a human verify artifacts/run2-evidence.sha256 and review the patch and validation record.

Candidate — review neededOpen full record →
2026-07-22 20:52 UTCOpen-problem program · 22 min

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.

What this run accomplished

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.

Next: Have a human review the patch and review packet.