Skip to main content

circuitcheck

circuitcheck validate --demo: the toy model's planted switch comes back as a switch, its two readouts as readouts and its redundant pair as backups

Test what an attribution graph claims. circuitcheck is three tools on top of circuit-tracer attribution graphs:

Tool Question it answers Runs without a GPU on
circuitcheck validate Is a group of graph features a switch (it causes the behaviour) or a readout (it only reflects it)? the built-in toy model
circuitcheck diff Which features and edges did fine-tuning or RL add or remove, and is the change real? saved graph summaries
circuitcheck label What does each feature do, in a few words, and how far can that label be trusted? cached model replies

▶ Watch the 2.5-minute walkthrough · Use cases · circuitcheck vs circuit-tracer · Docs

It grew out of steerlab's circuits episodes. In a password lock and an RL reward hack, the graph's most influential features all turned out to be readouts. circuitcheck turns the checks behind that finding into reusable code.

Install

pip install circuitcheck        # after the first PyPI release; until then:
pip install "git+https://github.com/albertlieyingadrian/circuitcheck"
# real models: circuit-tracer from GitHub, plus torch
pip install "git+https://github.com/decoderesearch/circuit-tracer"
# labels: pip install "circuitcheck[anthropic]" (Claude Haiku 5.5, the default) or "[openai]"

Five-minute tour (no GPU, no key)

circuitcheck validate --demo --html validate.html
circuitcheck diff examples/data/rl_hack_graphs.json.gz --before installed/before --after installed/after \
  --control-before control/before --control-after control/after --html diff.html
from circuitcheck.validate import logit_diff, validate
from circuitcheck.validate.toy import demo, demo_nodes

backend = demo()
metric = logit_diff(backend.token_id(" Austin"), backend.token_id(" Sacramento"))
report = validate(backend, "dallas", demo_nodes(backend), metric=metric, counterfactual="oakland")
print([(g.name, g.verdict.value) for g in report.groups])
# [('top-5', 'switch'), ('L5/100@5', 'switch'), ('L7/200@5', 'readout'), ('L8/201@5', 'readout'), ...]

On a real model, circuitcheck.tracer.TracerBackend wraps a circuit-tracer ReplacementModel:

from circuit_tracer import ReplacementModel
from circuitcheck.tracer import TracerBackend

model = ReplacementModel.from_pretrained("google/gemma-2-2b", "gemma")
report = validate(TracerBackend(model), prompt, nodes, metric=metric, counterfactual=other_prompt)

What each tool checks

diff. Graphs of the same prompts before and after training are reduced to per-feature influence and feature-to-feature edges, summed over positions. Each feature gets a status (gained, lost, up, down, stable). The statuses are backed by:

  • a paired swap null: before and after labels are swapped at random within each prompt pair, with a Benjamini-Hochberg correction across features;
  • a bootstrap interval and a split-half check;
  • optionally, a control run (did the change happen only in the run that learned the behaviour?) and a replication seed.

The validity check compares replacement and completeness scores, error-node influence and per-layer reconstruction error (circuitcheck.tracer.reconstruction_error) before and after. The transcoders were trained on the base model, and the report says so every time.

validate. For each group of features:

  • ablation (set them to 0);
  • steering (multiply them by 3);
  • a counterfactual patch (copy their values from a prompt with a different answer);
  • each of the above on 20 random feature sets matched by layer and position, and on 20 sets matched by write size (|activation| x decoder norm).

The verdict follows printed rules: switch, partial, backup, nonspecific or readout. An optional explanation swap (Gao's test) runs label rules written as code in a checked sandbox. Output is JSON plus an HTML page.

labels. The pipeline:

  1. Explain each feature from its top activating records.
  2. Score the label on held-out records: detection AUROC (activating and silent excerpts) and, optionally, simulation correlation.
  3. Report calibration: stated confidence against the earned score, and the detector's expected calibration error.

Every reply is cached. Labels export in Neuronpedia's explanation format, and Neuronpedia's own labels can be scored by the same detector for a fair comparison.

Results that reproduce the episodes

  • Graph diff. On the RL-hack study's 48 graphs, diff_graphs picks the same ten features the study did, in the same order. 9 of the 10 are specific to the run that hacked and 6 come back in another seed (test: tests/test_diff.py::test_reproduces_rl_hack_selection). Split halves of the prompts agree on 70% of the top 10, and reconstruction error is unchanged by RL (0.500 vs 0.499).
  • Labels. Claude Haiku 5.5 labelled 50 Gemma-2-2B transcoder features for $0.26 in total. Its labels match Neuronpedia's on detection (AUROC 0.80 vs 0.78 and 0.80) and beat them on simulation (r = 0.45 vs 0.37 and 0.38). The explainer's stated confidence barely predicts its score (r = 0.11), so use the score, not the confidence.
  • Live validator runs on the RL-hack model and the password-locked model: see examples/data/live/.

Layout

src/circuitcheck/
  diff/       graphs.py (summaries and loaders: circuit-tracer .pt, Neuronpedia JSON), core.py (the diff)
  validate/   core.py (checks and verdicts), controls.py, metrics.py, sandbox.py, toy.py
  labels/     autointerp.py (explain, detect, simulate, calibrate), providers.py (Claude, OpenAI, cache), neuronpedia.py
  tracer.py   circuit-tracer adapter and reconstruction error
  report.py   HTML pages
  cli.py      the circuitcheck command
examples/     notebooks 01-03, data/, scripts/ (how the bundled data was made), modal/ (live GPU checks)

Development

uv venv && uv pip install -e ".[dev]"
pytest && ruff check && mypy src

MIT licence.

Metadata

Release files for circuitcheck 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 circuitcheck 0.1.0
File Size Uploaded Provenance Actions
circuitcheck-0.1.0.tar.gz 57.8 kB With provenance Details for circuitcheck-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 112.8 kB

Release files / circuitcheck-0.1.0.tar.gz

Download URL circuitcheck-0.1.0.tar.gz
Size 57.8 kB
Tags Source
SHA-256 checksum
How to use checksums
127d251b0ba25a00dcbde073e228cfa630d74b8ecfe1560fc502c98cd3c8359a
BLAKE2b-256 checksum
How to use checksums
449556556fa52a5f7a48c3da8ec3992b0db7a571943e3f353b5ba53dbdad1b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

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

Download URL circuitcheck-0.1.0-py3-none-any.whl
Size 55.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20d111ed3f0318d9294f4cbc69592b0d780d01855dac96b107a73df8f465b7ee
BLAKE2b-256 checksum
How to use checksums
7a5d24556dd6d934d2faa1114fd40b78277c09dbecce1b970fa16bac5eef1af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for circuitcheck 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for circuitcheck-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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