-
New features
- Added
jax.scipy.special.erfcinvfor the inverse complementary
error function. - Added
jax.lax.polynomialfor polynomial evaluation. The polynomial
primitive is faster and uses less memory when computing gradients. - Added
jax.custom_vjp.defremat, which customizes how a
jax.custom_vjpfunction is rematerialized when it's differentiated
underjax.remat. It requires thejax_custom_vjp3andjax_remat3
implementations. - Added a
rematoption tojax.custom_gradient, for writing
jax.custom_vjp.defrematrules with closures. -
arr.at[...].get()now accepts astrategyargument that allows choosing
whether the operation lowers togather,dynamic_slice, orslice. - Added a
generic_batchingoption tojax.custom_vjp.defvjp, for
batching underjax.vmapwhen a primal output is shared across the
batch. Seejax-301-vmap-shared-outputs. -
jax.nn.get_scaled_dot_general_configaccepts'mxfp4': E2M1
elements with one E8M0 scale per block of 32, for
jax.nn.scaled_dot_general. The quantization is executed natively
on AMD gfx950 GPUs and by a dequantize-and-dot fallback elsewhere. - JAX now registers a
proxybackend, which connects to an IFRT Proxy server
such as Pathways on Cloud.
To use it, setJAX_PLATFORMS=proxyand setJAX_BACKEND_TARGETto the
server address, e.g.grpc://localhost:29000. - Added
jax.sharding.no_collectives, a context manager that raises an
error at trace time in explicit sharding mode if an operation or
jax.sharding.reshardintroduces a collective across any specified
mesh axis. - Added
jax.custom_vjp.defremat_with_logs, allowing
jax.custom_vjp.defrematrules (andjax.custom_gradientwith
remat=Trueandwith_logs=True) to log values from the backward pass
(#40956). -
jax.scipy.linalg.eighnow supports generalized Hermitian
eigenproblems (b != None) for problem typestype=1,2, and3
(#41162, #41197). - Added
jax.profiler.ProfileSessionand
jax.profiler.export_profile_datafor session- and
context-manager-based profiling. - Added
jax.experimental.layout.Layout.for_arrayto query the default
device layout for an array. - Added a
strict_in_outargument tojax.experimental.program_order
to place optimization barriers on the first input and/or last output of the
scope. - Added
jax.experimental.thunkyfor authoring, inspecting, splicing,
and executing XLA:GPUThunkExecutorprograms directly from Python. - Added JVP rule for
jax.lax.nextafter, enabling forward- and
reverse-mode autodiff throughnextafter(#38679). - Widened
jax.random.ball'spparameter type fromfloatto
RealArray, allowing array-valued norm orders (#41546). - Added support for DLPack 1.0 (
DLManagedTensorVersioned) and read-only
DLPack tensors (#40789). - [oneAPI GPU] Added SYCL/oneMKL kernels for
jax.lax.linalg.lu_pivots_to_permutation,
jax.lax.linalg.cholesky_update,
jax.lax.linalg.tridiagonal_solve(withperturb_singular=True),
jax.lax.linalg.tridiagonal(sytrd/hetrd), symmetric rank-$k$
updates (syrk), andscaled_matmul, and setjax_oneapi_visible_devices
injax.distributed.initialize. - [ROCm] Added
gfx1250to the default target architectures in ROCm builds
(#40877).
- Added
-
Breaking changes
- Removed
jax.custom_remat. Usejax.custom_vjp.defrematinstead:
custom_remat(f, f_fwd, f_rem, f_bwd)becomesf = jax.custom_vjp(f)
followed byf.defremat(f_fwd, f_rem, f_bwd). - On x86-64, JAX and
jaxlibnow require an Intel Haswell or newer CPU
(roughly 2013 onwards, requiring AVX2 and FMA support). Older CPUs that
only support AVX are no longer supported, though you can still build from
source for older CPUs. -
jax.numpy.atleast_1d,jax.numpy.atleast_2d, and
jax.numpy.atleast_3dnow return tuples of arrays rather than
lists, matching the behavior in NumPy 2.0+. - The
shapeargument ofjax.random.multinomialis now the batch
shape, as documented and as in NumPy: the result has shape
(*shape, p.shape[-1]). Previouslyshapehad to include the outcome
axis. Code that passed the full output shape should drop its last entry. - Under
jax.vmap, ajax.custom_vjpfunction with a primal
output that doesn't depend on any batched input could get gradients that
counted that output's cotangent once per example. That case now raises an
error explaining how to resolve it, for example with the new
generic_batchingoption. Seejax-301-vmap-shared-outputs. - Dropped support for NumPy 2.1; JAX now requires NumPy 2.2 or newer.
-
jax.numpy.crossno longer accepts 2D vector inputs, completing a
deprecation started in JAX 0.11.0 (#40876). - The
copy,order, andndminarguments tojax.numpy.arrayare
now keyword-only, completing a deprecation started in an earlier release
(#40878). -
jax.profiler.ProfileOptionsnow raisesAttributeErrorwhen
unknown attributes are assigned to it. -
jax.checkpoint,jax.custom_vjp, andjax.shard_map
now raise an error if the sameRefis passed as more than one argument or
is both closed over and passed as an argument.
- Removed
-
Deprecations
-
jax.lax.psendandjax.lax.precvare deprecated.
-
-
Changes
- Improved the numerical accuracy of
jax.scipy.special.ndtriand its
derivatives by replacing the piecewise rational approximations with
minimax polynomial approximations and a custom JVP rule. - JAX now uses Bazel 9.2.0 to build from source.
- Improved the numerical accuracy of complex
jax.numpy.absand
jax.lax.absby lowering through power-of-two scaledhypot. - Improved the numerical accuracy of
jax.numpy.hypotand its
derivatives by replacing the division-based formula with power-of-two
scaling and a custom JVP rule, avoiding rounding errors for large inputs.
The derivative at(0, 0)now returnsNaN(previously±0.5). - Improved the numerical accuracy of
jax.numpy.sincacross all
floating-point types (to $\le 0.5$ ULP forbfloat16andfloat16,
$\le 2.5\text{–}4.0$ ULPs forfloat32, and $\ge 2.0$ ULPs forfloat64). -
jax.numpy.ldexpandjax.numpy.frexpare now bit-exact for
normal floating-point numbers, replacing floating-point arithmetic with
bitwise operations. Subnormal inputs and underflowing outputs are flushed to
signed zero. - Several
jax.numpyfunctions are now implemented in terms of HiJax
primitives (seejax-301-hijax-types). This includes
~jax.numpy.searchsorted,~jax.numpy.nonzero,
~jax.numpy.ldexp,jax.numpy.frexp. Typical users should not
see any change in behavior, but you may notice more efficient batching
and autodiff, and more concise representations in jaxprs. - The "web" debugger now defaults to hostname "localhost", which is a safer
default that avoids inadvertently opening a port to the world. -
jax.numpy.lexsortwith many keys now uses a batched approach by
default, controlled by the newbatch_sizeparameter (which defaults to
16). This avoids long compile times for sorts with many keys. Fixes the
poor performance ofjax.numpy.uniquefor high-dimensional arrays
(#17370). - Reimplemented
jax.scipy.special.erfcxand added
accuracy=jax.lax.AccuracyMode.HIGHESTsupport forjax.lax.erfc,
improving worst-casefloat32accuracy to $\le 3.5\text{–}5.5$ ULPs across
CPU, GPU, and TPU (and $\le 2.5\text{–}3.0$ ULPs infloat64) with accurate
first- and higher-order derivatives. - Improved
float32accuracy ofjax.lax.lgamma
(jax.scipy.special.gammaln) to $\le 4$ ULPs across CPU, GPU, and TPU
(#21284). - Improved
float32andfloat64accuracy ofjax.lax.expm1on CPU to
$< 1$ ULP, and tightenedexpm1andlog1pfloat32accuracy on TPU v5p,
v6e, and 7x (withlibtpu >= 0.0.50). - Improved precision of
jax.lax.asinfallback expansions near zero
under flush-to-zero mode. -
jax.scipy.special.betaincnow stops its continued fraction iteration
per element as each element converges rather than running until all batch
elements converge (#28547). -
jax.pure_callbackandjax.experimental.io_callbacknow clear
the caller's concrete and abstract mesh when invoking host callbacks,
matchingjax.debug.callback. -
jax.numpy.quantileandjax.numpy.percentilenow use an
unstable sort whenweights=None, avoiding a companion index sort. -
jax.numpy.minmaxnow lowers via a single-passjax.lax.reduce. - Implemented
__reversed__onjax.Arrayusing chunked slicing,
matching__iter__for faster reverse iteration in eager mode. - Updated minimum pinned
libtpuversion to0.0.50. - When cache key equality comparison fails in
weakref_lru_cache, JAX now
raises a descriptiveValueErrorreporting the non-comparable key types
(#21825).
- Improved the numerical accuracy of
-
Type annotation improvements
-
jax.numpy.int32,jax.numpy.float32, and other scalar constructors
now have proper type annotations; prior to v0.12.0 they were typedAny.
This may lead to new typecheck errors in cases where they were being misused;
for example, if they were assumed to be instances ofjnp.dtype(which they
are not) or used as annotations for arrays of a given type (which is invalid). -
jax.Array.__iter__andjax.Array.__reversed__are now annotated
as returningIterator[Self]rather thanAny. -
jax.random.Keywas introduced as anArraytype alias. Starting in JAX
v0.13.0, this will be the return type forjax.random.key,
jax.random.split, andjax.random.fold_in. - Unary
jax.Arraymethods,jax.Array.astype, and
arr.at[...].set()now useSelfreturn type annotations
(#41055, #41324).
-
-
Bug fixes
- Fixed the gradient of
jax.numpy.ldexpatx = 0.0, which previously
returned1.0instead of2**n. -
jax.nn.scaled_dot_generalkeeps its FP8/FP4 quantization when XLA
expands the scaled matmul into a dequantize-and-dot (previously the
rounding could be folded away underxla_allow_excess_precision) and
computes MX block scales in float32 regardless of the input dtype. - Fixed the derivative of
jax.lax.signandjax.numpy.signfor
complex inputs, which was previously always zero (#41000). -
jax.scipy.linalg.lunow accepts batched inputs of shape
(..., M, N), as documented; previously it raised aValueErrorfor any
input with more than two dimensions. - Fixed reverse-mode autodiff for
jax.experimental.sparse.coo_matvec,
jax.experimental.sparse.coo_matmat,
jax.experimental.sparse.csr_matvec, and
jax.experimental.sparse.csr_matmatwhentranspose=True
(#40625). - Fixed
jax.numpy.linalg.svdwithhermitian=Truebreaking unitarity
when a singular value is zero (#41547). - Fixed gradient cancellation in
jax.lax.expm1,jax.nn.elu,
andjax.nn.selufor large negative inputs (#39794,
#39795, #39796). - Fixed numerical overflow in
jax.lax.asinhgradients for large
inputs. - Fixed precision, overflow, and
NaN/infhandling in
jax.scipy.special.rel_entrandjax.scipy.special.kl_div
(#38239, #38262, #41200). - Fixed domain, boundary, and overflow issues in
jax.scipy.special.expnandjax.scipy.special.expiatx = 0
(#41221). - Fixed
jax.scipy.special.betalnHessian whena == b. - Fixed
jax.scipy.special.zeta's JVP rule returning finite primal
values outside its domain (x < 1) wherezetareturnsNaN
(#40968). - Fixed
jax.scipy.stats.norm.isflosing precision and returninginf
for small tail probabilities (#41262). - Fixed
jax.scipy.stats.expon.logcdfreturning-inffor small
positive inputs (#40965). - Fixed
NaNgradients injax.scipy.stats.laplace.cdfin the tails
(#40966) and injax.scipy.stats.poisson.entropy
(#40969). - Fixed domain handling and tail accuracy in
jax.scipy.stats.cauchy.ppf
andjax.scipy.stats.cauchy.isf(#38318). - Fixed
jax.scipy.stats.vonmises.logpdfatkappa = 0
(#38621) andjax.scipy.stats.chi2.logpdfatx = 0and
x = inffordf = 2(#38316). - Fixed
jax.scipy.stats.multinomial.logpmfandpmffor batchedx
andn(#38605),jax.scipy.stats.poisson.logpmffor
fractionalloc(#41220),jax.scipy.stats.pareto
support checks whenscaleis below the floating-point resolution ofloc
(#40964), andNaNpropagation in
jax.scipy.stats.uniformandjax.scipy.stats.truncnorm
(#38317, #38606). - Fixed parameter broadcasting in
jax.random.f. - Fixed
jax.Array.sumto forward theinitialparameter to
jax.numpy.sum(#41137). - Fixed
jax.numpy.ufunc.reduceatignoring the specifieddtypewhen
casting inputs before accumulation (#41247). - Fixed
jax.numpy.partition,jax.numpy.argpartition, and
jax.lax.top_kreturning incorrect results for signed integer
minimum values (e.g.INT_MIN). - Fixed transpose rule for
jax.lax.select_nwith out-of-range integer
indices or a single case (#10993). - Propagated
mode,indices_are_sorted, andunique_indicesthrough
jax.lax.scatter_maxandjax.lax.scatter_minJVP rules
(#40626). - Fixed input shape validation in
jax.numpy.linalg.eigh,
jax.scipy.linalg.eigh, andjax.numpy.linalg.cholesky, and
raisedNotImplementedErrorfor unimplemented JVP of
jax.lax.linalg.svdwith partialsubset_by_indexand
compute_uv=True(#41210). - Fixed handling of negative
static_argnumsanddonate_argnumswith named
parameters injax.jit(#40988), and fixed keyword
argument forwarding injax.fwd_and_bwd(#41156). - Fixed indexing and iteration over fully replicated multi-device arrays and
out-of-bounds slice validation whenstart = 0. - Fixed
jax.vmapofjax.lax.scanclosing over aRefbatched
on a non-leading axis. - Fixed
jax.experimental.checkifyerror code dtype mismatches under
nestedjax.enable_x64()scopes (#40482). - Fixed a regression where cached host-transfer CPU buffers prevented buffer
donation, and prevented a failing orderedio_callbackfrom permanently
poisoning effect tokens.
- Fixed the gradient of