Skip to content

Fix JAX multivariate-normal PSD validation - #5380

Merged
FlorianPfaff merged 1 commit into
mainfrom
fix/jax-mvn-psd-validation
Aug 21, 2026
Merged

Fix JAX multivariate-normal PSD validation#5380
FlorianPfaff merged 1 commit into
mainfrom
fix/jax-mvn-psd-validation

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

Fix the JAX random backend's eager covariance validation for multivariate_normal.

The existing JAX CI regression

tests/backend/test_jax_random_multivariate_normal_validation.py::test_multivariate_normal_rejects_invalid_covariance_geometry[bad_cov3-cov must be positive semidefinite]

fails on the current main-based JAX matrix because the indefinite covariance diag(1, -0.1) is not rejected.

Root cause / fix

_validate_multivariate_normal_cov used JAX allclose and eigvalsh for checks that are immediately converted to Python booleans. This is an eager validation path rather than a traced numerical kernel, and relying on JAX linear algebra here makes validation sensitive to backend/runtime behavior.

Convert the already validated finite covariance to a host NumPy array and perform the symmetry and eigenvalue checks with NumPy. Sampling and returned arrays remain JAX-backed.

The existing 1e-8 PSD tolerance and validation messages are unchanged.

Evidence

The failure is present in the existing Python 3.12 and 3.13 JAX CI artifacts from current-main-based PR #5379. The repository already contains the exact regression test, so no duplicate test was added.

Scope

  • based directly on main at b7d3edc9ac05600de5345dc20fd6f3db33154d86;
  • one production file changed;
  • 4 additions / 3 deletions;
  • no matching open PR found for this PSD-validation failure.

@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 7.24s
✅ JSON prettier 7 0 0 0 0.99s
✅ JSON v8r 7 0 0 5.27s
✅ MARKDOWN markdownlint 68 0 0 0 1.98s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.44s
✅ PYTHON black 1989 15 0 0 65.59s
✅ PYTHON isort 1989 28 0 0 2.96s
✅ REPOSITORY betterleaks yes no no 1.23s
✅ REPOSITORY checkov yes no no 34.45s
✅ REPOSITORY git_diff yes no no 0.14s
✅ REPOSITORY secretlint yes no no 103.93s
✅ REPOSITORY syft yes no no 2.98s
✅ REPOSITORY trivy-sbom yes no no 3.44s
✅ YAML prettier 11 0 0 0 0.61s
✅ YAML v8r 11 0 0 17.63s
✅ YAML yamllint 11 0 0 1.05s

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE_CHECKMAKE. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.0.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 21, 2026 06:36
@FlorianPfaff
FlorianPfaff merged commit ad02794 into main Aug 21, 2026
15 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant