Agent skill · AI & Agents

causal-tracing

Causal mediation analysis to identify which model components mediate specific behaviors. Use when investigating how information flows through the network and which neurons or layers are causally responsible for outputs.

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

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

Facts
Files in the skill folder: 2
SKILL.md size: 7 KB
Bundled scripts: none
Path: skills/ai-ml/causal-tracing/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

# Causal Tracing Causal tracing (causal mediation analysis) identifies which intermediate computations causally mediate the relationship between inputs and outputs. It reveals not just what correlates with behavior, but what causes it. ## Core Concepts ### Three Types of Causal Effects 1. **Total Effect**: Change in output when modifying input 2. **Direct Effect**: Effect of restoring a component from clean to corrupted run 3. **Indirect Effect**: Effect of corrupting a component in an otherwise clean run ### The Interchange Intervention Swap activations between two runs to test causal relationships: - **Source run**: Produces the activation value - **Base run**: Receives the swapped activation ## Setup ```python from nnsight import LanguageModel import torch model = LanguageModel("openai-community/gpt2", device_map="auto", dispatch=True) # Factual recall task base_prompt = "The Eiffel Tower is located in" # Expects: Paris source_prompt = "The Colosseum is located in" # Expects: Rome # Get target tokens paris_token = model.tokenizer(" Paris")["input_ids"][0] rome_token = model.tokenizer(" Rome")["input_ids"][0] ``` ## Computing Total Effect ```python with model.trace() as tracer: w

What's inside
Steps it walks through
  1. Core Concepts
  2. Three Types of Causal Effects
  3. The Interchange Intervention
  4. Setup
  5. Computing Total Effect
  6. Direct Effect (Restoration)
  7. Indirect Effect (Corruption)
  8. Position-Specific Causal Tracing
  9. Noising-Based Causal Tracing
  10. MLP vs Attention Decomposition
  11. Visualization
  12. Interpretation Guidelines
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the causal-tracing skill do?

Causal mediation analysis to identify which model components mediate specific behaviors. Use when investigating how information flows through the network and which neurons or layers are causally responsible for outputs.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill causal-tracing --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