diffrax
GPU+autodiff-capable ODE/SDE/CDE solvers written in JAX.
What it is and what it does
Diffrax is a JAX-native library for solving differential equations—ODEs, SDEs, and CDEs—with full automatic differentiation and GPU support. It unifies the treatment of different equation types under a single internal architecture, making it compact and composable. The library is designed for researchers and practitioners working with neural differential equations, dynamical systems, and scientific computing where gradient-based optimization through the solver is needed.
The package integrates tightly with the JAX ecosystem (equinox, jaxtyping, lineax, optimistix) and supports advanced features like vmappable solvers, PyTree state representations, dense solutions, and multiple adjoint methods for backpropagation. It includes a range of solvers from standard choices like Dopri5 to specialized symplectic and implicit methods, all callable from a unified interface.
Use it for:
- Training neural differential equations where gradients flow through the solver during backpropagation.
- Solving systems of ODEs/SDEs on GPU for large-scale scientific simulations with automatic differentiation.
- Implementing controlled differential equations for sequence modeling and time-series tasks.
- Research prototyping of dynamical systems where vmappable solvers enable batched integration over parameter ranges.
- Combining differential equation solving with JAX's functional programming model in end-to-end differentiable pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Diffrax provides numerical solvers for ordinary, stochastic, and controlled differential equations in JAX, with automatic differentiation and GPU acceleration built in.
Yes, if you work with differential equations in JAX or need autodiff through a solver. Low install friction, active maintenance, permissive license, and no known vulnerabilities. The Alpha status and tight coupling to the JAX ecosystem mean it's best suited for research and projects where you can tolerate API changes; for production systems requiring long-term stability, verify that the specific solver and adjoint method you need are stable.
Install
diffrax on PyPI
pip
pip install diffraxuv
uv add diffraxpoetry
poetry add diffraxInstalling diffrax
Before you install
Low friction install with a pure-Python wheel. Requires Python 3.11+ and depends on established JAX ecosystem packages (equinox, jax, jaxtyping, lineax, optimistix). Repository is active with recent commits and 2084 stars.
License in practice
Apache 2.0 permissive license allows commercial and derivative use with minimal restrictions—you must include a copy of the license and note any modifications, but there are no copyleft obligations.
Quickstart
pip install diffrax
from diffrax import diffeqsolve, ODETerm, Dopri5
import jax.numpy as jnp
def f(t, y, args):
return -y
term = ODETerm(f)
solver = Dopri5()
y0 = jnp.array([2., 3.])
solution = diffeqsolve(term, solver, t0=0, t1=1, dt0=0.1, y0=y0)
Requires Python 3.11+; JAX must be installed and functional (may require GPU/TPU drivers for hardware acceleration).
Verify before relying
- Whether all solver types (Tsit5, Dopri8, symplectic, implicit) are production-ready or still experimental given Alpha status.
- Performance characteristics and numerical accuracy compared to other differential equation libraries.
- Specific GPU/TPU compatibility and performance gains in practice.
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — equinox, jax, jaxtyping, lineax, optimistix, typing-extensions, wadler-lindig |
| Maintenance | actively maintained — 177 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 357,141/month — #7,275 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: diffrax-0.7.2-py3-none-any.whl
Keywords: deep-learning, differential-equations, diffrax, dynamical-systems, equinox, jax, neural-differential-equations
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
optimistixOptimistix provides nonlinear solvers for root…
permissive · top 15,000 on PyPI
torchcdeProvides differentiable GPU-capable solvers for…
permissive · top 15,000 on PyPI
torchdiffeqProvides PyTorch-based ODE solvers with…
permissive · top 5,000 on PyPI
lineaxLineax solves linear systems and least-squares…
permissive · top 15,000 on PyPI
torchsdeSolves stochastic differential equations (SDEs)…
permissive · top 5,000 on PyPI
findiffComputes finite difference numerical…
permissive · top 15,000 on PyPI
einshapeEinshape provides a DSL-based interface for…
permissive · top 15,000 on PyPI
optaxOptax provides composable building blocks for…
permissive · top 5,000 on PyPI
pybammsolverspybammsolvers provides a Python interface to…
unclear · top 15,000 on PyPI
jax-cuda12-pjrtProvides NVIDIA GPU acceleration for JAX…
permissive · top 15,000 on PyPI