eap-ig

Discovers computational circuits in transformer language models using Edge Attribution Patching with Integrated Gradients.

75|7|Updated May 2, 2026
One-click install
npx skills add https://github.com/zjunlp/Mechanist --skill eap-ig-zjunlp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: eap-ig
Source: https://github.com/zjunlp/Mechanist/tree/main/skills/mechanism-skills/circuit-discovery/attribution-based-edge-scoring
Command: npx skills add https://github.com/zjunlp/Mechanist --skill eap-ig-zjunlp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, transformer_lens, and includes scripts (resource) and references (resource) components.

What problem does it solve? Identifying which internal components of a large language model are responsible for a specific behavior is a core challenge in mechanistic interpretability. This Skill automates circuit discovery by scoring nodes and edges in a model's computational graph, so researchers can isolate and evaluate the subnetworks driving model behavior. ## Core Features & Use Cases - Attribution-Based Circuit Scoring: Computes indirect-effect scores for graph nodes and edges using methods including EAP, EAP-IG-inputs, EAP-IG-activations, exact computation, and clean-corrupted baselines. - Circuit Selection and Evaluation: Selects top-n scoring components as a circuit and evaluates its faithfulness by ablating non-circuit components and measuring metric drop. - Use Case: A researcher studying how GPT-2 solves the greater-than task builds a computational graph with TransformerLens, runs EAP-IG attribution with 5 integrated gradient steps, extracts the top-10 circuit, and verifies that ablating everything outside the circuit preserves task accuracy. ## Quick Start Use the eap-ig skill to run Edge Attribution Patching with Integrated Gradients on a TransformerLens GPT-2 model and evaluate the top-10 circuit on the greater-than task.

Frequently Asked Questions about eap-ig

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

FAQPage Schema
How do I discover circuits in a transformer model with EAP-IG?

Build a computational graph with Graph.from_model on a TransformerLens HookedTransformer, then call attribute with method EAP-IG-inputs and a metric function. Use graph.apply_topn to select the circuit and evaluate_graph to measure its faithfulness.

What attribution methods does the EAP-IG library support?

The attribute function supports exact, EAP, EAP-IG-inputs, EAP-IG-activations, and clean-corrupted methods. IG-based methods accept an ig_steps parameter controlling the number of integrated gradient steps.

Does EAP-IG work with models other than GPT-2?

Yes, it works with any autoregressive model loadable through TransformerLens as a HookedTransformer. The library assumes pre-layernorm residual stream conventions, so models must be compatible with TransformerLens.

How do I evaluate whether a discovered circuit is faithful?

Use evaluate_graph, which ablates components outside the selected circuit and measures the resulting metric drop against baseline performance. Intervention options include none, zero, mean, and mean-positional ablation.

What are the limitations of edge attribution patching?

Attribution methods approximate indirect effects and can be computationally expensive with large models or many IG steps. EAP is a first-order approximation, so exact computation is more accurate but significantly slower.