sparse-autoencoder-training

Train and analyze Sparse Autoencoders with SAELens to decompose neural network activations into interpretable features.

1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill sparse-autoencoder-training-kaminocorp
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sparse-autoencoder-training
Source: https://github.com/kaminocorp/hermes-alpha-hunter/tree/main/skills/mlops/evaluation/saelens
Command: npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill sparse-autoencoder-training-kaminocorp

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 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 L1 warm-up, ghost grads, and W&B logging, then validate with L0, CE loss recovery, and dead feature metrics. - Feature Steering and Attribution: Compute per-feature logit contributions, steer generation by adding decoder directions to the residual stream, and ablate features to test causal importance. - Use Case: A researcher studying what GPT-2 has learned about geography loads a pre-trained SAE on layer 8, finds the features contributing most to the 'Paris' prediction, and steers generation by amplifying that feature direction. ## Quick Start Ask the agent to load the gpt2-small-res-jb pre-trained SAE with SAELens and show the top activating features for each token in a sample prompt.

Frequently Asked Questions about sparse-autoencoder-training

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

FAQPage Schema
How do I train a Sparse Autoencoder with SAELens?▼

Configure a LanguageModelSAERunnerConfig with your model name, hook point, d_sae expansion factor, L1 coefficient, and dataset, then pass it to SAETrainingRunner and call run(). Enable l1_warm_up_steps and use_ghost_grads to prevent dead features during training.

How do I load a pre-trained SAE for GPT-2?▼

Use SAE.from_pretrained with a release like gpt2-small-res-jb and an sae_id such as blocks.8.hook_resid_pre. Load the matching model with HookedTransformer from TransformerLens, then encode cached activations into sparse features.

What is the difference between Standard, Gated, and TopK SAE architectures?▼

Standard SAEs use ReLU with an L1 penalty for general-purpose training. Gated SAEs add a learned gating mechanism for better sparsity control, while TopK SAEs activate exactly K features per input for consistent sparsity levels.

Why does my SAE have many dead features during training?▼

Dead features usually result from applying a strong L1 penalty too early. Add l1_warm_up_steps of around 1000 to ramp the penalty gradually, and enable use_ghost_grads to revive features that stop activating.

Can SAE features be used to steer language model generation?▼

Yes, extract a feature direction from sae.W_dec and add it to the residual stream via a TransformerLens forward hook during generation. Scaling the direction by a strength parameter controls how strongly the feature influences output.

When should I use TransformerLens directly instead of SAELens?▼

Use TransformerLens directly for basic activation analysis or causal intervention experiments that do not require sparse feature decomposition. SAELens is specifically for discovering interpretable features, studying superposition, and feature-based steering.