Repository navigation
fix(messages): keep the full covariance through coupled transforms in from_mode - #1572
Merged
Merged
Conversation
… from_mode (#1569) `TransformedMessage.from_mode` reduced a LinearOperator covariance to its diagonal before applying the transform Jacobians, so a coupled Jacobian (MultinomialLogitTransform's ShermanMorrison, used by MultiLogitNormalMessage) contracted the vector as J(Jᵀv) instead of diag(J Σ Jᵀ): operator inputs gave [2.3611, 2.1875] where the equivalent ndarray gave [1.2222, 1.2431]. Keep the dense matrix through the Jacobian loop when transforms are present; take the diagonal only in the no-transform case. Scalar transforms are unchanged. Pre-#1560 this path raised; #1560 made it silently wrong. Codex review of the phase-2 fixes, finding 3. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gu4YysuvpQ4k6zkQjiwabd
Jammy2211
deleted the
feature/transformed-from-mode-coupled-covariance
branch
September 7, 2026 21:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1569. Finding 3 of the Codex review of the phase-2 EP fixes (#1560 introduced the path; umbrella #1405).
Problem
TransformedMessage.from_modereduced aLinearOperatorcovariance to its diagonal before pushing it through the transform Jacobians.jac.quadcontracts a 1-D argument as a vector,J(Jᵀv), not asdiag(v), so a coupled Jacobian (MultinomialLogitTransform'sShermanMorrison, used byMultiLogitNormalMessage) lost the off-diagonalJ Σ Jᵀmass that belongs on the diagonal. Pre-#1560 this path raised; #1560 made it silently wrong. Scalar transforms have diagonal Jacobians where both contractions coincide, which is why every campaign test passed.Fix
Keep the dense matrix (
to_dense(), the existing accessor) through the Jacobian loop when transforms are present; take the diagonal only in the no-transform case. No new methods, no guards.Impact
Defensive path only: the sole in-library caller,
MeanField.from_mode_covariance, passes dense ndarrays.MultiLogitNormalMessagehas no workspace usage.API Changes
None.
Tests
test__coupled_jacobian_keeps_the_full_covarianceintest_autofit/messages/test_transformed_from_mode.py: operator forms match the ndarray form (rel 1e-6) and the ndarray form matches an independent delta-methoddiag(J Σ Jᵀ)(rel 1e-4), over a diagonal and a non-diagonal Σ.test_autofit/messages: 95 passed.test_autofit/graphical: 265 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Gu4YysuvpQ4k6zkQjiwabd