One-click install
npx skills add https://github.com/loteiron/ZeusAgent --skill saelens-loteiron
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: saelens
Source: https://github.com/loteiron/ZeusAgent/tree/main/optional-skills/mlops/saelens
Command: npx skills add https://github.com/loteiron/ZeusAgent --skill saelens-loteiron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sae-lens, transformer-lens, torch, and includes references (resource) components.

What problem does it solve? Neural network neurons are polysemantic, activating for many unrelated concepts due to superposition, which makes model internals hard to interpret. This Skill guides training and analyzing Sparse Autoencoders (SAEs) with SAELens to decompose dense activations into sparse, monosemantic, interpretable features. ## Core Features & Use Cases - Pre-trained SAE Analysis: Load SAEs from releases like gpt2-small-res-jb, encode activations into sparse features, and inspect top-activating features per token. - Custom SAE Training: Configure and train Standard, Gated, TopK, or JumpReLU SAEs with v6 nested configs, L1 warm-up, and W&B logging, monitoring L0, CE loss recovery, and dead feature ratios. - Feature Steering & Attribution: Compute per-feature logit contributions, steer generation by adding decoder directions, and ablate features to test causal importance. - Use Case: A researcher wants to know which features in GPT-2 drive the prediction of " Paris". They load the layer-8 residual SAE, compute feature attributions via decoder weights and the unembedding matrix, then steer or ablate the top features to verify their causal role. ## Quick Start Ask the agent to load the gpt2-small-res-jb sparse autoencoder for layer 8 and show the top-activating features for each token in a sample prompt.

Frequently Asked Questions about saelens

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train a sparse autoencoder with SAELens?▼

Use LanguageModelSAERunnerConfig with a nested StandardTrainingSAEConfig specifying d_in, d_sae, and l1_coefficient, then run LanguageModelSAETrainingRunner. Enable l1_warm_up_steps around 1000 to prevent early feature death and monitor L0 and CE loss score.

How do I load a pre-trained SAE in sae-lens v6?▼

Call SAE.from_pretrained with a release and sae_id, such as gpt2-small-res-jb and blocks.8.hook_resid_pre. In v6 this returns just the SAE object; use from_pretrained_with_cfg_and_sparsity if you also need the config dict and sparsity.

What changed in sae-lens v6 configuration?▼

Version 6 uses nested configs: SAE options like d_sae and l1_coefficient move into a sae sub-config such as StandardTrainingSAEConfig, and logging moves into a LoggingConfig. Legacy flat options like hook_layer, architecture, and use_ghost_grads were removed.

Why does my SAE have a high dead feature ratio?▼

Dead features usually result from applying the full L1 penalty too early. Set l1_warm_up_steps to around 1000 so the sparsity penalty ramps up gradually, and consider lowering l1_coefficient if reconstruction quality also suffers.

When should I use TransformerLens instead of SAELens?▼

Use TransformerLens directly for basic activation analysis or causal intervention experiments that do not require learned sparse features. SAELens is appropriate when you need to discover interpretable features, study superposition, or perform feature-based steering.

How do I steer model generation with an SAE feature?▼

Extract the feature direction from sae.W_dec at the desired feature index, then register a forward hook on the target hook point that adds the scaled direction to the residual stream during model.generate.