Differential equations that play nice with autograd
A JAX-native ODE/SDE/CDE solver library built for machine learning researchers who need gradients through dynamical systems.

What it does
Diffrax is a numerical differential equation solver library built on JAX. It handles ordinary, stochastic, and controlled differential equations (ODEs, SDEs, CDEs) with a range of methods from standard Runge-Kutta pairs like Dopri5 and Tsit5 through symplectic and implicit solvers. Everything is vmappable, states can be arbitrary PyTrees, and it supports dense output and multiple adjoint methods for backpropagation.
The interesting bit
Rather than bolting separate ODE, SDE, and CDE solvers together, Diffrax unifies all three under one abstraction. The README notes this “producing a small tightly-written library” — a rare case where the authors flag their own code’s elegance, and it appears earned.
Key highlights
- Native JAX: GPU-capable, JIT-compiled, and differentiable end-to-end
- Neural differential equation support — backprop through dynamics, not just final states
- vmappable everything, including integration regions, for batched experiments
- Dense solutions and multiple adjoint methods (not just one default backprop strategy)
- State as PyTree: no flattening gymnastics for structured data
Verdict
Researchers in scientific machine learning or dynamical systems who already use JAX should look here first. If you’re not in JAX-land or your ODEs are simple enough for SciPy, the migration cost may not pay off.
Frequently asked
- What is patrick-kidger/diffrax?
- A JAX-native ODE/SDE/CDE solver library built for machine learning researchers who need gradients through dynamical systems.
- Is diffrax open source?
- Yes — patrick-kidger/diffrax is open source, released under the Apache-2.0 license.
- What language is diffrax written in?
- patrick-kidger/diffrax is primarily written in Python.
- How popular is diffrax?
- patrick-kidger/diffrax has 2.1k stars on GitHub.
- Where can I find diffrax?
- patrick-kidger/diffrax is on GitHub at https://github.com/patrick-kidger/diffrax.