TL;DR
This paper introduces NNsight and NDIF, an open-source framework designed to democratize interpretability research on massive open-weight AI models. By decoupling experimental design from model execution via a novel "intervention graph" architecture, researchers can inspect and manipulate the internals of frontier models (like Llama 3.1 405B) remotely without the prohibitive cost or engineering complexity of hosting them locally.
What Problem Does This Paper Address?
As AI models scale to hundreds of billions of parameters, a stark divide has emerged in the research community. While commercial APIs offer access to frontier models "as a service," they act as black boxes, withholding the internal activations and gradients crucial for mechanistic interpretability and safety research. Conversely, open-weight models allow for deep inspection, but hosting them requires massive, distributed GPU infrastructure that is financially and technically out of reach for most academic labs.
To quantify this, the authors surveyed 184 recent interpretability papers and discovered a glaring "interpretability gap": over 60% of papers published since February 2023 still focus on older, poorly performing models (<40% MMLU), simply because researchers lack the infrastructure to run experiments on state-of-the-art open models.
Methods
The authors bridge this gap by introducing a two-part ecosystem enabled by a new abstraction called the Intervention Graph:
- NNsight: An open-source Python library that extends PyTorch. It allows researchers to write standard, intuitive PyTorch code to define interventions (e.g., editing activations, capturing gradients) within a local tracing context (
with lm.trace()). Instead of executing immediately, NNsight uses deferred execution to compile these commands into a portable, serializable JSON-formatted Intervention Graph. - National Deep Inference Fabric (NDIF): A scalable, multi-user cloud inference service built on Ray. NDIF preloads massive foundation models across distributed GPU nodes. When a user submits an intervention graph via NNsight, NDIF deserializes it, interleaves the custom operations directly into the model's server-side forward or backward pass, and returns only the requested results (via
.save()).
Crucially, NDIF implements safe co-tenancy, ensuring that multiple users can run highly customized experiments concurrently on the same preloaded model instance without interfering with each other or permanently altering the base weights.
Datasets
The paper utilizes the following datasets and model suites for evaluation:
- Interpretability Literature Survey: A curated dataset of 184 papers extracted from a recent interpretability survey to analyze historical trends in model usage.
- Indirect Object Identification (IOI): A dataset used to benchmark the runtime of activation patching—a standard interpretability technique.
- OPT Model Family: Ranging from 125M to 66B parameters, used to evaluate scaling performance.
- Llama 3.1 Family: Specifically the 8B and 70B variants, used for real-world high-performance computing (HPC) benchmarks.
Key Insights and Ideas
- The Infrastructure Bottleneck: The primary reason researchers study outdated models isn't a lack of interest in frontier models, but the sheer engineering friction of model sharding, quantization, and memory management.
- Server-Side Execution Beats Swarms: Prior distributed inference frameworks like Petals rely on a peer-to-peer swarm where hidden states are passed back and forth over the internet to the user's local machine for interventions. NNsight/NDIF flips this: by sending the experiment logic (the graph) to the data, it eliminates massive network communication overhead.
- GOTO-like Graph Interleaving: The intervention graph effectively treats module inputs and outputs as entry points (GOTO statements), pausing the base model's computation to run custom user logic before seamlessly resuming.
Key Results
- Eliminating Setup Overhead: On traditional local HPC clusters, model loading times scale linearly with model size. NDIF bypasses this entirely by keeping models preloaded, reducing setup time to a negligible constant.
- Performance Crossover: For models larger than 3 billion parameters, running interventions remotely via NDIF becomes faster than running them on a dedicated local HPC node due to the elimination of weight-loading overhead.
- Outperforming Petals: In activation patching benchmarks, NDIF significantly outperformed Petals because it computes metrics server-side rather than transmitting heavy intermediate hidden states across the network.
Limitations and Future Work
- Closed-Source Models: The framework currently only works for open-weight models. While it is technically feasible for proprietary vendors (like OpenAI or Anthropic) to host an NDIF-style API securely without revealing their weights, they do not currently support it.
- Sequential Co-tenancy: The current deployment handles user requests sequentially via a queue. The authors note that future iterations will implement parallel co-tenancy via batch grouping, allowing multiple users' distinct interventions to be processed simultaneously within a single forward pass.
Summary updated