sparse-autoencoder-training

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

Updated May 26, 2026
One-click install
npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill sparse-autoencoder-training-ruiyangruiyi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sparse-autoencoder-training
Source: https://github.com/ruiyangruiyi/hermes-agent/tree/main/optional-skills/mlops/saelens
Command: npx skills add https://github.com/ruiyangruiyi/hermes-agent --skill sparse-autoencoder-training-ruiyangruiyi

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 solves the challenge of making neural network internals interpretable by training and using Sparse Autoencoders (SAEs) to decompose dense activations into sparse, human-understandable features.

Core Features & Use Cases

  • Train custom SAEs with configurable sparsity/architecture (e.g., standard, gated, top-k) on activations from a chosen model and layer.
  • Load and analyze pre-trained SAEs to study feature activation patterns, reconstruction quality, and metrics like L0 and CE loss recovery.
  • Steer or attribute predictions by computing feature contributions to logits and applying feature directions via hooks for controlled generation.

Use case example: You are investigating superposition in a transformer layer and want to identify which sparse features are responsible for a concept (e.g., Paris-related associations), then test whether feature ablations change the model’s probability of the target token.

Quick Start

Use the sparse-autoencoder-training skill to train a sparse autoencoder for GPT-2 small residual stream activations at a chosen hook point and then report reconstruction and sparsity metrics.

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 on transformer activations using SAELens?

To train a sparse autoencoder with SAELens, you load a transformer model via transformer-lens, extract activations from a chosen hook point, and tune hyperparameters like the L1 sparsity penalty to produce sparse interpretable features.

What is the best way to study superposition in neural networks?

Studying superposition involves training sparse autoencoders to decompose dense neural activations into sparse, human-understandable features, allowing you to identify which feature directions represent overlapping concepts within a transformer layer.

Can I steer model generation using sparse autoencoder features?

Yes, model steering applies feature directions via transformer-lens hooks to control generation, allowing you to test whether ablating or amplifying specific sparse features changes the model's probability of target tokens.

Do I need PyTorch and transformer-lens to analyze pre-trained SAEs?

Yes, analyzing pre-trained SAEs requires installing sae-lens, transformer-lens, and PyTorch to load models, encode and decode activations, and evaluate reconstruction quality and metrics like L0 and CE loss recovery.

What sparse autoencoder architectures can I configure for feature discovery?

For feature discovery and mechanistic interpretability, you can configure standard, gated, or top-k sparse autoencoder architectures to enforce sparsity constraints on neural activations extracted from your chosen model layer.