Getting Started¶
Welcome to DeepLens! This guide will help you get up and running with mechanistic interpretability using Sparse Autoencoders (SAEs).
What is DeepLens?¶
DeepLens is a comprehensive library for mechanistic interpretability that provides end-to-end tools for:
- Feature Extraction: Extract MLP activations from transformer models
- SAE Training: Train sparse autoencoders with TopK or L1 regularization
- Feature Analysis: Decode and analyze learned features
- Feature Intervention: Manipulate features to understand their causal effects
Prerequisites¶
Before you begin, ensure you have:
- Python 3.11 or higher
- CUDA-compatible GPU (recommended for training)
- Basic knowledge of
transformersandPyTorch
Basic Workflow¶
DeepLens follows a simple four-step workflow:
- Collect Activations
- Create a Dataset
- Train a Sparse Autoencoder
- Analyze Features
- Intervene on Features
Currently Supported Models¶
Currently, DeepLens supports:
gpt2gpt2-mediumgpt2-largegpt2-xlmeta-llama/Llama-2-7b-chat-hfmeta-llama/Llama-3.2-1BTinyLlama/TinyLlama-1.1B-Chat-v1.0microsoft/phi-2microsoft/Phi-3.5-mini-instructmicrosoft/Phi-4-mini-instructmistralai/Mistral-7B-v0.1google/gemma-3-270mgoogle/gemma-7b-ittiiuae/falcon-7bQwen/Qwen2.5-7B-Instructdeepseek-ai/DeepSeek-R1-0528-Qwen3-8Bdeepseek-ai/DeepSeek-R1-Distill-Llama-8B
If any errors arise, feel free to open an issue on GitHub.
Next Steps¶
Now that you have DeepLens installed, explore these resources:
- Quickstart Guide: Complete example workflows
- Tutorials: In-depth guides for each component
- API Reference: Detailed API documentation
Getting Help¶
If you encounter issues:
- Check the documentation
- Search existing GitHub issues
- Open a new issue with a minimal reproducible example
Now let's learn how to Install DeepLens!