Skip to content

About

train your sae, interpret your llm

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

nanointerpret

Nanointerpret objective is being a minimal but full-fledged interpretability playground where you can:

  • Train your own SAE
  • Record SAE feature activations
  • Interpret and filter the features with any LLM
  • Explore the features in a local dashboard and steer the model with them

How does this work?

  1. train.py: runs the LLM over data mix (web, PDF, code, math, multilingual content) captures the residual stream at one layer, and trains a Top-K SAE on it.
    • Attention-sink tokens and massive-activation dimensions are kept out of the SAE
    • the SAE is judged by how little it changes the LLM's predictions when its reconstruction is fed back in (downstream KL).
    • See methodology, hyperparameters, ablations, massive activations behind the defaults.
  2. record_activations.py: runs the trained SAE over held-out text
  3. interpret.py: an LLM names each feature from its activations, then the name is checked on held-out tokens + tests, and by steering the model along the feature (how it works).
  4. explore.py: serves a local dashboard to browse the features and steer the model.

Train your SAE

  1. Prepare the environment:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
  1. Then proceed to a guide:

Comparison with Qwen-Scope

Nanointerpret Qwen3 1.7B SAE (layer 11, k50, 1B tokens) vs its Qwen-Scope equivalent.

Table of both SAEs' key metrics on the validation split, and their downstream KL with paired gap and 95% confidence intervals, by test set and source

Interpretation pipeline

For each feature: sample recorded activations, write a title and description, check them on held-out tokens, write test texts that the studied model scores, and steer along the decoder direction

About

train your sae, interpret your llm

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages