36,596
stars
+10
3,997
forks
328
watchers
31,444
prs
7,449
issues
143
releases
2,957
discussions
README
Transformable numerical computing at scale
Transformations
| Scaling
| Install guide
| Change logs
| Reference docs
What is JAX?
JAX is a Python library for accelerator-oriented array computation and program transformation,
designed for high-performance numerical computing and large-scale machine learning.
JAX can automatically differentiate native
Python and NumPy functions. It can differentiate through loops, branches,
recursion, and closures, and it can take derivatives of derivatives of
derivatives. It supports reverse-mode differentiation (a.k.a. backpropagation)
via jax.grad as well as forward-mode differentiation,
and the two can be composed arbitrarily to any order.
JAX uses XLA
to compile and scale your NumPy programs on TPUs, GPUs, and other hardware accelerators.
You can compile your own pure functions with jax.jit.
Compilation and automatic differentiation can be composed arbitrarily.
Dig a little deeper, and you'll see that JAX is really an extensible system for
composable function transformations at scale.
This is a research project, not an official Google product. Expect
sharp edges.
Please help by trying it out, reporting bugs,
and letting us know what you think!
python
import jax
import jax.numpy as jnp
def predict(params, inputs):
for W, b in params:
outputs = jnp.dot(inputs, W) + b
inputs = jnp.tanh(outputs) inputs to the next layer
return outputs no activation on last layer
def loss(params, inputs, targets):
preds = predict(params, inputs)
return jnp.sum((preds - targets)2)
grad_loss = jax.jit(jax.grad(loss)) compiled gradient evaluation function
perex_grads = jax.jit(jax.vmap(grad_loss, in_axes=(None, 0, 0))) fast per-example grads
Contents
Transformations
Scaling
Current gotchas
Installation
Citing JAX
Reference documentation
Transformations
At its core, JAX is an extensible system for transforming numerical functions.
Here are three: jax.grad, jax.jit, and jax.vmap.
Automatic differentiation with grad
Use jax.grad
to efficiently compute reverse-mode gradients:
python
import jax
import jax.numpy as jnp
def tanh(x):
y = jnp.exp(-2.0 x)
return (1.0 - y) / (1.0 + y)
grad_tanh = jax.grad(tanh)
print(grad_tanh(1.0))
prints 0.4199743
You can differentiate to any order with grad:
python
print(jax.grad(jax.grad(jax.grad(tanh)))(1.0))
prints 0.62162673
You're free to use differentiation with Python control flow:
python
def abs_val(x):
if x 0:
return x
else:
return -x
abs_val_grad = jax.grad(abs_val)
print(abs_val_grad(1.0)) prints 1.0
print(abs_val_grad(-1.0)) prints -1.0 (abs_val is re-evaluated)
See the JAX Autodiff
Cookbook
and the reference docs on automatic
differentiation
for more.
Compilation with jit
Use XLA to compile your functions end-to-end with
jit,
used either as an @jit decorator or as a higher-order function.
python
import jax
import jax.numpy as jnp
def slow_f(x):
Element-wise ops see a large benefit fromTop issues
#4493Building on linux with ppc64le CPU76 comments · 2020-10-08#23689Build issues with local CUDA installation58 comments · 2024-09-17#3112sparse eigenvalue solvers50 comments · 2020-05-15#1032feature request: sparse jacobian and sparse hessians43 comments · 2019-07-18#669Support autodiff of Eigendecomposition with repeated eigenvalues39 comments · 2019-05-04#26000Missing `.device` attribute inside `@jax.jit`38 comments · 2025-01-21#1531Differentiable matrix-free linear algebra, optimization and equation solving38 comments · 2019-10-20#24411JAX code is extremely slow on GPUs37 comments · 2024-10-20
Discussions
#42116[Pallas] Fused forward+backward kernel for Gated DeltaNet-2 on TPU: 411× over jax.lax.associative_scan, and open questions on head-sharding0 comments · 2026-10-29#41871Experimenting with Threefry and Pallas on TPU0 comments · 2026-10-21#41673Failed to allocate device memory in Neural GCM simulation1 comments · 2026-10-16#41651jaxviz - Package to interactively visualize Jax models in notebooks0 comments · 2026-10-15#41384Extending roofline2 comments · 2026-10-08#41167Recipe for automatically plumbing PRNG keys1 comments · 2026-10-01#41095What was Jax's idea behind implementing the C standard Annex G recoveries1 comments · 2026-09-29#41045Development strategies for dealing with backend changes in XLA2 comments · 2026-09-28
Latest release
JAX v0.12.0.1 jax-v0.12.0.1 2026-10-22Bug fixes
Built C++-generated intrinsic LLVM IR on Windows with clang-cl instead of
emitting empty bitcode, enabling vectorized CPU intrinsics on Windows
(https://github.com/openxla/xla/commit/3af77b5776fbc41a65d54876cc837bdc57540005).