Training and Analyzing Sparse Autoencoders (SAEs)
Project description
SAE Lens
SAELens exists to help researchers:
- Train sparse autoencoders.
- Analyse sparse autoencoders / research mechanistic interpretability.
- Generate insights which make it easier to create safe and aligned AI systems.
SAELens inference works with any PyTorch-based model, not just TransformerLens. While we provide deep integration with TransformerLens via HookedSAETransformer, SAEs can be used with Hugging Face Transformers, NNsight, or any other framework by extracting activations and passing them to the SAE's encode() and decode() methods.
Please refer to the documentation for information on how to:
- Download and Analyse pre-trained sparse autoencoders.
- Train your own sparse autoencoders.
- Generate feature dashboards with the SAE-Vis Library.
SAE Lens is the result of many contributors working collectively to improve humanity's understanding of neural networks, many of whom are motivated by a desire to safeguard humanity from risks posed by artificial intelligence.
This library is maintained by Joseph Bloom, Curt Tigges, Anthony Duong and David Chanin.
Loading Pre-trained SAEs.
Pre-trained SAEs for various models can be imported via SAE Lens. See this page for a list of all SAEs.
Migrating to SAELens v6
The new v6 update is a major refactor to SAELens and changes the way training code is structured. Check out the migration guide for more details.
Tutorials
- SAE Lens + Neuronpedia
- Loading and Analysing Pre-Trained Sparse Autoencoders
- Understanding SAE Features with the Logit Lens
- Training a Sparse Autoencoder
- Training SAEs on Synthetic Data
- SynthSAEBench: Evaluating SAE Architectures on Synthetic Data
Join the Slack!
Feel free to join the Open Source Mechanistic Interpretability Slack for support!
Other SAE Projects
- dictionary-learning: An SAE training library that focuses on having hackable code.
- Sparsify: A lean SAE training library focused on TopK SAEs.
- Overcomplete: SAE training library focused on vision models.
- SAE-Vis: A library for visualizing SAE features, works with SAELens.
- SAEBench: A suite of LLM SAE benchmarks, works with SAELens.
Citation
Please cite the package as follows:
@misc{bloom2024saetrainingcodebase,
title = {SAELens},
author = {Bloom, Joseph and Tigges, Curt and Duong, Anthony and Chanin, David},
year = {2024},
howpublished = {\url{https://github.com/decoderesearch/SAELens}},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sae_lens-6.37.4.tar.gz.
File metadata
- Download URL: sae_lens-6.37.4.tar.gz
- Upload date:
- Size: 254.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b63a0431f64111d7ee1bce9eaad301d1c7013be0c055ff3210011957eb40cb5
|
|
| MD5 |
a97fd7313489561988b4399cd9077004
|
|
| BLAKE2b-256 |
abb9e698d286de19eb808536a837b1e629df2810f9850bd61197e3c1f1036ead
|
Provenance
The following attestation bundles were made for sae_lens-6.37.4.tar.gz:
Publisher:
build.yml on decoderesearch/SAELens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sae_lens-6.37.4.tar.gz -
Subject digest:
7b63a0431f64111d7ee1bce9eaad301d1c7013be0c055ff3210011957eb40cb5 - Sigstore transparency entry: 983763163
- Sigstore integration time:
-
Permalink:
decoderesearch/SAELens@3f0573694e9fbb8a0cb502f5a88456b511be95e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/decoderesearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@3f0573694e9fbb8a0cb502f5a88456b511be95e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sae_lens-6.37.4-py3-none-any.whl.
File metadata
- Download URL: sae_lens-6.37.4-py3-none-any.whl
- Upload date:
- Size: 288.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34dea42c0a6931c3e575e80da12117114e250298313d72c0605b4cc11866cbae
|
|
| MD5 |
00797f2dfef81defedf94a9a64226935
|
|
| BLAKE2b-256 |
5a9ee0fa11f2868a290f2217e783fdb4b2f978c8300c4c99f7b53d0bc46918fc
|
Provenance
The following attestation bundles were made for sae_lens-6.37.4-py3-none-any.whl:
Publisher:
build.yml on decoderesearch/SAELens
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sae_lens-6.37.4-py3-none-any.whl -
Subject digest:
34dea42c0a6931c3e575e80da12117114e250298313d72c0605b4cc11866cbae - Sigstore transparency entry: 983763169
- Sigstore integration time:
-
Permalink:
decoderesearch/SAELens@3f0573694e9fbb8a0cb502f5a88456b511be95e2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/decoderesearch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@3f0573694e9fbb8a0cb502f5a88456b511be95e2 -
Trigger Event:
push
-
Statement type: