Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

published · difficulty 4/5 · 16 min read

Reading map and next steps

Intuition

Build the mental picture first so the rest of the page has something to attach to.

PredictName the object in plain language, then predict what should change.Leave with one reusable mental picture before notation appears.

Large models do not usually store one clean concept per neuron.

Instead, many concepts are packed into the same activation vector. A direction might partly mean "Python code", partly mean "HTML tag", and partly mean "list formatting". This is the superposition problem: the model is using the same coordinates for several overlapping features.

A sparse autoencoder (SAE) tries to learn a better coordinate system.

  • The encoder looks at a dense activation and asks which hidden features are present.
  • The decoder turns those hidden features back into a reconstruction of the original activation.
  • The sparsity constraint says only a small number of features are allowed to fire for each token.

That is intended to make the latent code behave like a parts list for the residual stream. Instead of saying "this activation is a mysterious 4096-dimensional vector", we say "this activation seems to use a few reusable feature directions". The practical teaching knob is the explanatory budget per activation: how many features are you allowed to use before interpretability starts to melt into dense mush again?

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Math

Translate the story into symbols, assumptions, and a derivation you can inspect.

InspectTrack the same object through the notation and check each symbol.Leave with the invariant the equations preserve.

Let x∈Rdx \in \mathbb{R}^d be an activation vector from some model layer, often the residual stream.

Encode to sparse latents, decode back to the activation

An SAE maps xx into a sparse latent code z∈Rmz \in \mathbb{R}^m and reconstructs it as x^\hat x:

z=ReLU(Wenc(x−bpre)+benc),x^=Wdecz+bpre.z = \mathrm{ReLU}(W_{\text{enc}}(x - b_{\text{pre}}) + b_{\text{enc}}), \qquad \hat x = W_{\text{dec}} z + b_{\text{pre}}.

The columns of WdecW_{\text{dec}} act like a learned feature dictionary. If zjz_j is active, the jjth feature direction contributes to the reconstruction.

Reconstruction plus sparsity

The classic objective balances faithfulness and simplicity:

L=∥x−x^∥22+λ∥z∥1.\mathcal{L} = \lVert x - \hat x \rVert_2^2 + \lambda \lVert z \rVert_1.
  • ∥x−x^∥22\lVert x - \hat x \rVert_2^2 asks the dictionary to explain the real activation.
  • λ∥z∥1\lambda \lVert z \rVert_1 punishes too many active features.

If λ\lambda is too small, the code becomes dense and hard to interpret. If it is too large, reconstruction worsens and useful structure may be missed or pushed into inactive latents.

Top-k sparse coding

Some recent SAE work replaces the soft L1L_1 penalty with a hard "only keep the best kk features" rule:

a=ReLU(Wenc(x−bpre)+benc),z=TopK(a,k),x^=Wdecz+bpre,L=∥x−x^∥22.a = \mathrm{ReLU}(W_{\text{enc}}(x - b_{\text{pre}}) + b_{\text{enc}}), \qquad z = \mathrm{TopK}(a, k), \qquad \hat x = W_{\text{dec}}z + b_{\text{pre}}, \qquad \mathcal{L} = \lVert x - \hat x \rVert_2^2.

Here TopK(a,k)\mathrm{TopK}(a, k) keeps the kk largest nonnegative activation scores and sets the rest to zero.

Now kk is explicit: each activation gets a fixed budget of kept latent slots. This is easier to reason about pedagogically and makes the reconstruction versus interpretability tradeoff visible in one number.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Code

Keep the implementation aligned with the notation so the algorithm is legible.

TraceMatch variables to symbols before reading the implementation.Leave with a runnable witness for the math.
import numpy as np

rs = np.random.RandomState(0)
n, d, m, k = 256, 10, 24, 3
D_true = rs.randn(d, m); D_true /= np.linalg.norm(D_true, axis=0, keepdims=True)
Z_true = np.zeros((n, m))
for row in Z_true:
    row[rs.choice(m, k, replace=False)] = rs.uniform(0.5, 1.5, k)
X = Z_true @ D_true.T + 0.02 * rs.randn(n, d)


