Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
input.txt
__pycache__/
*.pt
analysis.png
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ pip install -r requirements.txt
python train.py
```

`train.py` writes a checkpoint to `bdh_checkpoint.pt` (override with `BDH_CHECKPOINT=/path/to/ckpt.pt`) alongside generating a sample at the end of training.

## Interpretability Analysis

`analyze.py` loads a trained checkpoint and quantifies the sparsity and selectivity of the `xy_sparse` units in each BDH layer. It reports per-layer firing-rate statistics and surfaces the most selective neurons together with the byte-context that activated them most — candidate monosemantic detectors.

```bash
python train.py # produces bdh_checkpoint.pt + input.txt
python analyze.py # prints a report and writes analysis.png
```

Useful flags: `--n-batches`, `--batch-size`, `--top-n`, `--fire-threshold`. See `python analyze.py --help`. The figure output requires `matplotlib` (optional); the text report works without it.

<!--For visualization and interpretability analysis, explore the example notebooks in `notebooks/`.-->


Expand Down
Loading