decoderesearch/SAELens

Training Sparse Autoencoders on Language Models

What it solves

SAELens addresses the challenge of understanding how neural networks work internally. By providing tools to train and analyze sparse autoencoders (SAEs), it helps researchers decompose complex neural network activations into interpretable features, which is a critical step toward building safer and more aligned AI systems.

How it works

The library allows you to train your own sparse autoencoders or download pre-trained ones to analyze model behavior. It functions by extracting activations from a PyTorch-based model and passing them through an SAE's encode and decode methods. While it offers deep integration with TransformerLens, it is framework-agnostic and can be used with Hugging Face Transformers, NNsight, or any other PyTorch-based architecture.

Who it’s for

This library is designed for mechanistic interpretability researchers and AI safety practitioners who need to inspect the internal representations of neural networks to better understand their decision-making processes.

Highlights

  • Train custom sparse autoencoders from scratch.
  • Access and analyze a wide library of pre-trained sparse autoencoders.
  • Framework-agnostic design compatible with any PyTorch-based model.
  • Integration with external tools like SAE-Vis for generating feature dashboards.
  • Extensive tutorial suite covering training, loading, and evaluating SAE architectures.

Related

  • Project
  • Dispatch
  • Project
  • Project
  • Project