Agent skill · AI & Agents

nnsight-basics

Core nnsight concepts for neural network interpretability. Use when setting up models, tracing activations, saving values, or making basic interventions on model internals.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill nnsight-basics --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 6 KB
Bundled scripts: none
Path: skills/ai-ml/nnsight-basics/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# NNsight Basics NNsight provides full access to neural network internals during forward passes. This skill covers the fundamental patterns for tracing, saving, and modifying activations. ## Installation ```python pip install nnsight pip install torch transformers ``` ## Loading Models **For language models (recommended):** ```python from nnsight import LanguageModel model = LanguageModel("openai-community/gpt2", device_map="auto", dispatch=True) ``` **For any PyTorch model:** ```python from nnsight import NNsight model = NNsight(your_pytorch_model) ``` ## The Tracing Context All interventions happen inside `model.trace()`. Your code interleaves with the forward pass. ```python with model.trace("The Eiffel Tower is in"): # Access any layer's output hidden_states = model.transformer.h[5].output[0].save() # Access final logits logits = model.lm_head.output.save() # Values available after tracing print(hidden_states.value.shape) ``` ## Accessing Module Values | Property | Returns | | -------- | ------- | | `.output` | Module's return value | | `.input` | First positional argument | | `.inputs` | All arguments (tuple + kwargs dict) | ```python with model.trace(prompt): layer_output = m

What's inside
Steps it walks through
  1. Installation
  2. Loading Models
  3. The Tracing Context
  4. Accessing Module Values
  5. Saving Values
  6. Basic Interventions
  7. Batched Processing with Invokers
  8. Cross-Prompt Interventions (Barriers)
  9. Multi-Token Generation
  10. Gradient Access
  11. Utility Features
  12. Remote Execution (NDIF)
  13. Common Pitfalls
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the nnsight-basics skill do?

Core nnsight concepts for neural network interpretability. Use when setting up models, tracing activations, saving values, or making basic interventions on model internals.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill nnsight-basics --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going