flax
Flax: A neural network library for JAX designed for flexibility
Decision gist · record as of 2026-08-14
Yes, if you are already committed to JAX and want a higher-level, more Pythonic API for neural networks. Flax NNX is actively maintained, has no known vulnerabilities, and offers genuine usability improvements over raw JAX. Install friction is low. The main condition is that JAX itself must be properly installed for your hardware, which is a separate step. Not recommended if you prefer a more batteries-included framework or are new to JAX.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11 or later and a working JAX installation (which itself requires separate setup for CPU, GPU, or TPU support).
- Low friction install as a pure Python wheel.
- Depends on JAX and several supporting libraries (numpy, msgpack, optax, orbax-checkpoint, tensorstore, rich, typing_extensions, PyYAML, treescope); JAX itself requires separate setup for CPU/GPU/TPU.
License · maintenance · safety
permissive license (permissive) — Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.
last release 2026-07-20 (25 days) · last repo commit 2026-08-12 · 7,296 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,616,508 downloads/mo, #2,273 on PyPI
Alternatives
Verify before relying
pip install flax
import flax.nnx as nnx
import jax
class MLP(nnx.Module):
def __init__(self, din, dout, rngs):
self.linear = nnx.Linear(din, dout, rngs=rngs)
def __call__(self, x):
return self.linear(x)
model = MLP(10, 2, rngs=nnx.Rngs(0))- Whether orbax-checkpoint, tensorstore, and treescope are always required or only for specific workflows.
- Performance characteristics compared to other JAX-based frameworks for large-scale training.
- Stability of the NNX API relative to the earlier Linen API for long-term projects.
What it is and what it does
Flax is a neural network library built on top of JAX that provides a higher-level API for defining and training deep learning models. Unlike JAX's functional approach, Flax NNX (released in 2024) uses Python reference semantics, allowing you to write models as regular Python classes with mutable state and object references—making them easier to inspect, debug, and reason about. It comes with standard layers (Linear, Conv, BatchNorm, LayerNorm, GroupNorm, MultiHeadAttention, LSTMCell, GRUCell, Dropout) and utilities for checkpointing, metrics, and distributed training.
Flax is designed for research flexibility: you modify training loops and experiment with new ideas by forking examples and changing code, rather than extending a framework with new features. It depends on JAX for computation, optax for optimization, and several checkpoint and serialization libraries. The library is actively maintained by Google DeepMind and has been in development since 2020, with the NNX simplification representing a significant usability improvement over the earlier Linen API.
Use it for
- Building and training transformer models, CNNs, and other neural architectures using Python class syntax instead of functional JAX code.
- Debugging and inspecting neural network state during training without the complexity of JAX's functional transformations.
- Research projects where you need to experiment with custom training loops and model architectures without framework constraints.
- Distributed training across multiple devices using Flax's replicated training patterns and checkpointing utilities.
- Inference with pretrained models like Gemma, leveraging JAX's performance on CPUs, GPUs, and TPUs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are already committed to JAX and want a higher-level, more Pythonic API for neural networks.
Flax NNX is actively maintained, has no known vulnerabilities, and offers genuine usability improvements over raw JAX. Install friction is low. The main condition is that JAX itself must be properly installed for your hardware, which is a separate step. Not recommended if you prefer a more batteries-included framework or are new to JAX.
Install
flax on PyPI
Before you install
Low friction install as a pure Python wheel. Depends on JAX and several supporting libraries (numpy, msgpack, optax, orbax-checkpoint, tensorstore, rich, typing_extensions, PyYAML, treescope); JAX itself requires separate setup for CPU/GPU/TPU. Actively maintained with recent releases.
Requires Python 3.11 or later and a working JAX installation (which itself requires separate setup for CPU, GPU, or TPU support).
License in practice
Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install flax
import flax.nnx as nnx
import jax
class MLP(nnx.Module):
def __init__(self, din, dout, rngs):
self.linear = nnx.Linear(din, dout, rngs=rngs)
def __call__(self, x):
return self.linear(x)
model = MLP(10, 2, rngs=nnx.Rngs(0))
Verify before relying
- Whether orbax-checkpoint, tensorstore, and treescope are always required or only for specific workflows.
- Performance characteristics compared to other JAX-based frameworks for large-scale training.
- Stability of the NNX API relative to the earlier Linen API for long-term projects.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 10 packagesnumpyjaxmsgpackoptaxorbax-checkpointtensorstorerichtyping_extensionsPyYAMLtreescope |
| Maintenance | Actively maintained 25 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,616,508 / month, #2,273 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: flax-0.12.8-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “JAX neural network library”
- flaxFlax is a neural network library for JAX that lets you build, train,…
- dm-haikuHaiku is a neural network library for JAX that provides an…
- equinoxEquinox provides neural network and model building on top of JAX with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also clu · dm-haiku · equinox · jraph · qwix · grain · google-tunix · optax · jax-dataclasses · orbax-export