def train_sae(lam, steps=500, lr=0.05):
    W_enc, W_dec = 0.1 * rs.randn(m, d), 0.1 * rs.randn(d, m)
    for _ in range(steps):
        pre = X @ W_enc.T
        Z = np.maximum(pre, 0.0)
        X_hat = Z @ W_dec.T
        err = (X_hat - X) / n
        grad_dec = err.T @ Z
        grad_z = err @ W_dec + lam * (Z > 0) / n
        W_enc -= lr * ((grad_z * (pre > 0)).T @ X)
        W_dec -= lr * grad_dec
        W_dec /= np.linalg.norm(W_dec, axis=0, keepdims=True) + 1e-9
    Z = np.maximum(X @ W_enc.T, 0.0)
    X_hat = Z @ W_dec.T
    return np.mean((X - X_hat) ** 2), np.mean(np.count_nonzero(Z > 1e-3, axis=1))


faithful = train_sae(lam=0.0005)
sparse = train_sae(lam=0.30)
print("low lambda:  mse %.4f, avg active latents %.1f" % faithful)
print("high lambda: mse %.4f, avg active latents %.1f" % sparse)
assert sparse[1] < faithful[1] and sparse[0] > faithful[0]

This toy SAE trains an encoder and decoder dictionary on synthetic activations. Raising λ\lambda makes the latent code sparser on average, but the reconstruction error rises: exactly the local tradeoff the claim is about.

Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

Interactive Demo

Use direct manipulation to connect the explanation to a moving system.

ManipulateChange one control and predict the visible response before reveal.Leave with the observed invariant or a repaired model.

Live Concept Demo

Explore Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

The stage is code-native and interactive. Use it to test the explanation against the mechanism.

difficulty 4/5undergraduatecode-aligned
Demo inquiry checkpoint

Manipulate one control and predict the visible change.

01Choose lensTrace a quantity
02ObserveDemo state pending
03GroundName the equation, invariant, or control that explains it.
04CarryNext: circuit-discovery

Choose what to inspect in Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability. This shared fallback is an observation guide, not evidence of learning.

Loading interactive demo...

Use the demo to explore the main SAE design tradeoff:

  • how reconstruction error falls as more features are allowed to fire,
  • how this toy frontier illustrates an L1L_1 shrinkage failure mode and contrasts it with TopK and gated-style mechanisms,
  • and how "better reconstruction" is not the same thing as "cleaner, more interpretable features".
Section prompt

Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.

4/4 sections ready

Concept: Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math?

BeforeRepresentation Learning & Embedding GeometryNow4/4 sections readyTryManipulate one control and predict the visible change.Nextcircuit-discovery
Object contextRepresentation Learning
ConceptLearner lens

Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math?

Mode questionCan I say the mechanism back in one sentence before I reveal anything?

Start with the prediction checkpoint, then compare the reveal to the mental model.

Take this move

Study modes

Keep the object fixed; change the lens.

Route back through the notebook

Carry the same object through intuition, math, code, and demo.

4/4 sections ready
Carry inRepresentation Learning & Embedding Geometry

Bring the mental model from Representation Learning & Embedding Geometry; this page will reuse it instead of restarting from zero.

Work hereSparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

Carry outcircuit-discovery

The next edge should feel earned: use the demo prediction here before following circuit-discovery.

After The First Pass

Turn the concept into an inspected object.

The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.
ConceptSparse Autoencoders: Feature Dictionaries for Mechanistic InterpretabilityRepresentation Learning

Mechanism Storyboard

See the idea move before the page explains it

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

Demo notes open01 / Intuition
Editorial interpretability illustration of dense activations routed through sparse feature dictionary atoms and reconstructed outputs.
Prediction lens

Start with the picture, metaphor, or geometric mechanism.

Commit first

Before reading further, choose the kind of change Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability should make visible.

Visual Inquiry

Make the image answer a mathematical question

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

4/4 stages readyDemo notes connected
Prediction

Which visible object should carry the first intuition?

Commit first

Pick the cue that should make Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability easier to reason about before the page gives the answer.

Source Grounding

Canonical references for the mechanism on this page.

Object - ConceptSparse Autoencoders: Feature Dictionaries for Mechanistic InterpretabilityQuestion

What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math?

concept:representation-learning/sparse-autoencoders
Boundary

