transformer-lens-interpretability

Analyze transformer model internals with activation patching and circuit analysis.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/ricable/mcai --skill transformer-lens-interpretability-ricable
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: transformer-lens-interpretability
Source: https://github.com/ricable/mcai/tree/main/.agents/skills/transformer-lens-interpretability
Command: npx skills add https://github.com/ricable/mcai --skill transformer-lens-interpretability-ricable

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps researchers understand why a transformer model produces a specific output by exposing and editing internal activations without manual low-level instrumentation.

Core Features & Use Cases

  • Activation caching for residual streams, attention patterns, and MLP outputs.
  • Hook-based intervention for patching, ablation, steering, and causal tracing.
  • Workflow examples for circuit discovery, induction head detection, direct logit attribution, and logit lens analysis.
  • Use it to compare clean versus corrupted prompts, map influential heads, and test how specific layers affect predictions.

Quick Start

Use the transformer-lens-interpretability skill to inspect a transformer prompt, cache its activations, and report the most causally important layers or heads.

Frequently Asked Questions about transformer-lens-interpretability

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

FAQPage Schema
How do I perform activation patching on a GPT-style transformer model?

Activation patching on a GPT-style transformer requires caching internal activations and using HookPoints to intervene. You can compare clean versus corrupted prompts by patching cached residual streams or attention patterns to test causal tracing.

How do I find induction heads using TransformerLens?

To find induction heads, you cache attention patterns across layers and analyze the model's activations. This skill provides workflows to map influential heads and inspect attention circuits for sequence copying behavior.

Can I use logit lens inspection to trace transformer predictions across layers?

Yes, logit lens inspection allows you to trace transformer predictions by applying the unembedding matrix to hidden residual stream states at each layer. This reveals how specific layers progressively affect the final output logits.

What is the best way to do circuit analysis without manual low-level instrumentation?

Circuit analysis without manual instrumentation involves using TransformerLens to expose and edit internal activations via hooks. You can perform ablation and steering experiments to map influential heads and test layer effects on predictions.

How do I set up steering experiments on cached activations in a transformer model?

Steering experiments on cached activations use hook-based interventions to modify residual streams during the forward pass. This allows you to alter the model's behavior and test how specific layers or attention heads affect predictions.

What is the best way to analyze transformer model internals for mechanistic interpretability?

Analyzing transformer model internals for mechanistic interpretability involves using TransformerLens to cache activations and apply hook-based interventions. This exposes residual streams and attention patterns to map circuit behavior.