Skip to main content

CircuitKit

CircuitKit

Discover, evaluate, and intervene on circuits in transformer models.
One call takes a model + task to a discovered circuit, a 6-pillar faithfulness score, and a intervened HuggingFace checkpoint.

Python 3.10+ PyTorch 2.0+ License: LSAL v1.1 (source-available) Docs


CircuitKit is a framework for mechanistic interpretability. Given a model and a task, it discovers the circuit driving that behaviour, evaluates how faithful it is, and lets you act on it (prune, quantize, edit, steer, or fine-tune), then export a reloadable HuggingFace checkpoint.

No GPU required for the quickstart — GPT-2 runs on CPU in a few minutes.

Quick start

# CPU-only, no GPU needed:
pip install -e .

# For benchmarking, add: pip install -e ".[benchmarks]"
from circuitkit import Pipeline

pipe = Pipeline("gpt2", task="ioi")
pipe.discover(algorithm="eap-ig", sparsity=0.3)
pipe.evaluate()
pipe.prune()
pipe.export("./checkpoint")

Also works as a CLI and YAML config.

What is a circuit?

A circuit is the minimal set of attention heads and MLP layers in a transformer that drives a specific behaviour. Most interp tooling stops at "here is a subgraph with attribution scores." CircuitKit goes further: it prunes (or quantizes) the model down to that subgraph, exports a reloadable HuggingFace checkpoint, and measures how faithful the pruned model stays. Because the circuit is task-specific, this produces a task-specialized checkpoint — not a general-purpose compressed model.

What you can do

Capability What it means
Discover 13 algorithms across maturity tiers — 2 stable (EAP, EAP-IG), 2 experimental (ACDC, IBCircuit), 9 research
Evaluate 6-pillar faithfulness: causal patching, ablation, stability, robustness, baselines, generalization
Prune Structural weight pruning down to the circuit
Quantize Circuit-aware mixed-precision quantization (3/4-bit + protect tiers)
Edit ROME / MEMIT knowledge editing at circuit-identified components
Steer Activation steering at inference (no retraining)
Fine-tune Circuit-restricted LoRA — only circuit components update
Benchmark lm-evaluation-harness integration for compressed checkpoints

Why CircuitKit?

Instead of stitching together… …CircuitKit gives you
A separate repo per discovery algorithm, plus a pruning script and lm-eval-harness — wired together by hand One Pipeline: discover → evaluate → prune → export → benchmark
One-off data formats per tool Standard circuit artifact + HuggingFace checkpoint
GPT-2-only tooling Llama-3, Gemma, Qwen — with GQA, RoPE, chat templates
One faithfulness score 6-pillar evaluation suite

Next steps

Getting Started Install, quickstart, core concepts
User Guide Pipeline, custom data, evaluation, selectors, tasks
Algorithms EAP, ACDC, IBCircuit, CD-T — with stability tiers
Applications Pruning, quantization, editing, steering, fine-tuning
Examples Runnable scripts and notebooks (all CPU-friendly)
API Reference Full API and CLI reference

Tests

pip install -e ".[dev]"
pytest tests/ -q

Citation

@software{circuitkit2026,
  title  = {CircuitKit: Circuit Discovery, Evaluation, and Application Toolkit
            for Mechanistic Interpretability},
  author = {Seth, Pratinav and Gosalia, Hem and Kasliwal, Aditya
            and Sankarapu, Vinay Kumar},
  year   = {2026},
  version = {1.0.0},
  url    = {https://github.com/Lexsi-Labs/CircuitKIT}
}

License

Lexsi Labs Source Available License (LSAL) v1.1: free for research, evaluation, education, and audit; commercial use requires a separate license; responsible-use conditions apply. See LICENSE.md.

Metadata

Release files for circuitkit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for circuitkit 0.1.0
File Size Uploaded
circuitkit-0.1.0.tar.gz 1.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for circuitkit 0.1.0
File Interpreter ABI Platform
circuitkit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.0 MB

Release files / circuitkit-0.1.0.tar.gz

Download URL circuitkit-0.1.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
676c899d907b9be0dd39d64909db1acf7896deab98215b91b283f9e801596494
BLAKE2b-256 checksum
How to use checksums
e343c3e57170c305d29703fbf4fedd5fb185c116bc8e35d0bfe471510a665b52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / circuitkit-0.1.0-py3-none-any.whl

Download URL circuitkit-0.1.0-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
db91142e797c68b8868997c2fa7a686806a94ccceaf6b0fafe27d5b3d265274a
BLAKE2b-256 checksum
How to use checksums
f8c373927938584f35b175cad2e619a665f108d5e055a1e46d2b115427a7c0c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page