Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SAE
✓ from sae_lens import SAE
Standard import for loading a pretrained SAE.
SAEConfig
✓ from sae_lens.config import SAEConfig
✗ from sae_lens import SAEConfig
SAEConfig is in sae_lens.config, not top-level.
HookedSAETransformer
✓ from sae_lens import HookedSAETransformer
Wraps a HookedTransformer to cache activations.
Load a pretrained SAE and compute feature activations for a prompt.
from sae_lens import SAE
from transformer_lens import HookedTransformer
model = HookedTransformer.from_pretrained("gpt2-small", device="cpu")
sae, cfg_dict, sparsity = SAE.from_pretrained(release="gpt2-small-res-jb", sae_id="blocks.0.hook_resid_pre", device="cpu")
sae.to("cpu")
# Example: get SAE feature activations for a prompt
prompt = "Hello, world!"
_, cache = model.run_with_cache(prompt, names_filter=[sae.cfg.hook_name])
act = cache[sae.cfg.hook_name]
sae_acts = sae.encode(act)
print(sae_acts.shape)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'sae_lens'
Package not installed.
fixRun `pip install sae-lens`.
AssertionError: Expected activation shape (batch, seq_len, d_model) but got ...
Activations passed to SAE.encode have incorrect shape or are on wrong device.
fixCheck that activations are a 3D tensor on the same device as the SAE. Use `sae.encode(act)` where `act` is shape (batch, seq_len, d_model).
ValueError: Unknown release: ...
Provided release name does not exist in the SAE registry.
fixUse a valid release name from `sae_lens.known_releases()` or check the docs.
Upgrade
Version history
6.44.3latest on PyPI · released Jun 16, 2026
Audit
Dependencies
torchrequiredCore dependency for tensor operations and model loading
transformer-lensrequiredUsed for model hooks and activation caching
datasetsrequiredFor loading activation datasets
wandboptionalOptional for experiment logging