#41042·jax

jnp.linalg.svd silently returns NaN on ill-conditioned float64 with nvidia-cusolver 12.2.6.9 (gesvdj)

Author: yingjerkaoCreated Sep 28, 2026Updated Sep 28, 2026

Description

On CUDA with jax_enable_x64, jnp.linalg.svd silently returns all-NaN output (U, s and Vh, and also with compute_uv=False) for ill-conditioned float64 matrices when the installed nvidia-cusolver wheel is 12.2.6.9. It raises no error and no warning.

I believe the root cause is a cuSOLVER gesvdj convergence regression that exists only in that release. JAX then turns info != 0 into NaN. The versions around it are clean:

jaxlib nvidia-cusolver NaN results / 90
0.10.2 12.3.4.7 0
0.10.1 12.3.4.7 0
0.10.2 12.2.6.9 42
0.10.1 12.2.6.9 42
0.10.2 12.2.2.18 0
0.10.1 12.3.2.15 0

These results are from an A100-SXM4-80GB with driver 580.126.20 and the jax[cuda13] wheels, varying only the nvidia-cusolver pin. jaxlib makes no difference. On an RTX 4070 Ti SUPER with cusolver 12.1.0.51 (cuda13 wheels) or nvidia-cusolver-cu12 11.7.5.82, all cases are also clean.

jax-cuda13-plugin requires nvidia-cusolver>=12.0.3.29, so 12.2.6.9 still satisfies the constraint. An environment whose other packages hold the CUDA 13.2-era libraries resolves to it and gets NaN from every ill-conditioned SVD. In tensor-network code, for example, that is every CTM, TRG and HOTRG step.

Failure signature (90 cases: 45 matrices × {full SVD, compute_uv=False}):

  • Fails: smooth log-spaced spectra spanning ≳1e15 at n ≥ 64 (cond 1e15, 1e16, 1e18, 1e30, general and symmetric), plus cond 1e16 at n = 16.
  • Clean: cond 1e12, exactly rank-deficient matrices, and a two-cluster spectrum (half ones, half 1e-17). So tiny singular values alone don't trigger it; the smooth decay across the whole range does.
  • Both full_matrices=False and compute_uv=False fail.

Minimal repro

python
import jax
jax.config.update("jax_enable_x64", True)
import jax.numpy as jnp, numpy as np, importlib.metadata as md

d = jax.devices()[0]
print(jax.__version__, d.device_kind, "cusolver", md.version("nvidia-cusolver"))
rng = np.random.default_rng(0)
n = 128
Q = np.linalg.qr(rng.standard_normal((n, n)))[0]
A = (Q * np.logspace(0, -16, n)) @ Q.T          # symmetric, cond ~ 1e16
U, s, Vh = jnp.linalg.svd(jnp.asarray(A), full_matrices=False)
print("NaN:", [bool(np.isnan(np.asarray(x)).any()) for x in (U, s, Vh)])
print("s[:3]:", np.asarray(s)[:3], "numpy:", np.linalg.svd(A, compute_uv=False)[:3])

With nvidia-cusolver==12.2.6.9 this prints NaN: [True, True, True]. With 12.2.2.18 or 12.3.x it matches NumPy.

Workaround: jax.lax.linalg.svd(A, algorithm=jax.lax.linalg.SvdAlgorithm.QR) (gesvd) converges on the same inputs.

Suggestions

  1. Exclude the bad release in the CUDA extras, e.g. nvidia-cusolver>=12.0.3.29,!=12.2.6.9, or raise the floor past it.
  2. Consider warning, or falling back to the QR (gesvd) path, when gesvdj reports non-convergence, instead of silently NaN-filling. A NaN SVD that raises no error is hard to trace back to the solver.

System info

  • jax / jaxlib 0.10.1 and 0.10.2, jax-cuda13-plugin / jax-cuda13-pjrt to match
  • NVIDIA A100-SXM4-80GB, driver 580.126.20, Linux, Python 3.11
  • nvidia-cusolver 12.2.2.18 / 12.2.6.9 / 12.3.2.15 / 12.3.4.7, as in the table