jax-ml/jax

Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more

35,266 stars Python 8 components 7 connections

Composable transformations for Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU

Python functions with NumPy arrays flow through tracers that record operations into Jaxpr intermediate representation, then get lowered to MLIR and compiled to XLA for execution on accelerators

Under the hood, the system uses 2 feedback loops, 2 data pools, 3 control points to manage its runtime behavior.

Structural Verdict

A 8-component ml training with 7 connections. 1218 files analyzed. Well-connected — clear data flow between components.

How Data Flows Through the System

Python functions with NumPy arrays flow through tracers that record operations into Jaxpr intermediate representation, then get lowered to MLIR and compiled to XLA for execution on accelerators

  1. Function Tracing — Python function called with Tracer inputs to record operation graph
  2. Jaxpr Construction — Traced operations converted to Jaxpr intermediate representation with typed variables
  3. MLIR Lowering — Jaxpr lowered to MLIR HLO dialect with shape/type information
  4. XLA Compilation — MLIR compiled to optimized XLA computation for target hardware
  5. Execution — Compiled function executed on CPU/GPU/TPU with actual array data

System Behavior

How the system actually operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

XLA Executable Cache (cache)
Compiled XLA computations cached by function signature
Tracer Stack (state-store)
Stack of active transformation contexts during tracing

Feedback Loops

Delays & Async Processing

Control Points

Technology Stack

XLA (infra)
Accelerated Linear Algebra compiler backend
MLIR (infra)
Multi-Level Intermediate Representation for compilation
NumPy (library)
Array API compatibility layer
Triton (infra)
GPU kernel compilation for Pallas
pytest (testing)
Testing framework
nanobind (library)
Python/C++ bindings for FFI

Key Components

Sub-Modules

Pallas (independence: medium)
GPU kernel programming framework with block-level operations and memory management
FFI Examples (independence: high)
Demonstration of foreign function interface for C/C++/CUDA integration

Configuration

docs/autodidax2_part1.py (python-dataclass)

docs/autodidax2_part1.py (python-dataclass)

docs/the-training-cookbook.py (python-dataclass)

jax/_src/api.py (python-dataclass)

Science Pipeline

  1. Array Creation — jnp.array() or device_put() converts Python data to JAX arrays [arbitrary Python nested structure → JAX ShapedArray with inferred shape/dtype] jax/_src/array.py
  2. Function Tracing — Replace arrays with Tracers to record computation graph [concrete arrays → abstract ShapedArray values] jax/_src/core.py
  3. Shape Inference — Propagate abstract shapes through operations without computing values [abstract shapes → inferred output shapes] jax/_src/abstract_arrays.py
  4. Backend Lowering — Convert JAX operations to MLIR HLO with explicit tensor shapes [JAX abstract arrays → MLIR tensor types] jax/_src/interpreters/mlir.py

Assumptions & Constraints

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Ml Training Repositories

Frequently Asked Questions

What is jax used for?

Composable transformations for Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU jax-ml/jax is a 8-component ml training written in Python. Well-connected — clear data flow between components. The codebase contains 1218 files.

How is jax architected?

jax is organized into 4 architecture layers: Public API, Core Tracing, Interpreters, Backend Integration. Well-connected — clear data flow between components. This layered structure enables tight integration between components.

How does data flow through jax?

Data moves through 5 stages: Function Tracing → Jaxpr Construction → MLIR Lowering → XLA Compilation → Execution. Python functions with NumPy arrays flow through tracers that record operations into Jaxpr intermediate representation, then get lowered to MLIR and compiled to XLA for execution on accelerators This pipeline design reflects a complex multi-stage processing system.

What technologies does jax use?

The core stack includes XLA (Accelerated Linear Algebra compiler backend), MLIR (Multi-Level Intermediate Representation for compilation), NumPy (Array API compatibility layer), Triton (GPU kernel compilation for Pallas), pytest (Testing framework), nanobind (Python/C++ bindings for FFI). A focused set of dependencies that keeps the build manageable.

What system dynamics does jax have?

jax exhibits 2 data pools (XLA Executable Cache, Tracer Stack), 2 feedback loops, 3 control points, 2 delays. The feedback loops handle cache-invalidation and recursive. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does jax use?

4 design patterns detected: Tracer Pattern, Transformation Composition, Backend Dispatch, Abstract Interpretation.

Analyzed on March 31, 2026 by CodeSea. Written by .