Skip to content

Performance

A run's time splits into two parts: compiling the program, and running it. For short runs and hyperparameter sweeps the first often dominates; for long runs, the second. This page says what Ajax does about each and how to get the most out of a machine. The numbers come from PERFORMANCE_REPORT.md, where every measurement is described in full. They belong to the machine they were measured on: use them for orders of magnitude, not as promises. They are CPU measurements unless a line says otherwise.

Against other libraries

The same algorithms, with the same settings, in Ajax and in Stable-Baselines3, SBX, CleanRL, PureJaxRL, Brax and purejaxql, each run its own documented way with 1, 10 and 50 seeds, on four cores of a CPU or on one NVIDIA L40S, whichever trains that library faster at that number of seeds.

Ajax trains many seeds, or many configurations, in one program, for fast experiments and hyperparameter searches: its speed grows with the number of seeds, where a library that runs one seed per process stops at one process per core. With one seed it can be slower (One seed and many).

Environment steps per second of each library against the number of seeds, by algorithm and task, on its faster device

How long that takes: the wall clock to train every seed for 1,000,000 steps at those speeds, each library on its faster device. On HalfCheetah, Warp is MuJoCo Warp, which runs on the L40S only, and MJX is MJX's pure-JAX physics; Ajax has a line for each, each on its faster device.

The wall clock to train every seed for 1,000,000 steps, by library, algorithm and task, against the number of seeds The wall clock to train every seed for 1,000,000 steps, by library, algorithm and task, against the number of seeds

And Ajax against each library, with as many seeds:

How many times as fast Ajax trains as each library, with 1, 10 and 50 seeds, each on its faster device How many times as fast Ajax trains as each library, with 1, 10 and 50 seeds, each on its faster device

With 10 seeds, against the fastest other library on each task, each library on its faster device, Ajax trains at:

  • SAC and TD3: 8.3 times Brax's speed (SAC, Pendulum-v1) to 76.7 times SB3's speed (TD3, Pendulum-v1)
  • PPO: 0.9 times SB3's speed (PPO, HalfCheetah-v5) to 1.1 times PureJaxRL's speed (PPO, CartPole-v1)
  • DQN and PQN: 1.0 times purejaxql's speed (PQN, CartPole-v1) to 1.3 times PureJaxRL's speed (DQN, CartPole-v1)

With 50 seeds, against the fastest other library on each task, each library on its faster device, Ajax trains at:

  • SAC and TD3: 8.3 times Brax's speed (SAC, Pendulum-v1) to 81.6 times SB3's speed (TD3, Pendulum-v1)
  • PPO: 1.0 times PureJaxRL's speed (PPO, HalfCheetah-v5) to 1.0 times PureJaxRL's speed (PPO, CartPole-v1)
  • DQN and PQN: 0.8 times purejaxql's speed (PQN, CartPole-v1) to 1.2 times PureJaxRL's speed (DQN, CartPole-v1)
Algorithm Task Seeds Ajax (env steps/s, all seeds together) Fastest other (env steps/s, all seeds together) Ajax ÷ fastest other (above 1: Ajax faster)
SAC Pendulum-v1 1 5,737 (one L40S, one program) Brax, 4,064 (one L40S, one process) 1.41
SAC Pendulum-v1 10 33,834 (one L40S, one program) Brax, 4,064 (one L40S, one after another) 8.32
SAC Pendulum-v1 50 33,818 (one L40S, one program) Brax, 4,064 (one L40S, one after another) 8.32
SAC HalfCheetah-v5 1 650 (one L40S, one program) Brax, 413 (one L40S, one process) 1.57
SAC HalfCheetah-v5 10 5,553 (one L40S, one program) Brax, 413 (one L40S, one after another) 13.44
SAC HalfCheetah-v5 50 15,409 (one L40S, one program) Brax, 413 (one L40S, one after another) 37.29
TD3 Pendulum-v1 1 7,005 (one L40S, one program) CleanRL, 547 (one L40S, one process) 12.81
TD3 Pendulum-v1 10 43,733 (one L40S, one program) SB3, 570 (four CPU cores, four at a time) 76.68
TD3 Pendulum-v1 50 46,553 (one L40S, one program) SB3, 570 (four CPU cores, four at a time) 81.63
TD3 HalfCheetah-v5 1 656 (one L40S, one program) CleanRL, 518 (one L40S, one process) 1.27
TD3 HalfCheetah-v5 10 5,634 (one L40S, one program) CleanRL, 518 (one L40S, one after another) 10.87
TD3 HalfCheetah-v5 50 17,359 (one L40S, one program) CleanRL, 518 (one L40S, one after another) 33.48
PPO CartPole-v1 1 153,975 (four CPU cores, one program) PureJaxRL, 166,151 (four CPU cores, one program) 0.93
PPO CartPole-v1 10 983,365 (one L40S, one program) PureJaxRL, 912,574 (one L40S, one program) 1.08
PPO CartPole-v1 50 4,198,491 (one L40S, one program) PureJaxRL, 4,152,211 (one L40S, one program) 1.01
PPO HalfCheetah-v5 1 1,208 (four CPU cores, one program) SB3, 1,756 (four CPU cores, one process) 0.69
PPO HalfCheetah-v5 10 6,589 (one L40S, one program) SB3, 7,093 (four CPU cores, four at a time) 0.93
PPO HalfCheetah-v5 50 29,491 (one L40S, one program) PureJaxRL, 29,489 (one L40S, one program) 1.00
DQN CartPole-v1 1 20,328 (one L40S, one program) PureJaxRL, 18,221 (one L40S, one program) 1.12
DQN CartPole-v1 10 267,494 (one L40S, one program) PureJaxRL, 207,331 (one L40S, one program) 1.29
DQN CartPole-v1 50 1,209,215 (one L40S, one program) PureJaxRL, 979,100 (one L40S, one program) 1.24
PQN CartPole-v1 1 286,764 (one L40S, one program) purejaxql, 257,118 (one L40S, one program) 1.12
PQN CartPole-v1 10 2,201,187 (one L40S, one program) purejaxql, 2,166,592 (one L40S, one program) 1.02
PQN CartPole-v1 50 5,718,477 (one L40S, one program) purejaxql, 6,770,231 (one L40S, one program) 0.84

