# SAE Lens

A Python library for training and analyzing sparse autoencoders on language models, used for mechanistic interpretability research.

SAELens is a library that helps researchers train sparse autoencoders (SAEs), analyze them for mechanistic interpretability, and generate insights into how language models represent information. Its inference code works with any PyTorch-based model, with deeper integration for TransformerLens through a `HookedSAETransformer` class, and it can also be used with Hugging Face Transformers or NNsight by extracting activations directly.

The library supports downloading and analyzing pre-trained SAEs as well as training new ones, and it works alongside companion projects such as SAE-Vis for visualizing features and SAEBench for benchmarking. It is written in Python and released under the MIT license.

Website: https://decoderesearch.github.io/SAELens/
