penzai  by google-deepmind

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

created 1 year ago
1,805 stars

Top 24.4% 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

1 month ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
1
Star History
42 stars in the last 90 days

Explore Similar Projects

Starred by Dominik Moritz Dominik Moritz(Professor at CMU; ML Researcher at Apple), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
2 more.

ecco by jalammar

0%
2k
Python library for interactive NLP model visualization in Jupyter notebooks
created 4 years ago
updated 11 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), and
2 more.

maestro by roboflow

0.1%
3k
CLI/SDK for fine-tuning multimodal models
created 1 year ago
updated 5 days ago
Starred by Charlie Marsh Charlie Marsh(Founder of Astral; Author of Ruff, uv), Jiayi Pan Jiayi Pan(Author of SWE-Gym; AI Researcher at UC Berkeley), and
11 more.

flax by google

0.2%
7k
NN library for JAX, designed for flexibility in neural network research
created 5 years ago
updated 17 hours ago
Feedback? Help us improve.