sources: bricken-2023-monosemanticity, gao-2024-scaling-sae

Check

Open the closest source note before trusting the local explanation.

Evidence

2 selected-object sources shown first; 2 references total.

Next move

Audit the claim boundary, then ask from the same selected object.

selected object source · article · 2023Towards Monosemanticity: Decomposing Language Models With Dictionary LearningBricken et al.
Located CF editorial boundary

Grounds sparse autoencoders as dictionary-learning tools for decomposing activations into more interpretable features.

Used here as

Bricken et al. ground SAEs as dictionary-learning tools for decomposing model activations into learned features. Gao et al. describe SAEs as reconstructing language-model activations from...

Caveat

Certifies only SAE reconstruction/sparsity: decoder dictionaries reconstruct LM activations from sparse latents under sparsity objectives. It does not certify universal monosemanticity, c...

Open source
selected object source · paper · 2024Scaling and evaluating sparse autoencodersGao et al.
Located CF editorial boundary

Grounds SAE scaling and evaluation tradeoffs for larger language-model activations.

Used here as

Bricken et al. ground SAEs as dictionary-learning tools for decomposing model activations into learned features. Gao et al. describe SAEs as reconstructing language-model activations from...

Caveat

Certifies only SAE reconstruction/sparsity: decoder dictionaries reconstruct LM activations from sparse latents under sparsity objectives. It does not certify universal monosemanticity, c...

Open source

Claim Review

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

Object - ConceptSparse Autoencoders: Feature Dictionaries for Mechanistic InterpretabilityQuestion

What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math?

concept:representation-learning/sparse-autoencoders
Boundary

sources: bricken-2023-monosemanticity, gao-2024-scaling-sae

Check

Treat every claim as provisional until source support and a local witness agree.

Evidence

1 structured claim check on this concept.

Next move

Run the prediction or practice transfer before asking for a grounded review.

1 CF editorial source-scope review recorded

Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 2 references and 3 local witnesses are available for inspection.

Sparse autoencoders learn decoder dictionaries that reconstruct language-model activations from sparse latent codes, trading reconstruction error against sparsity so each activation uses a small set of active latents.
Used here as

Bricken et al. ground SAEs as dictionary-learning tools for decomposing model activations into learned features. Gao et al. describe SAEs as reconstructing language-model activations from a sparse bottleneck...

Local witness
Equation 1
z=ReLU(Wenc(x−bpre)+benc),x^=Wdecz+bpre.z = \mathrm{ReLU}(W_{\text{enc}}(x - b_{\text{pre}}) + b_{\text{enc}}), \qquad \hat x = W_{\text{dec}} z + b_{\text{pre}}.
Equation 2
L=∥x−x^∥22+λ∥z∥1.\mathcal{L} = \lVert x - \hat x \rVert_2^2 + \lambda \lVert z \rVert_1.
Caveat

Certifies only SAE reconstruction/sparsity: decoder dictionaries reconstruct LM activations from sparse latents under sparsity objectives. It does not certify universal monosemanticity, causal completeness,...

Review stateCF editorial source-scope reviewClaim metadata: source checkedPublisher-side editorial review only; not independent replication. Check caveats and exact source scope.

Bricken et al. support SAE dictionary learning over transformer activations with a ReLU encoder, decoder/dictionary reconstruction, MSE plus L1 sparsity, and hidden activations as learned features. Gao et al. support language-model activation reconstruction from sparse bottlenecks, L0/MSE evaluation, and reconstruction-sparsity plus TopK direct sparsity control. Local math and code witness the bounded mechanism; the synthetic demo is intentionally outside claim refs.

Reviewer: codex+oracle+codex-5.3; reviewed 2026-05-08

Practice · Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

Try the idea in your own words

Sparse autoencoders learn a reusable dictionary of feature directions so dense model activations can be explained by a small set of interpretable latent factors.

Concept · Current object

Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

Source boundary: sources: bricken-2023-monosemanticity, gao-2024-scaling-sae

Object context and links

Representation Learning

concept:representation-learning/sparse-autoencoders
Choose a task

Explain the mechanism

For Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability: What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math? Explain your answer, including what changes, why, and which assumption matters.

No answer yet

