Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sparse Autoencoder for GPT-2 Interpretability

An implementation of sparse autoencoders (SAEs) to decompose GPT-2 activations into interpretable features.

Overview

Training Details

  • Dataset: OpenWebText (10,000 examples, ~500K tokens)
  • Optimizer: Adam (lr=1e-3 with cosine annealing)
  • Epochs: 20
  • Loss: Reconstruction (MSE)

Example Features

Feature 6: "Temporal reference words indicating past states or events"

  • Activates on: previously, originally, once, initially

Feature 8: "Diplomatic/political relationships and negotiations"

  • Activates on: ties, relations, agreed, agreement, talks

Feature 34: "Sleep-related words and concepts"

  • Activates on: sleep, sleeping, sleeps, asleep

Installation

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Usage

  1. Extract activations: python src/extract_activations.py
  2. Train SAE: python src/train_sae.py
  3. Label features: python src/label_features.py
  4. Launch browser: streamlit run app.py

Files

  • src/sae_model.py - SAE architecture
  • src/train_sae.py - Training loop
  • notebooks/ - Analysis notebooks
  • data/ - Activations and labels

Future Work

  • Train on multiple layers
  • Compare different expansion factors
  • Test intervention capabilities
  • Scale to larger models

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages