circuit
Sketch an automated causal pathway for a prompt by ranking attention heads and MLP neurons via logit attribution, then validate each with zero-ablation to show components that actually move the prediction.
Instructions
Sketch a best-effort automated circuit for one prompt on an open-weight TransformerLens model: ranks candidate attention heads and MLP neurons by direct logit attribution, then measures each candidate's individual causal effect via single-component zero-ablation, so the result reflects components that actually move the prediction, not just ones correlated with it. Call this when trace's correlational ranking isn't enough and you want a causal pass across multiple candidates without manually calling patch on each one. This is NOT full path-patching with clean/corrupted prompt pairs and does not capture interaction effects between components; the response's own method field restates this caveat so a caller doesn't have to trust prose alone. For rigorous transcoder-based circuit discovery on a fixed set of supported models, use a dedicated tool such as Anthropic's circuit-tracer instead. Read-only, with the same model-weight caching, network-on-first-use, and CPU-by-default behavior as trace; more expensive than trace since it runs one extra forward pass per candidate component being ablated. Deterministic for a given model, prompt, and top_k. On failure it returns a structured error object rather than raising. Parameters: model (str); prompt (str); top_k (int, default 10), how many top-attributed components to test via ablation. Example call: model='gpt2', prompt='The capital of France is Paris. The capital of Japan is', top_k=5. Returns JSON with schema_version, operation, model, prompt, predicted_token, predicted_token_id, components (list of {layer, component_type: 'head' or 'neuron', index, logit_drop_on_ablation}), and method (a string explaining the approximation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | ||
| top_k | No | ||
| prompt | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||