From Indirect Object Identification to Syllogisms: Exploring Binary Mechanisms in Transformer Circuits

Karim Saraipour, Shichang Zhang

TL;DR

Mechanistic interpretability has largely focused on tasks where language models copy tokens directly from context, such as Indirect Object Identification (IOI). This paper reverse-engineers how GPT-2 small solves logical syllogisms with binary truth values, uncovering an elegant two-stage negation circuit: attention heads suppress the premise's truth value, and subsequent MLP layers rescale the residual stream to output its opposite—even when that opposite token never appeared in the prompt.

What Problem Does This Paper Address?

While large language models (LLMs) can perform basic reasoning, their internal computational mechanisms remain opaque black boxes. Prior mechanistic interpretability work successfully reverse-engineered circuits for lexical copying tasks like IOI (predicting "Mary" in "When John and Mary went to the store, John gave a drink to..."). However, linguistic copying does not explain how models process abstract logical relationships or assign binary truth values.

Small models like GPT-2 struggle with open-domain true/false questions, but they reliably complete structured syllogisms. The authors investigate how GPT-2 tracks and inverts truth values across premise statements to determine whether logical deduction relies on specialized subgraphs (circuits) or simple pattern matching.

Methods

The authors combined several standard and adapted mechanistic interpretability techniques:

  • Path Patching: Systematically swaps intermediate activations between clean prompts and corrupted prompts to causally isolate which attention heads, MLPs, and interaction paths directly drive the model's prediction.
  • Logit Lens: Projects intermediate activations at specific layers and components through the model's unembedding matrix ($W_U$) to observe which tokens are promoted or suppressed at each step.
  • Circuit Faithfulness: Quantifies how well an isolated subcircuit matches the full model's output by computing the difference in Average Logit Difference: $$\text{Faithfulness} = |\text{ALD}(\mathcal{M}) - \text{ALD}(\mathcal{C})|$$
  • Component-Level Decompositions: Analyzes Query-Key (QK) attention patterns to see where heads attend, and Output-Value (OV) projections onto unembedding vectors to see what they write to the residual stream.

Datasets

The authors designed synthetic datasets (500 prompts per condition) using templated propositional syllogisms:

  1. Simple Syllogism (SS): Direct entailment (e.g., "Statement A is true. Statement B matches statement A. Statement B is [true]").
  2. Opposite Syllogism (OS): Logical negation (e.g., "Statement A and statement B are opposites. Statement A is true. Statement B is [false]").
  3. Complex Syllogism (CS): Entailment with an irrelevant distractor premise (e.g., adding "Statement C is false").
  4. Binary Contrast Generalization Sets: Analogous syllogism templates substituting truth values with other binary antonyms: (right, wrong), (good, bad), (positive, negative), and (correct, incorrect).

Key Insights and Ideas

  • A Novel Attention–MLP Negation Mechanism: In Opposite Syllogisms, the model must output a token (e.g., false) that never appeared in the prompt. It achieves this via a division of labor:
  • Negative Truth Heads (such as 7.3, 8.10, 9.7, 10.7) attend to the prompt's truth token and suppress it into the bottom logits.
  • Truth Logit Rescaler MLPs (layers 7, 8, 9, 10) process this suppression and actively elevate the opposite token into the top logits.
  • Re-evaluating "Negative Heads": In the IOI task, late negative heads (e.g., head 10.7) were viewed as "negative copy heads" that prevent overconfidence. In syllogisms, their role is fundamentally broader: they compute logical inversion by pushing along the antidirection of a binary concept.
  • Functional Inversion Across Complementary Tasks: Heads that hinder performance in Simple Syllogisms (by suppressing the correct answer) are the exact heads required to solve Opposite Syllogisms.
  • Truth Value Asymmetry: Negation works significantly better when the input token is true (flipping reliably to false) than when the input is false. The model displays an intrinsic representation bias toward negative truth directions.

Key Results

  • Faithful Subcircuits:
  • For Simple Syllogisms, a minimal circuit consisting of just three "Truth Heads" (7.2, 10.1, 10.4) achieves an average logit difference of 1.9286, recovering over 90% of the full model's performance (1.8575). MLPs have virtually no direct causal role here.
  • For Opposite Syllogisms, a circuit of five attention heads and four MLPs achieves approximately 85% faithfulness.
  • Binary Transferability: The discovered circuits transferred cleanly to other binary pairs. For example, applying the simple syllogism circuit to (right, wrong) yielded an average logit difference of 2.1599 (outperforming the full model's 2.0309).
  • Scaling Behavior: When tested on larger models (GPT-2 XL, Pythia 1.4B, Qwen3-1.7B, LLaMA 3.2-1B), feedforward MLPs consistently remained critical for negation, while simple entailment performance unexpectedly degraded in several larger architectures.

Limitations and Future Work

  • Model Scale and Architecture: Most deep analysis is restricted to GPT-2 small (117M parameters). In larger architectures, negative heads play a more muted role, indicating circuit implementations may shift with scale.
  • Synthetic Formats: Experiments use strictly templated, symbolic statements (Statement A, Statement B), which do not capture the linguistic richness, nuance, or ambiguity of natural language logical arguments.
  • Open Questions: The causal origins of the true/false representation asymmetry remain unexplained, pointing toward future work on how pre-training corpora imprint directional priors on binary concepts.

Summary updated

BibTeX
@inproceedings{saraipour2025from,
  author = {Karim Saraipour and Shichang Zhang},
  title = {{From Indirect Object Identification to Syllogisms: Exploring Binary Mechanisms in Transformer Circuits}},
  booktitle = {MechInterp @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=CTAprZMIHl},
}
Figure