activation-patching

Patch transformer activations across layers, heads, and positions to identify causal components.

9|2|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/ndif-team/skills --skill activation-patching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: activation-patching
Source: https://github.com/ndif-team/skills/tree/main/plugins/nnsight/skills/activation-patching
Command: npx skills add https://github.com/ndif-team/skills --skill activation-patching

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Activation patching provides a causal intervention framework to identify which model components (layers, heads, or positions) drive a specific behavior by swapping activations and observing changes in outputs.

Core Features & Use Cases

  • Causal intervention across transformer components (layers, attention heads, token positions) to locate components critical for a behavior.
  • Three-run patching workflow: run clean, run corrupted, patch activations and measure impact to quantify causality.
  • Interpretability outputs and guidance for diagnosing circuits or computational stages in neural networks.

Quick Start

Run a clean prompt and a corrupted prompt, patch activations layer-by-layer, and measure the effect on outputs.

Frequently Asked Questions about activation-patching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does activation patching identify causally important components in transformers?

Activation patching identifies causally important components by swapping activations across layers, heads, and positions during prompt processing, then measuring the impact on outputs to quantify causality. It uses deterministic runs with clean and corrupted prompts to isolate critical circuits.

How do I run an ablation study to locate which attention heads drive a specific behavior?

To run an ablation study, execute a clean prompt and a corrupted prompt, save the activations, then patch the saved activations layer-by-layer or head-by-head. Measure the comparative metrics to locate the specific components driving the behavior.

What is the difference between activation patching and a standard ablation study?

A standard ablation study removes components to observe performance drops, whereas activation patching performs a causal intervention by swapping activations from a clean run into a corrupted run to precisely measure how specific components restore the original output.

Can I use activation patching to diagnose computational stages at the token position level?

Yes, you can use activation patching to diagnose computational stages at the token position level. The technique supports per-layer, per-head, and per-position patching across transformer components to locate critical circuits driving specific outputs.

Do I need to save activations from both clean and corrupted prompts to measure causal intervention?

Yes, you need to save activations from both clean and corrupted prompts. The three-run patching workflow requires deterministic runs of both prompts to successfully apply causal interventions and measure the resulting impact on model outputs.