Practical overview
When it fits
Use Haiku when a JAX project needs its module-based model and parameter-management abstractions, particularly when working with existing Haiku code. Account for its maintenance-mode status when choosing a dependency for a new project.
Who it is for
- Python developers building neural-network models with JAX.
- Researchers and engineering teams maintaining Haiku-based experiments or projects.
- Developers familiar with Sonnet’s module-oriented programming model who want a similar interface in JAX.
Documented uses
- Define reusable neural-network components and modules.
- Manage model parameters and initialize them from example inputs.
- Transform model functions for use with JAX tools such as automatic differentiation and JIT compilation.
Requirements & limits
The project is available as a public repository under the Apache-2.0 license. Installation instructions offer pip installation from PyPI or the repository.
- JAX must be installed separately, with the installation choice depending on accelerator requirements.
- Haiku is in maintenance mode; the project recommends Flax for new projects.
- Haiku does not define custom optimizers, checkpointing formats or replication APIs.
- The library is written in Python and depends on C++ code through JAX.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Haiku after setting up JAX
Prepare a Python environment with JAX and Haiku installed.
Before you start
- A Python environment.
- JAX installed with accelerator support appropriate to the environment.
Steps
Follow the JAX installation instructions for the relevant accelerator setup.
Install Haiku with pip, either from PyPI using the command below or from the repository using the command below.
pip install -U dm-haikupip install git+https://github.com/deepmind/dm-haiku
Expected outcome
The environment has JAX and Haiku installed for use in Python projects.
Guide limitations
- Haiku does not list JAX as a dependency because JAX installation depends on CUDA and accelerator configuration.
- Examples may require additional packages.
Transform a model function for JAX
Turn a Haiku module-based model function into initialization and application functions.
Before you start
- Python with JAX and Haiku installed.
- A model function that defines or applies Haiku modules.
Steps
Define the model function using Haiku modules such as
hk.Linear.Pass the function to
hk.transformto obtain pureinitandapplyfunctions.Initialize parameters by calling
initwith a random key and example inputs.
Expected outcome
The transformed model has an initialization function that returns its parameters and an application function suitable for JAX transformations.
Guide limitations
- The repository’s example training loop also uses JAX and an input dataset; Haiku does not provide an optimizer, checkpointing format or replication API.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 10 October 2026
- Original website title
- google-deepmind/dm-haiku · Official homepage title · retained in its source language
Related options
Flax — The Haiku repository recommends Flax for new projects and describes it as having a broader feature set.

