penzai  by google-deepmind

JAX research toolkit for neural network building, editing, and visualization

Created 1 year ago
1,819 stars

Top 23.8% on SourcePulse

GitHubView on GitHub
Project Summary

Penzai is a JAX research toolkit designed for building, visualizing, and manipulating neural networks as functional pytree data structures. It targets researchers and engineers focused on model interpretability, ablation studies, and debugging, offering a declarative approach to model construction and modification.

How It Works

Penzai leverages JAX's pytree capabilities to represent neural networks as data structures, enabling programmatic inspection and modification. Key components include Treescope for enhanced pretty-printing of nested data, penzai.core.selectors for powerful pytree traversal and manipulation, and penzai.core.named_axes for a flexible named axis system that integrates seamlessly with JAX. The penzai.nn module provides a combinator-based API for defining models, supporting mutable state and parameter sharing at leaves.

Quick Start & Requirements

  • Install via pip: pip install penzai
  • Requires JAX installation (platform-dependent).
  • Recommended for Colab/IPython: treescope.basic_interactive_setup(autovisualize_arrays=True)
  • Documentation: https://penzai.readthedocs.io

Highlighted Details

  • Declarative neural network library with support for mutable state and parameter sharing.
  • Built-in support for loading and manipulating weights for Gemma, Llama, Mistral, and GPT-NeoX/Pythia architectures.
  • penzai.core.selectors offers generalized .at[...].set() functionality for complex pytree rewrites.
  • penzai.core.named_axes allows seamless switching between named and positional array indexing.

Maintenance & Community

  • This is not an officially supported Google product.
  • Citation available for research use: Johnson, Daniel D. "Penzai + Treescope: A Toolkit for Interpreting, Visualizing, and Editing Models As Data." ICML 2024 Workshop on Mechanistic Interpretability.

Licensing & Compatibility

  • License details are not explicitly stated in the README.

Limitations & Caveats

Penzai v0.2 introduced breaking changes to the neural network API, with a V2 API focusing on mutable state and parameter sharing. Users of the V1 API can access older behavior via penzai.deprecated.v1.

Health Check
Last Commit

2 months ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
12 stars in the last 30 days

Explore Similar Projects

Starred by Edward Sun Edward Sun(Research Scientist at Meta Superintelligence Lab), Phil Wang Phil Wang(Prolific Research Paper Implementer), and
1 more.

grain by google

0.9%
536
Python library for ML training data pipelines
Created 3 years ago
Updated 21 hours ago
Starred by George Hotz George Hotz(Author of tinygrad; Founder of the tiny corp, comma.ai), Patrick von Platen Patrick von Platen(Author of Hugging Face Diffusers; Research Engineer at Mistral), and
6 more.

jaxtyping by patrick-kidger

0.7%
2k
Typing library for array shapes/dtypes
Created 3 years ago
Updated 4 months ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Pawel Garbacki Pawel Garbacki(Cofounder of Fireworks AI), and
6 more.

tianshou by thu-ml

0.2%
9k
PyTorch RL library for algorithm development and application
Created 7 years ago
Updated 1 week ago
Starred by Aravind Srinivas Aravind Srinivas(Cofounder of Perplexity), Stas Bekman Stas Bekman(Author of "Machine Learning Engineering Open Book"; Research Engineer at Snowflake), and
4 more.

Awesome-pytorch-list by bharathgs

0.1%
16k
Curated list of PyTorch content on GitHub
Created 8 years ago
Updated 1 year ago
Feedback? Help us improve.