A JAX-based neural network library that provides a simple, object-oriented programming model for building and training models.
Haiku is a neural network library built on top of JAX that provides an object-oriented programming model for defining and training machine learning models. It solves the problem of managing model parameters and state in JAX by offering a familiar module-based abstraction, similar to Sonnet, while remaining fully compatible with JAX's functional transformations.
Researchers and engineers working with JAX who want a simple, object-oriented way to build neural networks, especially those transitioning from TensorFlow and Sonnet.
Developers choose Haiku for its simplicity and familiarity—it offers a minimal, library-focused approach to parameter management without introducing custom optimizers or frameworks, making it easy to integrate with the broader JAX ecosystem.
JAX-based neural network library
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses hk.Module subclasses that mirror Sonnet's design, allowing familiar object-oriented neural network construction, as shown in the user manual with examples like MyLinear.
hk.transform converts stateful modules into pure init and apply functions, seamlessly integrating with JAX transforms like jax.jit and jax.grad, demonstrated in the quickstart loss function.
Provides hk.next_rng_key() for deterministic random number generation within transformed functions, easing implementation of stochastic models like dropout or VAEs, as detailed in the working with stochastic models section.
APIs are designed to closely match Sonnet 2, making transition from TensorFlow straightforward, as emphasized in the 'Why Haiku?' section for reducing migration effort.
As noted in the README's IMPORTANT warning, Haiku is in maintenance mode with no new features being added, and DeepMind recommends Flax for new projects, limiting long-term viability.
Compared to Flax, Haiku has fewer examples, less extensive documentation, and a smaller community, which can hinder support and adoption for complex use cases.
Being a library focused on parameter management, it lacks built-in tools for optimization, checkpointing, and replication, requiring users to integrate additional libraries like Optax manually.