← all repositories
google/flax

JAX neural nets you can actually mutate like Python objects

It exists so researchers can build and inspect JAX neural networks using ordinary, mutable Python objects instead of fighting functional indirection.

7.3k stars Jupyter Notebook ML Frameworks
flax
Not currently ranked — collecting fresh signals.
star history

What it does

Flax is the dominant high-level neural network ecosystem for JAX, maintained by a dedicated team at Google DeepMind. It provides standard layers like Linear, Conv, and MultiHeadAttention, plus utilities for checkpointing, replicated training, and device prefetching. The project recently introduced Flax NNX, a simplified API that lets you define models with standard Python classes and mutation rather than wrestling with pure functional transformations.

The interesting bit

The big shift is philosophical: the original Linen API (2020) leaned heavily into JAX’s functional roots, but NNX explicitly reintroduces reference sharing and mutability. That means you can debug a model by simply inspecting a Python object or share state between layers without bending the framework into a pretzel.

Key highlights

  • First-class support for Python reference semantics, allowing standard object mutation and state sharing.
  • Ships with standard layers (Linear, Conv, BatchNorm, LSTMCell, GRUCell, MultiHeadAttention) and utilities for checkpointing, metrics, and replicated training.
  • Maintained by a Google DeepMind team in close collaboration with the JAX developers.
  • Explicitly built for research flexibility: the intended workflow is to fork an example and modify the training loop, not bolt features onto a monolithic framework.
  • Includes educational examples from MNIST to Gemma transformer inference.

Verdict

If you are doing research in JAX and want a library that gets out of your way when you need to hack on a training loop, this is the default choice. If you are committed to PyTorch or Keras and have no interest in JAX, this will not change your mind.

Frequently asked

What is google/flax?
It exists so researchers can build and inspect JAX neural networks using ordinary, mutable Python objects instead of fighting functional indirection.
Is flax open source?
Yes — google/flax is open source, released under the Apache-2.0 license.
What language is flax written in?
google/flax is primarily written in Jupyter Notebook.
How popular is flax?
google/flax has 7.3k stars on GitHub.
Where can I find flax?
google/flax is on GitHub at https://github.com/google/flax.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.