v0.9.2/Apache-2.0/Python 3.10+

An interpretability toolkit for neural networks.

NeuronScope is an open-source Python library for inspecting, probing, and visualizing internal activations of neural networks. It attaches to any PyTorch, JAX, or TensorFlow model, records intermediate tensors without modifying training code, and exposes them through a small, composable API designed for research reproducibility.

quickstart·
·python
from neuronscope import ExperimentBuilder, Scope
from torchvision.models import resnet50

model = resnet50(weights="DEFAULT").eval()

experiment = (
    ExperimentBuilder()
    .with_model(model)
    .with_layers(["layer2.0.conv1", "layer4.2"])
    .with_dataset("imagenet-val", split="val[:256]")
    .with_seed(0)
    .run()
)

print(experiment.summary())
experiment.save("run-001.nsz")

A recorded experiment in a dozen lines. Deterministic, portable, and diffable.

Install

Add NeuronScope to any Python 3.10++ environment

Ships as a pure-Python wheel with optional extras for the frameworks and visualizers you actually use. No native build step, no CUDA at install time.

[torch][jax][tf][viz][all]
Full installation guide
install·
·bash
pip install neuronscope
How it looks

Same primitives, Python or CLI

The Python SDK and the ns command are two surfaces over the same core. Anything you can record from a notebook, you can record from a script or a CI job.

→ Zero changes to model code→ Deterministic on CPU and CUDA→ Portable .nsz artifacts
quickstart·
·python
import torch
from torchvision.models import resnet50
from neuronscope import Scope

model = resnet50(weights="DEFAULT").eval()

with Scope(model, layers=["layer2.0.conv1", "layer4.2"]) as scope:
    logits = model(torch.randn(1, 3, 224, 224))

acts = scope.activations()
print(acts["layer4.2"].shape)   # -> torch.Size([1, 2048, 7, 7])
scope.save("run-001.nsz")
Principles

How the library is engineered

Every design decision NeuronScope makes is documented, versioned, and traceable back to these commitments.

Determinism
Bit-exact replay
Every recorded run pins seeds, dtypes, and device state. Rerun on a different machine and get the same tensors back.
Bounded overhead
Only what you subscribe to
Recording overhead is proportional to the layers you observe, not the model's size. Ignored layers are truly free.
Stable artifacts
.nsz format contract
The on-disk format is versioned with explicit forward and backward compatibility guarantees. Old artifacts open in new versions.
Portable
Framework-agnostic core
First-class adapters for PyTorch, JAX, and TensorFlow. Custom runtimes plug in through the same public adapter contract.
Documented
Every decision has a page
Non-trivial engineering decisions live as Architecture Decision Records — context, options, consequences.
Composable
Small, orthogonal primitives
Recorder, probe, artifact, and comparer are independent modules that compose into full research pipelines.
Contribute

Built by researchers and engineers, in the open

NeuronScope is developed on GitHub under the Apache-2.0 license. The project welcomes documentation, examples, adapters, and research contributions.