projects / proj-flag-013
Next task →
Projects/Specializations/Sparse autoencoder feature analysis with activation patching
Level 5 · research · ~50 h

Sparse autoencoder feature analysis with activation patching

Combine sparse autoencoder feature extraction with causal activation patching to identify and validate interpretable features in a small transformer trained on a synthetic task with known latent factors.
Add to portfolio →

Problem statement

  • 01Combine sparse autoencoder feature extraction with causal activation patching to identify and validate interpretable features in a small transformer trained on a synthetic task with known latent factors.

Real-world motivation

  • 01Sparse dictionaries promise disentangled features, but only causal intervention can show that a feature actually drives the behavior it names.

Learning objectives

  • 01Train a sparse autoencoder on residual activations
  • 02Identify features aligned with known latent factors
  • 03Validate with targeted patching interventions

Technical architecture

  • 01overcomplete dictionary with L1 penalty
  • 02activation collection hooks
  • 03feature-conditioned patching

Mathematical foundations

  • 01$\min_\theta\lVert x-D\mathrm{ReLU}(Ex+b)\rVert^2+\lambda\lVert\mathrm{ReLU}(Ex+b)\rVert_1$
  • 02causal effect of clamping a feature to its high-activation value

Dataset and sources

  • 01synthetic task with controlled latent factors
  • 02WikiText-103 activation corpus

Step-by-step tasks

  • 01Train a transformer on a synthetic task with three known latent factors
  • 02Collect residual-stream activations
  • 03Train sparse autoencoders at several dictionary sizes
  • 04Find features that correlate with each latent factor
  • 05Patch feature activations and measure behavioral change
  • 06Test whether features are polysemantic across contexts

Implementation requirements

  • 01Use hooks to capture and modify activations
  • 02Normalize decoder columns
  • 03Sweep the L1 coefficient

Testing requirements

  • 01Check feature sparsity distribution
  • 02Verify patching changes the intended behavior
  • 03Confirm control features have minimal effect

Evaluation metrics

  • 01reconstruction MSE
  • 02L0 sparsity
  • 03factor alignment score
  • 04causal effect size

Expected outputs

  • 01SAE checkpoints
  • 02feature statistics
  • 03patching results
  • 04analysis report

Common failure modes

  • 01polysemantic features confound interpretation
  • 02patching high-activation features can damage other behaviors
  • 03dictionary collapse at large L1

Stretch goals

  • 01study feature cascades across layers
  • 02compare with PCA baselines

Research extensions

  • 01derive conditions for feature disentanglement under superposition
  • 02study feature universality across models

GitHub submission requirements

  • 01SAE and patching code
  • 02Feature analysis tables
  • 03Intervention experiments
  • 04Report with explicit caveats

Completion rubric

  • 01SAE trained and validated
  • 02feature alignment measured
  • 03causal patching performed
  • 04polysemany tested
  • 05claims calibrated

Submit when every rubric item is satisfied and your repository contains runnable code plus a reproduction command.