LLM Neuroanatomy Explorer — map what each transformer layer does
Project description
neuro-scan
LLM Neuroanatomy Explorer — map what each transformer layer does.
Companion to layer-scan: understand your model's layers before you duplicate them.
Ablation Sensitivity
Logit Lens Trajectory
Features
- Layer Ablation — zero out each layer, measure score impact
- Logit Lens — project hidden states to vocabulary space
- Tuned Lens — per-layer affine probes (Belrose 2023)
- Attention Entropy — measure head focus/diffusion
- Circuit Detection — find synergistic/redundant layer pairs
- Block Influence — single-pass importance estimation (ShortGPT)
- Cross-probe Analysis — universal vs task-specific layers
- Auto Layer Labeling — classify layers as reasoning/syntax/output/etc
- Interactive HTML Charts — Plotly visualizations
Install
pipx install neuro-scan
# or
pip install neuro-scan
Quick Start
# Full neuroanatomy map
neuro-scan map --model <path-or-hf-id> --probe math
# Individual analyses
neuro-scan ablate --model <path> --probe math
neuro-scan logit-lens --model <path> --probe math
neuro-scan attention --model <path> --probe math
# Circuit detection
neuro-scan circuit --model <path> --probe math --strategy fast
# Cross-probe
neuro-scan cross-probe --model <path> --probes "math,eq,json"
# Tuned lens
neuro-scan calibrate --model <path> --output lens.safetensors
neuro-scan logit-lens --model <path> --tuned-lens lens.safetensors
# Fetch pre-computed results (no GPU)
neuro-scan fetch --model Qwen/Qwen2-7B --probe math
Commands
| Command | Description |
|---|---|
map |
Full neuroanatomy (ablation + logit lens + attention + labeling) |
ablate |
Layer ablation sensitivity scan |
logit-lens |
Logit lens trajectory |
attention |
Attention entropy analysis |
circuit |
Detect synergistic/redundant layer pairs |
cross-probe |
Compare importance across probes |
compare |
Compare neuroanatomy across models |
calibrate |
Train tuned lens probes |
fetch |
Download pre-computed reports from HF Hub |
prompt-repeat |
Prompt repetition experiment |
probes |
List available probes |
Probes
| Probe | Samples | Tests |
|---|---|---|
math |
16 | Arithmetic, geometry, calculus |
eq |
12 | Emotions, social cues, sarcasm |
json |
10 | JSON extraction, schema compliance |
custom |
user-defined | Load from JSON file |
Backends
| Backend | Quantization | Attention |
|---|---|---|
transformers |
No | Full support |
exllamav2 |
GPTQ/EXL2 | Not supported |
References
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
neuro_scan-0.2.3.tar.gz
(201.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuro_scan-0.2.3.tar.gz.
File metadata
- Download URL: neuro_scan-0.2.3.tar.gz
- Upload date:
- Size: 201.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68bba06e6751fee05c54492a125eec21f0ccebeb47b4436944c017ad68a36a27
|
|
| MD5 |
0bd32a3a0a195a568de1857d8c2d145f
|
|
| BLAKE2b-256 |
f985a91356d0f72437870785751339ec65318fe6585864a072291072c8b811db
|
File details
Details for the file neuro_scan-0.2.3-py3-none-any.whl.
File metadata
- Download URL: neuro_scan-0.2.3-py3-none-any.whl
- Upload date:
- Size: 58.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac26327bf0bd90215d53ed3a4590ebbbe23229ddb53b8449680120019b283257
|
|
| MD5 |
a09073ea2e76eb889f56dc0e040be172
|
|
| BLAKE2b-256 |
6eba1883a84e8cd3da954fdfe75e95873dd9b5f352f3178888b7893a33882ab7
|