causal-attribution

causal-attribution is a skill for Claude Code from zjunlp/Mechanist. It costs 49 tokens per session (646 once invoked), scanned A, original, MIT.

A group of methods for finding which internal parts of a language model are actually responsible for a particular output. They do this by deliberately changing or removing components and measuring the effect.

In plain words
What is it for?
Use it to investigate model mechanisms through causal tracing, patching, ablation, and attribution patching.
Why use it?
It distinguishes components that cause a behavior from components that merely appear alongside it. This provides stronger evidence about how the model works, although testing many components requires many model runs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the mechanist plugin — 54 skills, 4 agents shipped together

Good fit Use it to investigate model mechanisms through causal tracing, patching, ablation, and attribution patching.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zjunlp/mechanist/causal-attribution
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add zjunlp/Mechanist --skill causal-attribution
Clone the repo
git clone --depth 1 https://github.com/zjunlp/Mechanist

Made for: Claude Code.

Or install mechanist, the plugin that ships this one along with the rest of its 54 skills, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for causal-attribution

README.md
[![agentmods](https://agentmods.dev/badge/skills/zjunlp/mechanist/causal-attribution.svg)](https://agentmods.dev/skills/zjunlp/mechanist/causal-attribution)
Your own site
<a href="https://agentmods.dev/skills/zjunlp/mechanist/causal-attribution"><img src="https://agentmods.dev/badge/skills/zjunlp/mechanist/causal-attribution.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 646 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.00646
Opus 5 $0.00024 $0.00323
Sonnet 5 $0.00010 $0.00129
Haiku 4.5 $0.00005 $0.00065

Measured 7d ago against content hash 91b7adb84106, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

causal-attribution scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

The scan reads SKILL.md. This mod also ships 6 executable files (ablation/scripts/intervention_experiments.py, ablation/scripts/model_analysis.py, attribution-patching/scripts/ioi_dataset_usage.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mechanism-skills/causal-attribution/SKILL.md · 30 lines

How it starts

The opening of the file, as written. The whole thing — 30 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Advantage

Unlike Magnitude Analysis, which only establish correlation, Causal Attribution provides definitive evidence that a component is a functional driver of the model’s output. This allows researchers to distinguish essential mechanisms from features that are highly activated but causally irrelevant to the specific behavior.

Limitation

This rigor incurs a significant computational overhead. Verifying causality typically requires intervening on objects individually and performing a separate forward pass for each intervention. Consequently, the cost scales linearly with the number of objects analyzed, making it prohibitively expensive for dense, sweeping searches over large models. This inefficiency often necessitates the use of Gradient Detection, which utilizes gradients to rapidly approximate these causal effects, enabling efficient screening before performing expensive, fine-grained interventions.

Submethods

The intervention typically takes three forms: Patching, Ablation, or Attribution Patching.

  • Patching: This approach replaces an object computed from the original input with one computed from a counterfactual input to isolate specific information pathways. By systematically patching across layers and positions, one can localize exactly where task-specific information (e.g., factual knowledge) is introduced or transformed. You can find a demo for this method in ./patching. This demo illustrates the way to edit factual knowledge in large language models like GPT-2 or GPT-J, perform causal tracing to understand model behavior, or implement Rank-One Model Editing (ROME) to modify specific factual associations without retraining.

  • Ablation: Alternatively, ablation-based attribution explicitly “zeros out” or removes objects, and measures the resulting performance drop to determine their causal necessity. You can find a demo for this method in ./ablation. This demo shows dissecting-factual-predictions: Analyze and dissect factual recall in auto-regressive language models using attention knockout, hidden state analysis, and intervention techniques on GPT-2 and GPT-J models

Read the full file on GitHub · 30 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 30 lines · 49 tokens per session scan A 91b7adb84106

Subscribe to this mod's changes

causal-attribution is a skill published in the GitHub repository zjunlp/Mechanist (71 stars, last pushed 11d ago), licensed MIT. It adds 49 tokens to every session and 646 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.