--- id: sae-lens version: "6.49.1" license: MIT license_treatment: permissive maintenance: active --- # sae-lens — Training and Analyzing Sparse Autoencoders (SAEs) License: permissive · Maintenance: active · Downloads: 81.7K/mo ## What it is and what it does SAE Lens is a research library for training and analyzing sparse autoencoders (SAEs), a technique used to decompose neural network activations into interpretable features. It provides tools to train SAEs from scratch, load pre-trained models, and generate feature analysis dashboards. The library works with any PyTorch-based model but offers deep integration with TransformerLens and Hugging Face Transformers, allowing researchers to extract activations and pass them through the SAE's encode and decode methods. The package is designed for mechanistic interpretability research—understanding how neural networks work internally—with a focus on generating insights that support AI safety and alignment. It includes tutorials for loading pre-trained SAEs, analyzing features, and training on synthetic data, plus integration with visualization tools like SAE-Vis. The codebase is actively maintained and part of a broader ecosystem of interpretability projects. Use it for: - Train sparse autoencoders on transformer model activations to discover interpretable features. - Load and analyze pre-trained SAEs to understand what features a model has learned. - Generate feature dashboards and visualizations using SAE-Vis for mechanistic interpretability research. - Extract and study activation patterns from Hugging Face or custom PyTorch models using SAE inference. - Benchmark SAE architectures on synthetic data to evaluate design choices. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. SAE Lens trains and analyzes sparse autoencoders for mechanistic interpretability research, with built-in support for PyTorch models and deep integration with TransformerLens and Hugging Face Transformers. Yes, if you are doing mechanistic interpretability research or need to train and analyze sparse autoencoders. The library is actively maintained, has low install friction, carries a permissive license, and integrates well with standard ML frameworks. Not relevant for general-purpose ML tasks or applications that don't require feature-level interpretability analysis. ## Install pip install sae-lens uv add sae-lens poetry add sae-lens ## Installing sae-lens Before you install: Low friction installation with a pure-Python wheel. Active maintenance—released 4 days ago with 1503 repository stars. Requires 13 runtime dependencies including transformers, transformer-lens, and datasets; all are standard ML packages. License in practice: MIT license (permissive) places no restrictions on commercial or private use, modification, or redistribution. Quickstart: pip install sae-lens from sae_lens import SAE from transformers import AutoModel # Load a pre-trained SAE and use it with a model sae = SAE.from_pretrained("gpt2-small-sae") model = AutoModel.from_pretrained("gpt2") Requires Python 3.10 or later. PyTorch and transformers must be installed; SAE Lens handles this via dependencies. Verify before relying: - Whether pre-trained SAEs cover the specific models or architectures you need to analyze. - Performance characteristics and memory requirements for training SAEs on large models. - Compatibility with custom or non-standard model architectures beyond the documented integrations. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 81.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags sparse autoencoder training, mechanistic interpretability, neural network feature analysis, SAE analysis tools, interpretability research framework, transformer activation analysis, dictionary learning PyTorch, interpretability, mechanistic-interpretability, research [View on SkillFed](https://skillfed.io/packages/sae-lens) · [View on PyPI](https://pypi.org/project/sae-lens/)