Feature Dictionary Learning

Decompose dense LLM activations into sparse interpretable feature dictionaries.

75|7|Updated May 2, 2026
One-click install
npx skills add https://github.com/zjunlp/Mechanist --skill feature-dictionary-learning-zjunlp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Feature Dictionary Learning
Source: https://github.com/zjunlp/Mechanist/tree/main/skills/mechanism-skills/feature-dictionary-learning
Command: npx skills add https://github.com/zjunlp/Mechanist --skill feature-dictionary-learning-zjunlp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, transformer_lens, nnsight, sae-lens, dictionary_learning, huggingface_hub, einops, datasets, and includes references (resource) components.

What problem does it solve? Neuron-level units in large language models are polysemantic, making internal activations hard to interpret. This Skill decomposes a dense activation (residual stream, MLP output) into a sparse weighted sum of directions from an over-complete dictionary, turning black-box vectors into human-readable features. ## Core Features & Use Cases - Sparse Autoencoders (SAE): Train or load SAEs via SAELens to recover monosemantic features at a single activation site, with demos and references to Gemma Scope. - Transcoders: Map MLP input to output through sparse features for circuit discovery and replacement-context analysis, compatible with Anthropic's circuit-tracer. - Crosscoders: Learn a shared dictionary across layers or fine-tuned checkpoints to identify concepts introduced during chat fine-tuning. - ICA Lens baseline: Apply training-free Independent Component Analysis as a cheap first-pass interpretability lens before committing to dictionary training. - Use Case: Given a research question about what a Gemma 2 layer encodes, fit or load a dictionary, inspect top-activating features, and validate them with sparse probing or targeted perturbation. ## Quick Start Ask the assistant to decompose a chosen model layer's activations into sparse interpretable features using the SAE, transcoder, crosscoder, or ICA Lens submethod that fits your goal.

Frequently Asked Questions about Feature Dictionary Learning

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

FAQPage Schema
How do I train a sparse autoencoder on language model activations?

Use SAELens or the dictionary_learning library: capture activations at a hook point with TransformerLens or nnsight, then train with an L1 or top-k sparsity penalty. Pretrained SAEs are also available from Neuronpedia and HuggingFace.

What is the difference between SAEs, transcoders, and crosscoders?

SAEs reconstruct activations at a single site. Transcoders map MLP input to output, enabling circuit replacement. Crosscoders share one dictionary across layers or model checkpoints to compare features between base and fine-tuned models.

When should I use ICA Lens instead of training an SAE?

Use ICA Lens as a training-free first pass when exploring a new model or hook point, or as a baseline to score a learned dictionary against. Escalate to SAEs when you need over-complete coverage or explicit circuit-replacement mappings.

Can I compare features between a base model and its fine-tuned version?

Yes, crosscoders train a shared dictionary on paired checkpoints such as a base and chat-tuned model. Features specific to the fine-tuned model reveal concepts introduced during fine-tuning, as shown in the BatchTopKCrossCoder work.

What are the limitations of feature dictionary learning?

Dictionaries suffer reconstruction error, dead features, feature splitting, and feature absorption. They are also site- and checkpoint-specific, so a dictionary trained on one layer or model rarely transfers to another.