A rough first thought is enough. Your draft stays when you change tasks.

Local to this page session. Not saved after leaving or reloading.

A little help · Explain

Open one hint at a time. These are suggestions, not your answer or a grade.

0 of 3 hints shown for this question.

    Clearing your answer does not erase help history. Outside help cannot be verified here.

    Where am I stuck? (optional)
    Your own description, not an automatic diagnosis

    Choose one, or leave this unspecified. Select it again to clear it.

    Take your draft to a feedback conversation

    No AI feedback runs here. You can copy a prompt to use elsewhere; nothing is sent automatically. Review the text before sharing, and leave out private information.

    Write an attempt before copying a feedback prompt.

    This draft and any AI response do not establish mastery. Try a different case later without help; this page has not measured that learning.

    Grounded object roomClose
    Selected object routeAsk from this object; carry one invariant back.sources: bricken-2023-monosemanticity, gao-2024-scaling-sae
    1. ObjectConceptSparse Autoencoders: Feature Dictionaries for Mechanistic Interpretab...
    2. PredictBefore revealSparse Autoencoders: Feature Dictionaries for Mechanistic Interpretab...
    3. WitnessCompare codeSparse Autoencoders: Feature Dictionaries for Mechanistic Interpretab...
    4. RoomAsk groundedChecking local snapshot
    ConceptSparse Autoencoders: Feature Dictionaries for Mechanistic InterpretabilityRepresentation Learning

    Research Room

    Attach the question to an exact object

    Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.
    Next local actionNo local draft saved yet

    Open the draft below to save one note and next action in this browser.

    conceptRepresentation Learning

    Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability

    Anchored question

    What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math?

    Source boundaryInspect source ids: bricken-2023-monosemanticity, gao-2024-scaling-saeStable content-object key attached
    Role lenses for this object

    These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.

    Learner evidence requestAsk what would make "Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability" feel predictable rather than familiar.
    Assumption

    Source ids bricken-2023-monosemanticity, gao-2024-scaling-sae must support the exact object, not just the surrounding topic.

    Source-checking summary

    Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.

    Proposed experiment

    Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.

    Next action

    The learner can state the mechanism in their own words

    Evidence4 checks
    PredictionChecking carried observation
    ActionReady for one action
    AILearner handoff ready
    Open source object
    01PredictionChecking browser-local route memory
    02EvidenceChecking for a carried observation
    03BoundaryInspect source ids: bricken-2023-monosemanticity, gao-2024-scaling-sae
    04Next moveSave one next action
    Local action draftNo local draft saved yetExpand only when ready to capture one local next action
    Local action draft

    This draft stays locally in this browser for concept:representation-learning/sparse-autoencoders.

    No local draft saved.
    Evidence to inspect
    • Source ids to inspect: bricken-2023-monosemanticity, gao-2024-scaling-sae
    • Definition, prerequisite, and contrast concept links
    • The equation or code witness that makes the concept operational
    • One demo state that shows the invariant instead of a slogan
    What would resolve this
    • The learner can state the mechanism in their own words
    • The learner can name the prerequisite that would repair confusion
    • The learner can predict how the mechanism changes under one perturbation
    Object-attached AI handoff

    I am working in Continuous Function's research reading room. Object: concept - Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability Object key: concept:representation-learning/sparse-autoencoders Context: Representation Learning Anchor id: concept/concept-notebook/representation-learning/sparse-autoencoders Open question: What is the smallest example that makes Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability click without losing the math? Evidence to inspect: - Source ids to inspect: bricken-2023-monosemanticity, gao-2024-scaling-sae - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids bricken-2023-monosemanticity, gao-2024-scaling-sae must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability" feel predictable rather than familiar." | assumption: Source ids bricken-2023-monosemanticity, gao-2024-scaling-sae must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: bricken-2023-monosemanticity, gao-2024-scaling-sae" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Sparse Autoencoders: Feature Dictionaries for Mechanistic Interpretability" feel predictable rather than familiar. - Assumption to keep visible: Source ids bricken-2023-monosemanticity, gao-2024-scaling-sae must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words

    concept/concept-notebook/representation-learning/sparse-autoencoders concept:representation-learning/sparse-autoencoders