The sketch explained
JAX: applying a function to a batch
vmap transforms a function to operate over a batch axis. Each row illustrates the same operation on corresponding elements, followed by grouping the outputs.
On a small screen, scroll the diagram horizontally to read its labels.
- Input batch
- Rows represent batch elements; three rows are not a software limit.
- vmap transformation
- The transformation handles the vectorized axis without explicitly writing this Python loop.
- Output batch
- Results are grouped according to the axes specified by the transformation.
- Function f
- The same function acts on corresponding elements; boxes do not represent processors.
UNDERSTANDING THE SYSTEM
JAX v0.4.32 / Flax v0.8.x: transform computations, make state explicit
JAX transforms numerical functions; Flax organizes networks and their variables. Their composition becomes clearer when gradients, batch axes, compilation, state and array placement are treated separately. The historical scope carries an essential qualification: JAX 0.4.32 was withdrawn from PyPI.
A historical version and compatibility that needs evidence
The listing places JAX v0.4.32 alongside Flax v0.8.x; that alone does not define a validated software combination. This dossier uses Flax 0.8.5 as a specific documentary point within that family without changing the listing. JAX provides arrays and program transformations; Flax provides, among other things, neural network modules. Neither is a pretrained model.
The JAX 0.4.32 release warning is decisive: the version was yanked from PyPI because of a data corruption issue on TPU when a job uses multiple TPU slices. A slice here means an allocated hardware group, not an array shard. This scope neither establishes that every CPU computation is affected nor justifies recommending this old version for a new deployment.
The Flax 0.8.5 manifest accepts JAX from 0.4.27 onward, with no declared upper bound. Thus 0.4.32 satisfies that declared dependency constraint; this does not prove every module, compiler path or transitive dependency works. Actual qualification must fix Python, JAX, jaxlib, Flax, NumPy, Optax, Orbax and the platform, then run relevant tests.
| Component | What the archive establishes |
|---|---|
| JAX 0.4.32 | Documented release; PyPI withdrawal warning for a TPU defect when one job uses multiple slices. |
| Flax 0.8.5 | Requires JAX ≥ 0.4.27 and Python ≥ 3.9; this manifest declares no JAX upper bound. |
| Python ≥ 3.10 | Required by JAX 0.4.32, stricter than Flax’s minimum. This shared minimum does not lock the remaining dependencies. |
Three transformations answer three different questions
Automatic differentiation applies the chain rule to program operations. grad returns a function that computes the gradient of a scalar output with respect to selected inputs; value_and_grad also returns the value. This is neither a general symbolic differentiation of Python text nor a finite-difference approximation. A vector output needs a chosen reduction or a suitable transformation, such as a Jacobian.
vmap vectorization adds batch-axis handling to a function written for one example. You declare which arguments vary and which are shared. It can replace a Python loop without rewriting every tensor operation. This mechanism does not automatically distribute computation across multiple GPUs. Intermediate memory use and the reduction axis remain program decisions.
jit compilation traces supported operations and lowers them to compiled execution, notably through XLA. It does not compute gradients in place of grad or impose a weight update. Composing grad, vmap and jit is useful, but ordering expresses a particular computation: per-example gradients are not yet the mean gradient until the corresponding reduction is performed.
Teaching example: two observations, one shared weight. Values are calculated by hand; no duration or speedup is measured.
- Differentiate one example
For observations (1, 2) and (2, 4), with w = 1, squared loss gives gradients −2 and −8. grad changes which function is computed.
- Add a batch axis
vmap shares the weight while varying x and y. Its output contains two gradients; their mean is −5. This operation alone implies no additional device.
- Compile the update
jit can compile a step computing mean loss and its gradient. With learning rate 0.1 the new weight is 1.5; compilation does not change that mathematical definition.
Tracing, static shapes and program control
During tracing, arguments are represented by tracers describing properties such as shape and dtype. JAX operations build an intermediate representation of the computation. A Python print statement or a global-list mutation may happen during this phase without becoming a repeated operation in the compiled program. Successful tracing therefore does not validate hidden side effects.
On the ordinary jit path discussed here, array sizes generally need to be determinable at compile time. Selecting a value-dependent number of elements is problematic; a shape-preserving mask may work. A Python condition requiring a tracer’s Boolean value is not a compiled dynamic branch. Conditional and loop primitives express these intentions subject to their own constraints.
A static argument is known at compile time. Changing its value may trigger a new specialization; changing shape or dtype can also cause recompilation. Marking an entire mutable object static is not a sound solution to state handling. For variable lengths, grouping sizes and padding can reduce compilation diversity at the cost of additional computation and memory.
| Situation | Decision to examine |
|---|---|
| Data-dependent condition | Use JAX-compatible control flow; do not force a tracer into a Python Boolean. |
| Variable-size output | Reformulate using a fixed shape and a mask when the problem permits. |
| Many batch sizes | Measure recompilations and consider size buckets. |
| Logging and mutation | Keep orchestration outside the transformed computation or use an appropriate explicit interface. |
Pytrees organize parameters and carry state
A pytree is a structure of registered Python containers, including dictionaries, lists and tuples, whose leaves may be arrays. Transformations traverse this structure: gradients of dictionary-organized parameters have a corresponding structure. A leafwise update requires compatible parameter and gradient structures. An arbitrary object does not automatically gain this contract.
Purity here means inputs determine outputs and required updates are explicitly returned. A training function can accept parameters, optimizer state, model statistics and a random key, then return their new values. The application retains those values for the next step. This model allows stateful training while exposing its dependencies.
Learned parameters, moving normalization statistics and optimizer moments serve different purposes. Typically the loss is differentiated with respect to trainable parameters while the rest is carried separately. Being an array leaf in a pytree does not automatically make a value trainable. Custom-object structures and metadata need careful registration.
Pseudorandom keys separate uses without implicit global state
In JAX’s functional model, a random operation receives an explicit PRNG key. Reusing a key with the same operation, shape and configuration reproduces the same sample. The call does not silently consume global state. For a new use, split a key into subkeys and pass those to the relevant operations, retaining a continuation branch.
Typed keys already exist in this release: the key constructor produces a key whose dtype encodes the generator implementation. The older PRNGKey constructor remains available and, for Threefry, produces a uint32 array of shape (2,). That array is not interchangeable with a scalar typed key in every array manipulation. Adding an integer to key contents is not how to create a new key.
The code below explicitly selects Threefry and demonstrates repetition caused by reusing a subkey. The next split provides another intended use; it is neither a statistical proof of independence nor a guarantee of identical results across releases, hardware and implementations. Batched keys must also follow the selected generator’s rules; not all PRNG modes have the same semantics under vmap.
Conceptual key-splitting diagram. Symbols identify roles and do not depict the generator’s actual bits.
- Split the parent key
Key k produces two branches: k₁ for continuation and k₂ for a sampling use. A random operation does not implicitly change the parent key.
- Recognize reuse
Two identical calls with k₂ produce the same array. The program does not automatically mark the key as consumed; code must enforce this discipline.
- Prepare the next use
Splitting k₁ produces k₃ and k₄. Retaining the continuation branch and assigning the other to the next use makes the path explicit and recordable.
import jax
jax.config.update("jax_platform_name", "cpu")
import jax.numpy as jnp
key = jax.random.key(0, impl="threefry2x32")
next_key, sample_key = jax.random.split(key)
a = jax.random.normal(sample_key, shape=(4,))
b = jax.random.normal(sample_key, shape=(4,))
assert bool(jnp.array_equal(a, b))
key = next_key
key, new_sample_key = jax.random.split(key)
c = jax.random.normal(new_sample_key, shape=(4,))Flax Linen: init, apply and variable collections
Linen structures layers and submodules, while their parameters remain in a variable tree separate from the module description. init takes a key and representative inputs to create that tree. apply then evaluates the module using the supplied variables. The params collection contains parameters; it does not necessarily represent all network state.
With batch normalization, a batch_stats collection can retain statistics. During training, modification of that collection is explicitly enabled and apply returns both output and updates to preserve. During evaluation, use the appropriate statistics and avoid accidentally continuing to learn them. For active dropout, a named key is supplied; initialization and different stochastic steps need distinct key uses.
The Flax 0.8.5 tag also includes NNX documentation, with a different object and state-management interface. NNX is therefore not something introduced after the entire 0.8 series; its examples must not be mixed with the Linen contract. This dossier uses Linen. Current NNX syntax, an NNX optimizer or its mutation rules are not assumed interchangeable with init/apply in this archive.
Conceptual cycle with parameters θ and state s. The return arrow represents an explicitly retained value, not hidden global mutation.
- Create the collections
init builds the required variables from the module description, inputs and keys. Parameters and any statistics play different roles.
- Apply with the correct state
apply receives θ, s, inputs and a dropout key when needed. Collections authorized as mutable return their updates.
- Retain the next state
The optimizer produces θ′; state updates produce s′. The next step receives these new values. Saving weights alone does not preserve this whole cycle.
Placement and sharding need more than a logical axis
A JAX array has a logical shape and a physical placement. Transferring it to a device, replicating it or sharding it across devices are separate decisions from vectorization. The archive describes named device meshes, partition specifications and associated placements. The compiler can use these constraints to organize operations and required communication.
Consider a hypothetical float32 array of shape (8, 4), row-sharded over two devices without replication or padding. Each device holds (4, 4), or 64 bytes of useful array data; the logical array represents 128 bytes. This calculation excludes temporary buffers, metadata, gradients and optimizer state. Adding memory capacities does not guarantee an operation can use that memory without communication.
A matrix multiplication may require a gather, reduction or resharding, depending on distributed axes and expected outputs. Topology, network and input placement therefore influence cost. The cited archive tutorial requires eight devices and was not run here. The 0.4.32 multi-slice TPU defect is an additional reason not to turn this diagram into a deployment recipe.
| Choice | What to check |
|---|---|
| Vectorization | Batch axis, shared parameters and intermediate memory. |
| Replication | Full copies, consistency and exchanges required by the computation. |
| Sharding | Distributed axes, divisibility, collectives and per-device capacity. |
| Multiple hosts | Distributed initialization, collective ordering, network and the version actually qualified. |
A CPU example with numbers you can check by hand
Take bias-free regression: prediction wx, observations (1, 2) and (2, 4), initial weight w = 1. The losses are 1 and 4, averaging 2.5. Their derivatives 2x(wx − y) are −2 and −8; the mean gradient is −5. One descent step at rate 0.1 gives w′ = 1.5. The new mean loss is 0.625. These are teaching calculations, not measurements of training efficiency.
The first part composes per-example differentiation, vectorization and a CPU-compiled step. Per-example gradients are not treated as though they were already a mean. The second part represents exactly the same regression using a bias-free Linen Dense layer, a kernel initialized to one and explicit parameters. It shows why transformations operate on the parameters passed to the loss function.
The code is documentary and was not executed with JAX or Flax in this environment. Assertions express expected results that can be checked algebraically. It downloads no model, installs no packages and reserves no accelerator. There is no dropout or normalization state in this example, so it does not imply a stateful network can be saved using parameters alone.
import jax
jax.config.update("jax_platform_name", "cpu")
import jax.numpy as jnp
from flax import linen as nn
xs = jnp.array([1.0, 2.0], dtype=jnp.float32)
ys = jnp.array([2.0, 4.0], dtype=jnp.float32)
w = jnp.array(1.0, dtype=jnp.float32)
def single_loss(w, x, y):
return (w * x - y) ** 2
per_example_grad = jax.vmap(
jax.grad(single_loss), in_axes=(None, 0, 0)
)
def mean_loss(w, xs, ys):
return jnp.mean((w * xs - ys) ** 2)
@jax.jit
def step(w, xs, ys):
loss, gradient = jax.value_and_grad(mean_loss)(w, xs, ys)
return loss, gradient, w - 0.1 * gradient
loss, gradient, next_w = step(w, xs, ys)
next_w.block_until_ready()
assert float(loss) == 2.5
assert float(gradient) == -5.0
assert float(next_w) == 1.5
assert bool(jnp.isclose(mean_loss(next_w, xs, ys), 0.625))
assert bool(jnp.allclose(per_example_grad(w, xs, ys),
jnp.array([-2.0, -8.0])))
model = nn.Dense(features=1, use_bias=False,
kernel_init=nn.initializers.ones_init())
inputs = xs[:, None]
variables = model.init(jax.random.key(0), inputs)
params = variables["params"]
def linen_loss(p):
predictions = model.apply({"params": p}, inputs)[:, 0]
return jnp.mean((predictions - ys) ** 2)
linen_value, grads = jax.value_and_grad(linen_loss)(params)
updated_params = jax.tree_util.tree_map(
lambda p, g: p - 0.1 * g, params, grads
)
assert float(linen_value) == 2.5
assert float(updated_params["kernel"][0, 0]) == 1.5Measure a completed computation rather than just dispatch
JAX may return control to Python before a computation finishes. A returned array then also represents a dependency on a result still being produced. Version 0.4.32 broadens asynchronous CPU dispatch, so this concern is not limited to GPUs. Timing a call without waiting for its output may mostly measure work submission.
The first compiled call can include tracing and compilation. The protocol below prepares a fixed-shape, fixed-dtype input, waits for readiness, performs a warm-up call and waits again, then times a call whose output is synchronized using block_until_ready. This defines a measurement boundary; the dossier publishes no timing obtained from this code.
For a useful evaluation, record compilation, transfers, repeated execution and full data processing separately. Repeat measurements and report spread, versions, backend, batch size and numerical precision. Displaying or converting an array on the host can synchronize and change the observed cost. A small matrix multiplication alone does not predict training throughput or quality.
from time import perf_counter
import jax
jax.config.update("jax_platform_name", "cpu")
import jax.numpy as jnp
x = jnp.ones((32, 32), dtype=jnp.float32)
x.block_until_ready()
f = jax.jit(lambda a: a @ a)
f(x).block_until_ready()
start = perf_counter()
result = f(x)
result.block_until_ready()
elapsed_seconds = perf_counter() - start
assert result.shape == (32, 32)Choose JAX/Flax and plan recovery
JAX is especially relevant when work calls for composing numerical transformations and making dependencies explicit: research, differentiable scientific computing and training where shapes and placement can be controlled. Flax Linen adds module organization. A team also needs to understand tracing errors, key management and library qualification; concise syntax does not remove those responsibilities.
Before deciding, build a representative case with real sizes, numerical precision, operations and model state. First check values and gradients on a small CPU case; then examine compilations, memory, placement and communications on the target. Compare an existing solution within the same functional scope. These diagrams establish no general superiority over PyTorch or TensorFlow.
Resuming training usually requires more than weights: parameters, optimizer state, statistics, step counter, data progress and PRNG keys, together with configuration and versions. Restore and compare the next step against a controlled reference; that is stronger evidence than successful loading alone. For a new installation, select a maintained, qualified version after reviewing its advisories; retain 0.4.32 as historical context.
- Compatibility evidence
- Locked dependencies and module, gradient, save and recovery tests on the actual platform.
- Performance evidence
- A synchronized, repeated and documented measurement that separates preparation and execution as needed.
- Dossier limitation
- Archive sources and checked algebraic calculations; no JAX/Flax installation, GPU, TPU or local benchmark.
ORIGINAL DOCUMENT
Catalog record
2. Low-level software, compilers and training frameworks
JAX jax.readthedocs.io v0.4.32 / Flax v0.8.x — Innovation: 9, Adoption: 7
Editorial source: Taxonomie des Technologies d'Intelligence Artificielle · § 5934. Addresses restored with dots; innovation and adoption scores remain those of the document.
VERIFY AND EXPLORE
References
The original historical listing is preserved. Mechanisms are examined in the JAX 0.4.32 tag and, to give the Flax 0.8.x family a precise documentary anchor, the 0.8.5 tag. Archives consulted on November 4, 2026 do not constitute an installed, tested environment. No JAX/Flax training run or benchmark was executed for this dossier.
- 01JAX 0.4.32: release and withdrawal warning
Source of the TPU data-corruption warning for multiple slices in one job. Withdrawal is central to the historical scope.
github.com · - 02JAX 0.4.32: changelog at the tag
Documents broader asynchronous CPU dispatch, release changes and the earlier removal of xmap; distinct from current release notes.
raw.githubusercontent.com · - 03Flax 0.8.5: dependency manifest
Declares JAX ≥ 0.4.27 and Python ≥ 3.9. Satisfying a constraint does not qualify execution.
github.com · - 04JAX 0.4.32: package configuration
Python ≥ 3.10 and JAX/jaxlib dependencies. The manifest does not lock the entire environment.
raw.githubusercontent.com · - 05JAX: automatic differentiation, 0.4.32 archive
Scalar-output contract for grad, composition and value_and_grad. Example numbers are original calculations.
raw.githubusercontent.com · - 06JAX: automatic vectorization, 0.4.32 archive
Shared and mapped argument axes and composition with jit; no hardware-distribution promise.
raw.githubusercontent.com · - 07JAX: just-in-time compilation, 0.4.32 archive
Tracing, program representation, static arguments and compilation caching.
raw.githubusercontent.com · - 08JAX: constraints and sharp edges, 0.4.32 archive
Purity, side effects, shapes and behavior that differs from ordinary Python.
raw.githubusercontent.com · - 09JAX: pytrees, 0.4.32 archive
Registered containers, leaves and structure matching under transformations.
raw.githubusercontent.com · - 10JAX: stateful computations, 0.4.32 archive
State passed as arguments and explicitly returned to support transformations.
raw.githubusercontent.com · - 11JAX: pseudorandom numbers, 0.4.32 archive
Explicit keys, splitting and the difference from global-state generators.
raw.githubusercontent.com · - 12JEP 9263: typed keys, 0.4.32 archive
Key shape and dtype; coexistence of newer and older constructors.
raw.githubusercontent.com · - 13Flax: Linen introduction, 0.8.5 archive
Module descriptions and init/apply separation. Historical unlocked notebook installation instructions are not reused.
raw.githubusercontent.com · - 14Flax: parameters and state, 0.8.5 archive
Collections, auxiliary outputs and retention of state updates.
raw.githubusercontent.com · - 15Flax: NNX, 0.8.5 archive
Establishes NNX in this tag and an object-oriented interface distinct from Linen; current APIs are not projected backward.
raw.githubusercontent.com · - 16JAX: distributed arrays, 0.4.32 archive
Mesh, partition specification and placement. The notebook requires eight devices and was not run here.
raw.githubusercontent.com · - 17Flax: basics, 0.8.5 archive
Separate parameters, training and serialization. The dossier calculations do not reproduce a tutorial benchmark.
raw.githubusercontent.com · - 18Flax: Dense layer source, 0.8.5
Checks the bias and kernel-initialization options used in the documentary example.
raw.githubusercontent.com · - 19JAX: asynchronous dispatch, 0.4.32 archive
Why to wait for an output before stopping a timer; no source performance numbers are reproduced.
raw.githubusercontent.com ·
Catalog provenance
Taxonomie des Technologies d'Intelligence Artificielle · Google DocsSource document consulted on . § 5934.
Websites cited in the record
A website’s inclusion in the catalog does not verify the versions, projections or results mentioned in the document.
FROM KNOWLEDGE TO PROJECT
Apply this knowledge to your context.
Scope, architecture, roadmap and notes: keep your decisions in the dedicated space.



JAX / Flax