The JAX Stack, From the Inside

A bottom-up path through the modern JAX training/serving stack, for reading real open-source code rather than interview prep — jax, flax, orbax, xla, qwix, maxtext — from tracing to sharding to checkpointing to quantization to production.

Layer 1 — The core mechanic

One trick — trace a Python function into a typed jaxpr — becomes jit, grad, and vmap alike, and the reason a model is just a pytree of arrays.

Layer 2 — Splitting across devices

From a PartitionSpec on one array, to the compiler passes that insert the collectives, to the kernel that makes attention fast once the bytes land on one chip.

Layer 3 — State at scale

The full checkpoint story, save to load: who writes which bytes, how thousands of per-host files become one atomic manifest, and how a multihost cluster reads back exactly its own shards.

Layer 4 — Making it cheap

Quantization without touching model code — the interception trick, then the algorithm it hides, read line by line.

Layer 5 — Where it all meets

The production capstones — a real training loop and a real RL cluster, built from every layer above.

Browse the full library