sparse-autoencoder-training

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

Updated May 2, 2026
One-click install
npx skills add https://github.com/qcmuu/AI-Research-Skills --skill sparse-autoencoder-training-qcmuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sparse-autoencoder-training
Source: https://github.com/qcmuu/AI-Research-Skills/tree/main/04-mechanistic-interpretability/saelens
Command: npx skills add https://github.com/qcmuu/AI-Research-Skills --skill sparse-autoencoder-training-qcmuu

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you train and analyze Sparse Autoencoders so you can decompose opaque neural activations into sparse, interpretable features that support feature discovery and mechanistic analysis.

Core Features & Use Cases

  • Train custom Sparse Autoencoders to reconstruct activations with a sparsity-promoting loss (MSE reconstruction + L1 feature penalty), including practical hyperparameter guidance.
  • Load and run pre-trained SAEs to encode activations into sparse features, measure sparsity (L0), and validate reconstruction quality (e.g., CE recovery).
  • Interpret and manipulate features with feature attribution, steering hooks, and common troubleshooting for dead features and poor reconstruction.
  • Use cases: discovering monosemantic/semantically meaningful features, studying superposition and feature geometry, and performing feature-based steering/ablation for mechanistic interpretability.

Quick Start

Ask an AI agent to train a Sparse Autoencoder on GPT-2 residual stream activations using SAELens with a specified model, hook point, expansion factor, and sparsity/L1 settings.

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 to decompose transformer activations into interpretable features?

To train a sparse autoencoder, configure the SAE architecture, d_sae, L1 coefficient, and warm-up steps using SAELens and TransformerLens. This decomposes opaque neural network activations into sparse, interpretable features for mechanistic interpretability analysis.

What is superposition analysis and when do I need sparse autoencoders for feature discovery?

Superposition analysis studies how neural networks represent more features than dimensions. You need sparse autoencoders to untangle these superposed activations into monosemantic, semantically meaningful features, validating results using sparsity metrics like L0 and reconstruction quality.

How do I evaluate sparse autoencoder reconstruction quality and sparsity metrics?

Evaluate sparse autoencoder reconstruction quality by measuring cross-entropy (CE) recovery and L0 sparsity metrics. These metrics validate whether the SAE successfully encodes activations into sparse features while maintaining the original model's performance.

Does SAELens work with TransformerLens for feature-based steering and ablation?

Yes, SAELens works with TransformerLens to perform feature-based steering and ablation. You can apply steering hooks and feature attribution to manipulate specific interpretable features extracted from transformer residual stream activations.

Why does my sparse autoencoder have dead features or poor reconstruction loss?

Dead features and poor reconstruction in sparse autoencoders often result from incorrect L1 coefficient settings or insufficient warm-up. Troubleshooting involves adjusting sparsity-promoting loss parameters to balance MSE reconstruction with the L1 feature penalty.

Can I load pre-trained SAEs to encode activations instead of training custom sparse autoencoders?

Yes, you can load and run pre-trained SAEs to encode activations into sparse features. This allows you to measure sparsity, validate reconstruction quality, and perform mechanistic interpretability without configuring and training a custom sparse autoencoder from scratch.