Sonnet is an open-source neural network library built on top of TensorFlow 2 and developed by Google DeepMind. Hosted on GitHub with close to 10,000 stars, it gives researchers a clean, modular way to compose neural network components into larger models, and it remains actively maintained with updates in 2026.
Sonnet takes a simple idea seriously: a module is an object that owns its variables and exposes a pure function that maps inputs to outputs. Small building blocks such as linear layers, convolutions, normalizers and recurrent cells can be wired together freely, reused across experiments, and inspected like ordinary Python objects. Because it sits directly on TensorFlow 2, Sonnet models work naturally with eager execution, tf.function compilation and distributed training strategies, without a separate framework layer in between.
Sonnet is completely free and open source under the Apache License 2.0. There is no paid tier, hosted version or usage limit; you install it from PyPI and run it on your own hardware.
Sonnet suits machine learning researchers and engineers who already work in TensorFlow and want a tidier, more composable abstraction than raw tf.keras layers, especially for custom architectures and research prototypes where full control over parameters matters more than high-level automation.