Sonnet

Sonnet

โ˜… 4 ๐Ÿ”– 2500 saves ๐Ÿ’ฐ Free GitHub

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.

Overview

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.

Key Features

  • A rich library of ready-made modules: Linear, Conv1D/2D/3D, LSTM, GRU, BatchNorm, LayerNorm, embeddings and more
  • Transparent variable ownership, so parameters are easy to initialize, share, checkpoint and regularize
  • First-class support for distributed training with tf.distribute strategies, including TPU workflows
  • Utilities for optimizers (SGD, Adam, RMSProp), metrics and exponential moving averages of weights
  • Lightweight design with no hidden global state, making experiments reproducible and debuggable
  • The same library used inside DeepMind research codebases, battle-tested on large-scale projects

๐Ÿ’ณ Pricing

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.

Who Is It For

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.

๐Ÿš€ Visit Sonnet Official Site

๐Ÿšฉ Report an issue