A pip-installable bundle that pins a tested set of JAX libraries (Flax, Optax, Orbax, Chex, Grain) for AI and numerical computing.
patrick-kidger/diffrax
Numerical differential equation solvers for JAX, supporting ODEs, SDEs and CDEs with autodifferentiation and GPU execution.
- Stars
- 2,122
- Forks
- 202
- Open issues
- 265
- Last commit
- 2 months ago
What is it?
Diffrax is a numerical differential equation solver library built on JAX. It handles ordinary differential equations (ODEs), stochastic differential equations (SDEs) and controlled differential equations (CDEs) through a unified internal structure, so all three kinds are solved in the same way.
The library ships with many solvers, including Tsit5, Dopri5 and Dopri8 for explicit integration, along with symplectic and implicit methods. Integration can be vmapped over everything, including the integration region, and the state can be any PyTree. Dense solutions are available, and several adjoint methods are provided for backpropagation through a solve.
Diffrax is aimed at users who need differentiable simulations, such as neural differential equations. It is installed with pip and requires Python 3.10 or newer.
Key features
- 01Solves ODEs, SDEs and CDEs with one unified structure.
- 02Includes explicit, symplectic and implicit solvers such as Tsit5 and Dopri8.
- 03Supports vmap over the solve, including the integration region.
- 04Accepts PyTree states and provides dense solutions.
- 05Offers several adjoint methods for backpropagation.
Use cases
- Training neural differential equation models that need gradients through a solver.
- Running batched simulations of dynamical systems on GPU.
- Simulating stochastic processes with SDE solvers.
Quick start
- 1
Install the library with pip
pip install diffrax - 2
Define an ODE term, a solver and call diffeqsolve (see the quick example in the README)
Things to know
- Requires Python 3.10 or newer.
- Built on JAX, so you need a working JAX setup to use it.
In collections
Topics
FAQ
- What is diffrax?
- Numerical differential equation solvers for JAX, supporting ODEs, SDEs and CDEs with autodifferentiation and GPU execution. Diffrax is a numerical differential equation solver library built on JAX. It handles ordinary differential equations (ODEs), stochastic differential equations (SDEs) and controlled differential equations (CDEs) through a unified internal structure, so all three kinds are solved in the same way.
- Is diffrax free to use? What license does it have?
- diffrax is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is diffrax still maintained?
- Updated within 6 months. The last commit to diffrax was on Sep 6, 2026.
- What can I use diffrax for?
- Training neural differential equation models that need gradients through a solver. Running batched simulations of dynamical systems on GPU. Simulating stochastic processes with SDE solvers.
- How do I install diffrax?
- Install the library with pip: pip install diffrax Define an ODE term, a solver and call diffeqsolve (see the quick example in the README)
- Where can I get diffrax?
- The source code and installation instructions are on GitHub: https://github.com/patrick-kidger/diffrax
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An MLIR-based compiler and runtime that lowers ML models to a unified IR for deployment from datacenters to mobile and edge devices.
Keras 3 is a deep learning framework that runs on JAX, TensorFlow, PyTorch, or OpenVINO for inference.
A Python library that converts machine learning code between frameworks such as PyTorch, TensorFlow, JAX and NumPy via ivy.transpile.
A neural network library for JAX focused on flexibility, offering the Flax NNX API for building, inspecting and debugging models.
A pretrained model library for Keras 3 offering text, image, and audio models that run on JAX, TensorFlow, or PyTorch.