TutorialStablesince v0.6.0

30-minute quick course

Install NeuronScope, record a run, and diff two checkpoints. End-to-end in six steps — no prior interpretability background required.

Audience: New usersRead: 30 minEdit on GitHub

1. Install

NeuronScope ships as a pure-Python wheel with an optional native accelerator. The base wheel is enough for this course.

shellbash
pip install neuronscope

2. Fingerprint a model

A fingerprint is the canonical identity of a model — its architecture, weights, and tokenizer collapsed to a 32-byte BLAKE3 digest. Two runs with the same fingerprint are byte-comparable.

quick_course.py·
·python
import neuronscope as ns
from transformers import AutoModel

model = AutoModel.from_pretrained("distilbert-base-uncased")
fp = ns.fingerprint(model)
print(fp.hex[:16])  # e.g. ""

3. Record activations

A recorder installs probes, iterates a dataset, and produces a .nsz artifact. The context manager guarantees hooks are removed even on error.

quick_course.py·
·python
ds = ns.datasets.tiny_imdb(n=64)

with ns.Recorder(model, probes=[ns.probes.Activations("encoder.layer.*.output")]) as rec:
    rec.record(ds)
    rec.save("baseline.nsz")

4. Inspect the artifact

The CLI reads .nsz files directly. ns show prints a summary of the run, including fingerprint, probe list, and per-layer tensor shapes.

shellbash
ns show baseline.nsz

5. Diff two runs

Re-run against a fine-tuned checkpoint and compare. ns diff refuses to compare runs whose fingerprints disagree on architecture — that would be a category error.

shellbash
ns diff baseline.nsz finetuned.nsz --metric cosine

6. Where to go next

Related