SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.04577 · ACL · 2025

Position-aware Automatic Circuit Discovery

Yonatan Belinkov, David Bau, Aaron Mueller, Tal Haklay, Hadas Orgad

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 7 functions out of this paper's own repositories and ran 7 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
technion-cs-nlp/peap canonical 7 of 7
FunctionStatusWhere it lives
add_space Ran technion-cs-nlp/peap/src/data_generation.py
code served (permissive licence) · get_code("c40af1a4ac756719")
add_space Ran technion-cs-nlp/peap/src/eval_utils.py
code served (permissive licence) · get_code("8572d3949ccf4d91")
calculate_attention_scores Ran technion-cs-nlp/peap/src/pos_aware_edge_attribution_patching.py
code served (permissive licence) · get_code("fb7c8eea53bdfbcd")
calculate_heads_output Ran technion-cs-nlp/peap/src/pos_aware_edge_attribution_patching.py
code served (permissive licence) · get_code("4f2dc50c45297504")
calculate_z_scores Ran technion-cs-nlp/peap/src/pos_aware_edge_attribution_patching.py
code served (permissive licence) · get_code("c800c06d3b65176c")
call_chatgpt Ran technion-cs-nlp/peap/src/schema_generation.py
code served (permissive licence) · get_code("8b4f47c30fe2a5f9")
handle_error Ran technion-cs-nlp/peap/src/schema_generation.py
code served (permissive licence) · get_code("3497e060ec8e3349")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

A widely used strategy to discover and understand language model mechanisms is circuit analysis. A circuit is a minimal subgraph of a model's computation graph that executes a specific task. We identify a gap in existing circuit discovery methods: they assume circuits are position-invariant, treating model components as equally relevant across input positions. This limits their ability to capture cross-positional interactions or mechanisms that vary across positions. To address this gap, we propose two improvements to incorporate positionality into circuits, even on tasks containing variablelength examples. First, we extend edge attribution patching, a gradient-based method for circuit discovery, to differentiate between token positions. Second, we introduce the concept of a dataset schema, which defines token spans with similar semantics across examples, enabling position-aware circuit discovery in datasets with variable length examples. We additionally develop an automated pipeline for schema generation and application using large language models. Our approach enables fully automated discovery of position-sensitive circuits, yielding better trade-offs between circuit size and faithfulness compared to prior work. 1

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2502.04577")
get_code_for_paper("2502.04577")
have("2502.04577")

Connect an agent — have() is free.