Environment steps per second over every seed together, from a stretch of training once the updates run on four cores of an AMD EPYC 9454 48-Core Processor or one NVIDIA L40S (records).

  • Seeds and devices: Ajax, PureJaxRL and purejaxql train every seed in one program. On the CPU, Ajax's ten and fifty seeds are also timed with a JAX device per core (JAX_NUM_CPU_DEVICES=4, see Every CPU core), its seeds split over them. SB3, SBX, CleanRL and Brax train one seed per process: on the four cores, all the processes at once or four at a time, one per core (ten seeds in 2.5 rounds of four, fifty in 12.5); on the GPU, one after another, at their one-seed speed. Each library shows its fastest way at each number of seeds, and the table names it.
  • HalfCheetah: Ajax, Brax and PureJaxRL step gymnasium-mjx's HalfCheetah-v5 on MJX: its MuJoCo Warp implementation on the GPU, about fifteen times faster there with 50 environments, and its pure-JAX one on the CPU, where Warp does not run. SB3, SBX and CleanRL step C MuJoCo through Gymnasium; CleanRL's scripts need Gymnasium 0.29, so they step HalfCheetah-v4, the same model.
  • CartPole: Brax's PPO has no discrete actions, so it skips CartPole.
  • What is timed: environment steps per second over every seed, during a stretch of training once the updates run. Compilation, start-up and evaluations are left out. The machine is shared, so every number in the table ran on four cores closed to every other process meanwhile, with their SMT siblings and the rest of their L3 cache; a GPU run's host threads too. The figure's two exceptions are SBX's SAC with fifty processes, timed earlier on shared cores: they need about 100 GB of memory, more than was free while the cores were closed. Each record notes how busy its cores were.
  • Which Ajax: its CartPole cells and PPO on HalfCheetah were timed again after three changes to its GPU step (#551, #552, #555); its other cells are from before them. On the GPU, #551 and #555 also made SAC about 3 to 4% faster.
  • Off by default: train(unroll_ticks=True) runs an agent that updates every few steps as one GPU graph per update. DQN on CartPole with 10 seeds then trained at about 322,000 environment steps per second on the L40S, against 263,000 by default (#555), and each call compiles about 16 s longer. The figure and table keep the default.

The settings, the same in every library where it takes them; they are CleanRL's and PureJaxRL's defaults for PPO on CartPole and DQN, the defaults SB3 and CleanRL share for SAC, TD3 and PPO on HalfCheetah, and purejaxql's for PQN:

Settings

| Setting | SAC | TD3 | PPO, CartPole-v1 | PPO, HalfCheetah-v5 | DQN | PQN | |---|---|---|---|---|---|---| | Environments per seed | 1 | 1 | 4 | 1 | 1 | 32 | | Rollout steps per environment | | | 128 | 2,048 | | 64 | | Epochs per rollout | | | 4 | 10 | | 4 | | Minibatches per epoch | | | 4 | 32 | | 16 | | Batch size | 256 | 256 | | | 128 | | | Replay buffer | 1,000,000 | 1,000,000 | | | 10,000 | | | Updates per environment step | 1 | 1 | | | | | | Environment steps per update | | | | | 10 | | | Environment steps per target copy | | | | | 500 | | | Updates start after | 1,000 | 1,000 | | | 1,000 | | | Hidden layers | 256-256 | 256-256 | 64-64 | 64-64 | 120-84 | 256-256 | | Activation | relu | relu | tanh | tanh | relu | relu | | Layer norm | | | | | | yes | | Learning rate | 0.0003 | 0.0003 | 0.00025 | 0.0003 | 0.00025 | 0.0001 | | Discount | 0.99 | 0.99 | 0.99 | 0.99 | 0.99 | 0.99 | | Target smoothing | 0.005 | 0.005 | | | | | | Policy delay | | 2 | | | | | | Target noise (clip) | | 0.2 (0.5) | | | | | | Exploration noise | | 0.1 | | | | | | Epsilon (final, decay share) | | | | | 1 to 0.05 (50%) | 1 to 0.2 (20%) | | GAE lambda | | | 0.95 | 0.95 | | | | Q(lambda) | | | | | | 0.95 | | Clip range | | | 0.2 | 0.2 | | | | Entropy coefficient | | | 0.01 | 0 | | | | Gradient norm clip | | | 0.5 | 0.5 | | 10 | | Observation and reward normalisation | | | no | yes | | |

  • CleanRL's PQN: 120-84 layers with layer norm (fixed in pqn.py).
  • PureJaxRL's PPO: 256-256 layers on HalfCheetah (fixed in ppo_continuous_action.py).
  • Brax's PPO: minibatches of whole 64-step unrolls, GAE within each, observations normalised but not rewards (Brax has no reward normaliser).

benchmarks/speed has the method, each library's versions, the scripts and the records.

How long a run takes

The time figure takes each speed out to 1,000,000 steps per seed. Full runs of Ajax's SAC, timed from launch to end with start-up included, land within 5% of it (within 2% from 10 seeds), and the speed holds as the replay buffers fill:

Seeds Projected from the timed stretch (min) Full run, launch to end (min) Its last 99% ÷ 11 times its first 9% (time over time)
1 25.6 26.7 0.99
10 30.0 30.5 0.97
50 54.1 53.8 0.98

SAC on HalfCheetah-v5, 1,000,000 steps per seed, MuJoCo Warp on one NVIDIA L40S, no evaluation.

The time figure leaves each library's start-up out. Ajax's, from launch to the end of a first call that runs through the first update (imports, building the environment, compiling), on each cell's shown device: cold, with empty compile caches as on a first run, and warm, with the caches Ajax and MuJoCo Warp keep by default filled by an earlier run:

Algorithm Task Seeds Device Cold (s) Warm (s)
SAC Pendulum-v1 1 one NVIDIA L40S 22 5
SAC Pendulum-v1 10 one NVIDIA L40S 23 6
SAC Pendulum-v1 50 one NVIDIA L40S 24 5
SAC HalfCheetah-v5 1 one NVIDIA L40S 61 14
SAC HalfCheetah-v5 10 one NVIDIA L40S 54 14
SAC HalfCheetah-v5 50 one NVIDIA L40S 52 14
TD3 Pendulum-v1 1 one NVIDIA L40S 22 5
TD3 Pendulum-v1 10 one NVIDIA L40S 23 5
TD3 Pendulum-v1 50 one NVIDIA L40S 23 5
TD3 HalfCheetah-v5 1 one NVIDIA L40S 48 14
TD3 HalfCheetah-v5 10 one NVIDIA L40S 51 14
TD3 HalfCheetah-v5 50 one NVIDIA L40S 51 15
PPO CartPole-v1 1 four CPU cores 6 3
PPO CartPole-v1 10 one NVIDIA L40S 16 5
PPO CartPole-v1 50 one NVIDIA L40S 16 5
PPO HalfCheetah-v5 1 four CPU cores 31 21
PPO HalfCheetah-v5 10 one NVIDIA L40S 37 14
PPO HalfCheetah-v5 50 one NVIDIA L40S 39 14
DQN CartPole-v1 1 one NVIDIA L40S 17 6
DQN CartPole-v1 10 one NVIDIA L40S 17 6
DQN CartPole-v1 50 one NVIDIA L40S 18 5
PQN CartPole-v1 1 one NVIDIA L40S 14 4
PQN CartPole-v1 10 one NVIDIA L40S 16 4
PQN CartPole-v1 50 one NVIDIA L40S 15 4

One seed and many

PPO on HalfCheetah shows both sides. With one seed, SB3 trains faster: 1,756 environment steps per second on four CPU cores, against Ajax's 1,208 there (715 on the L40S; on the CPU, runs on the same locked cores ranged from about 700 to 1,200). The difference is the physics. For one HalfCheetah on four cores, a step of MJX's physics takes about 0.6 ms, a step of C MuJoCo's about 0.03 ms. MJX alone takes about 1.2 s of each 2,048-step iteration of Ajax; SB3's whole iteration takes 1.16 s, 0.75 s collecting and 0.41 s updating.

With more seeds, SB3's speed stays where four processes, one per core, put it (sixteen processes at once ran slower, 6,161 environment steps per second), while Ajax's seeds share one program on the L40S. From about a dozen seeds, Ajax trains faster. Timed on 29 November 2026 for this note, on the same locked cores and GPU (seeds 11 to 20 are not in the records):

Seeds Ajax, one L40S (env steps/s, all seeds together) SB3, four CPU cores, four at a time (env steps/s, all seeds together) Ajax ÷ SB3 (above 1: Ajax faster)
10 6,589 7,093 0.93
11 7,207 7,093 1.02
12 7,819 7,093 1.10
16 10,204 7,093 1.44
20 12,714 7,093 1.79
50 29,491 7,093 4.16

The compile cache

train compiles the whole run, environment included. With logging, the training between evaluations and the evaluation are separate programs. That takes seconds to tens of seconds, and a fresh Python process would pay it every time. So import ajax points JAX's persistent compile cache at ~/.cache/ajax/jax_compile_cache: a later process that compiles the same program loads it from disk instead.

On the report's Plane3DCircle SAC scenario, run on a GPU, a second launch of the same script took 3.35 s instead of 16.26 s, compile and warm-up fell from 21.5 s to 4.9 s, and peak GPU memory fell from 302 MB to 15 MB, because the compiler's scratch memory is never allocated.

What to know about it:

  • It serves relaunches, not new trials. A rerun of the same script, or a repeated or resumed trial, loads its program from the cache. A new trial of a hyperparameter sweep is a different program: its hyperparameters are compiled in as constants, so it compiles from scratch. train(sweep=...) avoids this for the fields it covers (Hyperparameter sweeps). The budget, the agent's settings and the shapes are all part of the program.
  • A logged run is cached from JAX 0.11. The logging worker is fed by a host callback, and JAX 0.10 never stores a program that contains one, so on 0.10 a run with a LoggingConfig compiles in every new process.
  • One subdirectory per machine and version. Entries are kept per CPU model, architecture, and Python, JAX and jaxlib versions, so environments with different versions, or machines sharing a home directory, do not load each other's programs.
  • Nothing trims it on its own. Clear the directory yourself if it grows too large, or call ajax._compile_cache.prune(root, max_bytes), which deletes the least recently used files until the rest fit (the repository's CI does this once per job).
  • AJAX_JAX_COMPILE_CACHE_DIR moves the cache; AJAX_NO_COMPILE_CACHE=1 turns it off.

Seeds share one program

train runs all seeds as one vmapped program, so the fixed cost of compiling and launching is paid once for all of them; running seeds in separate calls pays it again for each. Until the device is busy, extra seeds add little time. An early GPU measurement of SAC, from May 2026 on an older version of Ajax, with small replay buffers and short runs (benchmarks/seed_scaling.jsonl, benchmarks/seed_scaling_p3d.jsonl):

Seeds Pendulum, wall time Plane3DCircle, wall time
1 9.81 s 15.77 s
4 10.51 s 17.46 s
16 10.43 s 18.75 s
32 11.08 s 19.12 s
100 18.37 s

Thirty-two seeds gave 28 times the throughput of one on Pendulum, and a hundred seeds 86 times on Plane3DCircle. Each seed of a replay agent keeps its own buffer, so memory grows with the number of seeds.

The scaling depends on the workload. In the report's scan of real hyperparameter sweeps (wide networks, critic ensembles), going from 20 to 50 seeds made the time per seed and step worse for several method and environment pairs, by up to 81%. Measure your own configuration before settling on a seed count.

Seeds in groups

On a GPU, a set of seeds can fit a cache that more seeds overflow. A critic ensemble keeps one set of weights per seed and per critic, so its updates run as fast as their data arrives: from an NVIDIA L40S's 96 MB L2 cache while it fits, and two to three times slower from the card's memory once it does not. REDQ's ten critics overflow that cache past about 12 seeds, so its env steps per second fell from 563 at 10 seeds to 360 at 50. train(runs_at_once=...) trains the seeds (or a sweep's runs) in consecutive groups of that many, one group after another:

from ajax import PPO

agent = PPO("Pendulum-v1", n_envs=2, n_steps=8)
state, out = agent.train(seed=range(6), n_timesteps=64, runs_at_once=3)

With 50 seeds on the L40S (CheetahRun on MJX's JAX physics), REDQ ran 1.5 times as fast 10 at a time and 1.7 times as fast 5 at a time as all at once. Each seed trains as it does with all of them at once, but for rounding. The printed progress gives a line per group. The best size depends on the agent and the card, and an agent whose seeds all fit, such as SAC, only loses: measure before you choose it. A last, smaller group is another program to compile. It takes no devices, and a CPU run in groups stays on one device.

Updates every few steps on a GPU

An agent that updates every few steps (DQN's train_frequency, 10 by default) collects those steps between two updates. On a GPU, Ajax plans which steps update before the run, so the steps decide nothing on the device. The steps between two updates still run as an inner loop that the host launches. train(unroll_ticks=True) compiles them one after another instead, so a whole period runs as one CUDA graph:

from ajax import DQN

agent = DQN("CartPole-v1", learning_starts=32, train_frequency=4, batch_size=16)
state, _ = agent.train(seed=0, n_timesteps=64, logging_config=None, unroll_ticks=True)

With 10 seeds on an NVIDIA L40S, DQN on CartPole-v1 trained 322,000 env steps a second this way, against 263,000 without. But each train call compiled about 16 s longer. It pays on long GPU runs; it changes nothing for an agent that updates every step, or on a CPU.

Seeds over several devices

Once one device is busy, train(devices=...) splits the seeds (or a sweep's configurations over the seeds) over several: each device trains a consecutive slice of them at the same time, and the results come back in the usual order, on the first device.

import jax
from ajax import PPO

agent = PPO("Pendulum-v1", n_envs=2, n_steps=8)
state, out = agent.train(seed=range(4), n_timesteps=64, devices=jax.devices())

Each seed trains as it does on one device, but for rounding, which a long run can amplify, as a change of the seed count does on one device. Each replay buffer lives on the device that trains its seed, so the memory is split too. A slice of another size is another program to compile: a number of seeds the devices divide compiles once per device at most. One run is never spread over devices: its environments and its updates stay on one. A Gymnasium environment and an evaluation_device take no devices.

Every CPU core

JAX shows a CPU as one device, on which XLA runs a program's small operations one after another, on one core: in the measurements below a call used 1.1 to 3.4 of four cores, with 10 seeds as with 50. Asked before it starts, JAX shows one device per core, and train then splits the seeds over them without devices=:

JAX_NUM_CPU_DEVICES=4 python train.py

or, in Python, before anything imports Ajax (importing it starts JAX):

# doc: skip
import jax

jax.config.update("jax_num_cpu_devices", 4)

from ajax import PPO

A run of one seed, a Gymnasium environment, a run with an evaluation_device and one with runs_at_once stay on the default device, and devices= still chooses the devices. The run config records how many devices trained (devices).

Without the setting, a CPU run whose seeds could split says how to split them, once for each line that calls train, with the number of cores the process can use (fewer under taskset). A chosen count, JAX_NUM_CPU_DEVICES=1 included, leaves the note out.

Environment steps per second over all seeds, on four cores of an AMD EPYC 9454 in one core complex, with the comparison's settings and no evaluation (2026-11-28, records):

Agent Task Seeds One device Four devices
PPO HalfCheetah-v5 (MJX) 10 1,912 4,818
PPO HalfCheetah-v5 (MJX) 50 598 8,641
DQN CartPole-v1 10 87,915 156,134
DQN CartPole-v1 50 86,300 160,573
SAC Pendulum-v1 10 387 485
SAC Pendulum-v1 50 330 401

SAC gains least: on one device its 256-wide layers on batches of 256 already spread over the cores. Ten seeds split three, three, two and two, so two devices wait at the end of each step. PPO on HalfCheetah gains most at 50 seeds, where one device is slow per seed: from 20 simulations at once XLA's CPU backend hands small sums of MJX's constraint solver to YNNPACK, which runs them 3 to 4 times slower than XLA's own loops (below), and four devices hold 13 seeds each.

Each device compiles its own program, so a first call compiles longer (PPO on HalfCheetah, 10 seeds: 78 s against 51 s, its first two rollouts included). Processes sharing the same cores share their time: give each process its own cores (taskset) and as many devices.

bfloat16

train(precision=...) runs the networks' layers in bfloat16 (mixed precision): the parameters, gradients and optimiser stay float32, each layer computes in bfloat16 with its products summed in float32, and every network returns float32, so the heads of the shared networks, distributions, log-probabilities, losses, targets and normalisers stay float32.

from ajax import PPO

agent = PPO("Pendulum-v1", n_envs=2, n_steps=8)
state, out = agent.train(seed=0, n_timesteps=64, precision="auto")
print(agent.config["precision"])  # float32 on a CPU
  • "float32": as before. None, the default, is the agent's original code's precision: float32 for every agent. DreamerV3's original computes in bfloat16 (deviation D4 in the world-model deviations).
  • "bfloat16": bfloat16 even where the hardware has no bfloat16 units, with a warning: there XLA emulates it, no faster than float32 (about equal on an RTX 2080 Ti, slower on a CPU).
  • "auto": bfloat16 where every device of the run has bfloat16 units (an NVIDIA GPU of compute capability 8.0 or more, Ampere on, or a TPU), else float32: older GPUs and CPUs, so tests and CPU runs never change.

The run config records what the run computed in (precision). The parameters are float32 either way, so a run may resume in another precision. bfloat16 changes the numbers: it keeps about three significant digits.

What reaches bfloat16: the shared networks' observation encoders (the hidden layers before any memory; image encoders and memory cells stay float32), PQN's and APG's hidden layers, TD-MPC2's world model and policy prior, and DreamerV3's model, recurrent state and stored latents (half the replay, without loss). On bob's L40S (2026-11-20, float32 and bfloat16 alternating in one process, HalfCheetah on MuJoCo Warp), environment steps per second were 1.51x for DreamerV3 (4 seeds), 1.18x for TD-MPC2 and 1.03x for SAC, and 0.93x for PPO, whose 64-wide layers are too small to gain: the gain follows the size of the networks and batches.

Parallel environments

n_envs copies of the environment step together inside each seed, as one vectorised operation. Unlike seeds, they change the algorithm: an off-policy agent makes one update per iteration, so more copies at a fixed budget mean fewer updates (Training). Pick n_envs for the learning you want, then use seeds to fill the device.

CPU or GPU

On four CPU cores and on one GPU, on CheetahRun (top) and Breakout-MinAtar (below):

Agent Task Four CPU cores One NVIDIA L40S Gain Compile s, CPU / GPU
SAC CheetahRun 45 1,171 26 times 51 / 26
TD3 CheetahRun 62 1,351 22 times 50 / 26
ASAC CheetahRun 42 1,155 27 times 60 / 26
RVI-SAC CheetahRun 47 1,149 24 times 58 / 32
AVG CheetahRun 592 1,640 2.8 times 59 / 10
APO CheetahRun 7,849 13,268 1.7 times 58 / 16
PPO CheetahRun 4,539 1,762 0.39 times 62 / 14
REDQ CheetahRun 0.97 63 65 times 56 / 32
TQC CheetahRun 3 181 61 times 62 / 32
CrossQ CheetahRun 1 97 94 times 68 / 32
DreamerV3 CheetahRun 0.064 7.1 110 times 51 / 169
TD-MPC2 CheetahRun 0.38 38 101 times 120 / 129
DQN Breakout 4,629 17,027 3.7 times 10 / 5
PQN Breakout 24,766 433,098 17 times 10 / 13
PPO Breakout 8,413 87,183 10 times 16 / 18
UDRL Breakout 1,156 7,132 6.2 times 13 / 12

Environment steps per second per seed, higher is faster, with 10 seeds trained together: the run makes 10 times as many in all. Each is timed on a segment of training once the agent's updates run, without evaluations; the compile seconds are those of the run's first call. The CPU column ran on four cores of an AMD EPYC 9454 48-Core Processor, the GPU column on one NVIDIA L40S of the same machine, at commits aade1b5 and 7687a4d and 7bc8b3c (records). On CheetahRun and HalfCheetah-v5, the CPU column runs MJX's pure-JAX physics, the GPU column runs MuJoCo Warp. The CPU column splits the seeds over 4 JAX devices, one per core (JAX_NUM_CPU_DEVICES).

Each agent has the benchmark's settings, except that the off-policy agents started their updates by step 256 in these runs, so that the timed segments train throughout. Each speed is that of the steps a timed call trains beyond a shorter, warm one, so a call's fixed cost (about 2.3 s with MuJoCo Warp) is left out. On CheetahRun, the GPU column steps MuJoCo Warp, the default on an NVIDIA GPU, and the CPU column MJX's pure-JAX physics, its seeds split over one JAX device per core (Every CPU core). DreamerV3's row is still the 0.6.0 timing (pure-JAX physics on both, one CPU device): at 10 seeds its replay takes over 100 GB of host memory, which this pass could not spare. The benchmark's score against time turns these speeds into hours.

A GPU gains most where updates take the time: many critics, wide networks and world models (REDQ, TQC, CrossQ, DreamerV3, TD-MPC2) train about 60 to 110 times as fast on the L40S. It gains little on one simulator step per seed: AVG, APO and DQN gain 1.7 to 3.7 times, and PPO on CheetahRun runs faster on the four CPU cores: with one environment per seed, the card steps only 10 simulations at a time.

How the gain changes with the number of seeds trained together, on HalfCheetah-v5 through gymnasium-mjx, the speed comparison's task (MuJoCo Warp on the GPU, pure JAX on the CPU, the seeds split over one device per core), and on Breakout-MinAtar, timed the same way. DreamerV3 has one seed only: at 10 its replay takes over 100 GB of host memory, which this pass could not spare, and at 50 about 500 GB.

How many times as fast one GPU trains each agent as four CPU cores, against the number of seeds trained together

Agent Task 1 seed 10 seeds 50 seeds
SAC HalfCheetah-v5 2.6 12 39
TD3 HalfCheetah-v5 2.2 10 37
ASAC HalfCheetah-v5 2.3 13 36
RVI-SAC HalfCheetah-v5 2.3 13 38
AVG HalfCheetah-v5 2.3 1.9 8.7
APO HalfCheetah-v5 5.9 21 72
PPO HalfCheetah-v5 0.66 1 3.1
REDQ HalfCheetah-v5 28 68 41
TQC HalfCheetah-v5 20 48 55
CrossQ HalfCheetah-v5 52 86 86
DreamerV3 HalfCheetah-v5 140 – –
TD-MPC2 HalfCheetah-v5 66 101 102
DQN Breakout 1 3.7 20
PQN Breakout 17 17 49
PPO Breakout 2.7 10 36
UDRL Breakout 7.5 6.2 31

With one seed, the GPU wins by little where updates are light: 1 to 7.5 times (PQN 17), and PPO on HalfCheetah runs faster on the CPU. Agents with heavy updates gain 20 to 140 times already.

On the CPU, the four devices are full by 10 seeds: from 10 to 50, each agent's total stays about the same or falls (Breakout's by up to 30%; PPO's and APO's on HalfCheetah grow about 1.4 times), so each seed runs about five times slower. The L40S still has room at 10 seeds for most agents: their total grows 2.1 to 4.5 times by 50 seeds, and their gain with it, SAC's from 12 to 39 times and PPO's on HalfCheetah from 1 to 3.1. TQC, CrossQ and TD-MPC2 fill the card by 10 seeds, so their total stays about the same at 50. REDQ's total falls, from 591 to 361 steps per second, and its gain from 68 to 41 times: past about a dozen seeds its critics outgrow the L40S's L2 cache, which seeds in groups works around.

An earlier sweep (2026-11-06, records in benchmarks/gpu/) found SAC's total levelling off near 8,000 steps per second from 64 seeds, and PPO reaching 42,000 at 256. Three SAC jobs at once on an otherwise idle card gave 1.9 times the throughput of one. benchmarks/gpu_check.sh compares four agents on CartPole and Pendulum with the same machine's CPU, in benchmarks/gpu/report.md.

The logging worker always runs on the CPU, so it never takes GPU memory. On an NVIDIA GPU, Playground and "mujoco:" tasks step MuJoCo Warp by default where it can run (Environments). It trained about five times faster than MJX's pure-JAX physics (physics="jax") on an L40S, with 10 seeds of one environment each:

Agent, task Pure JAX Pure JAX, command buffers Warp
SAC, mujoco:Hopper-v5 28 38 181
PPO, mujoco:HalfCheetah-v5 84 102 569

These are steps per second per seed, from timing runs without evaluations. With 100 seeds, SAC on Warp ran 80 steps per second per seed, 8,000 in all. The command buffers are XLA_FLAGS="--xla_gpu_enable_command_buffer=FUSION,CUBLAS,CUBLASLT,CUSTOM_CALL,CUDNN,WHILE,CONDITIONAL --xla_gpu_graph_min_graph_size=1 --xla_gpu_command_buffer_unroll_loops=true"; without the last flag they gave pure JAX 32 and 85. Leave command buffers off with Warp: without the last flag they slowed its PPO run to 173 steps per second per seed, with or without CUSTOM_CALL.

A GPU doesn't promise the same result twice by default: two identical PPO runs on HumanoidWalk differed. XLA_FLAGS=--xla_gpu_deterministic_ops=true made repeated and resumed runs match exactly on CheetahRun and HumanoidWalk. At 10 seeds it cost 11% of speed on TQC and 33% on APO on HumanoidWalk. gymnax tasks matched without it.

To keep a run on the CPU of a machine with a GPU, set JAX_PLATFORMS=cpu (and CUDA_VISIBLE_DEVICES="" to hide the GPU entirely). The repository's tests and benchmarks run this way, so they never compete with an experiment on the GPU.

Many MJX simulations at once on a CPU

XLA's CPU compiler hands a sum to the YNNPACK library whenever the sum reads 4,096 numbers or more. MJX's constraint solver sums an array of simulations by constraint rows by 3 about a thousand times per environment step, inside its loops. On HalfCheetah, with 70 rows, these sums reach that size from 20 simulations at once (the seeds times each seed's environments); a model with more rows reaches it with fewer. YNNPACK runs these small sums 3 to 4 times slower than XLA's own loops, and the physics slows down with them:

Simulations at once 1 10 20 50 100
XLA's default 1.1-1.3 0.50-0.64 1.6-1.7 1.6-1.7 1.6-2.1
With the flag below 1.2-1.3 0.53-0.72 0.43-0.45 0.38-0.39 0.46-0.50

Milliseconds per simulation step of mujoco:HalfCheetah-v5, its simulations stepped together on four CPU cores, two runs each.

This flag keeps the sums in XLA's loops. XLA reads its flags when JAX starts, and importing Ajax starts JAX: set it in the shell, or in os.environ before the script first imports jax or ajax.

XLA_FLAGS=--xla_cpu_experimental_ynn_fusion_type=-reduce python train.py
Run Seeds x environments Without the flag With the flag
PPO, mujoco:HalfCheetah-v5 50 x 1 637 2,313
SAC, mujoco:HalfCheetah-v5 50 x 1 193-196 250-254
PPO, CheetahRun 50 x 1 11,826 18,749
APO, CheetahRun 10 x 10 11,945 17,921
PPO, mujoco:HalfCheetah-v5 10 x 1 1,881-2,144 1,741-1,782
SAC, mujoco:HalfCheetah-v5 10 x 1 253-261 251-253

Environment steps per second in all, on the same four cores as one CPU device; the timings above ran without the flag. Below 20 simulations the physics gains nothing, and the networks' sums can run faster in YNNPACK: on Pendulum and CartPole, with 1, 10 or 50 seeds, the agent benchmark's agents ran from 25% slower to 38% faster with the flag, depending on the agent and the seeds. Set it for runs that step 20 or more MJX simulations at once and spend their time in the physics; elsewhere, time your own run with and without it. Each device's program counts its own simulations: split over four CPU devices, 50 seeds are 13 a device, below 20. Only the rounding of the sums changes. A GPU has no YNNPACK and ignores the flag.

Logging

Evaluation runs num_episode_test whole episodes every log_frequency steps, on top of training: evaluate as often as your curves need, not more. Without a LoggingConfig the evaluation is not compiled at all, and the program can be cached.

Agent speeds

benchmarks/agent_bench.py times every agent on a fixed task (CartPole for DQN, PQN, PPO and DreamerV3, a Pendulum tracking task for APG, Pendulum for the others, DAgger imitating a PD controller), 4 environment copies, 8,000 steps, one seed, 5 trials, the compile cache off, on a Mac's CPU. Every agent updates within the run: the replay agents start at step 1,000 instead of their defaults (10,000 for SAC, TD3, REDQ and ASAC). Medians of the five trials, from the baseline recorded on 2026-10-28 (PQN's on 2026-11-03, once it stopped training a rollout past its budget):

Agent Steps per second, execution Steps per second, whole run Compile and warm-up (s)
DAgger 42,406 9,508 0.8
PQN 37,683 8,973 0.9
APO 31,243 7,203 1.2
APG 28,105 6,385 1.3
PPO 25,391 6,698 1.3
UDRL 21,876 6,419 1.1
DQN 21,542 8,256 0.8
AVG 11,560 5,366 1.1
TD3 4,063 2,911 1.2
IQL 3,145 2,319 1.1
SAC 3,094 2,302 4.6
ASAC 2,135 1,709 1.2
DreamerV3 508 407 7.6
TDMPC2 412 360 4.5
TQC 392 374 1.3
CrossQ 91 90 1.7
REDQ 63 63 1.2

"Execution" leaves out the time JAX spends tracing, lowering and compiling the program; "whole run" includes it, because every trial builds a fresh agent, whose program is traced again. REDQ is slow by design: from step 1,000 it makes 20 updates of 10 critics per environment step. CrossQ's critics are 2,048 units wide, and TQC updates 5 critics of three 512-unit layers. ASAC's and IQL's trials spread the most. DreamerV3 and TD-MPC2 run at reduced presets (DreamerV3's smallest size, "1m"; a TD-MPC2 narrowed to 64-unit layers and a smaller planner); at its paper's defaults TD-MPC2 would take minutes per bench run on a CPU, since it updates its model and plans at every environment step. Speeds on your machine will differ; the ratios between agents are the useful part. Developer performance explains how to run the benchmark and the 10% no-regression rule every change follows.

Other measured costs

  • The action map. Mapping every continuous action onto the environment's bounds (Actions) cost nothing measurable: SAC +0.1%, TD3 +2.8% and PPO +1.0% steps per second, within noise.
  • Playground fresh resets. Drawing a new initial state per episode (the default) costs a reset per episode. On CheetahRun, whose reset runs a 200-step stabilisation, SAC's iterations took about 2% longer, and compile plus first run grew from 36 s to 59 s per cold process.
  • Brax resets. Ajax's Brax wrapper computes a reset only on steps where some copy's episode ended. differentiable_reset=True computes one every step, which cost about 7-13% of a step's time in the report's measurement.
  • Memory blocks in the replay agents: see Memory.