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.
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.
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.
pip install neuronscopeNeuronScope's documentation is organized into portals. Every portal cross-links to the others so exploration is continuous, not a series of dead ends.
Install NeuronScope and record your first activation.
Concepts, semantics, and stability contracts for every primitive.
Every public class, function, and constant.
Task-oriented recipes with runnable code.
Guided walkthroughs at every level.
How NeuronScope is put together.
The interpretability work NeuronScope enables.
Contribute to NeuronScope.
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.
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")Every design decision NeuronScope makes is documented, versioned, and traceable back to these commitments.
Structured courses for students, researchers, ML engineers, and contributors — each with prerequisites and a verifiable outcome.
OpenCopy-pasteable Python and CLI recipes for the things people actually do with NeuronScope.
OpenThe layered design, the trade-offs, the flows, and the ADRs that shape every non-trivial decision.
OpenGitHub Discussions, Discord, the contributing guide, and the security policy in one place.
OpenNeuronScope is developed on GitHub under the Apache-2.0 license. The project welcomes documentation, examples, adapters, and research contributions.