A Mechanistic Interpretation of Syllogistic Reasoning in Auto-Regressive Language Models

Geonhee Kim, Marco Valentino, André Freitas · DOI

Introduction

The debate over whether Large Language Models (LLMs) possess genuine reasoning capabilities or merely act as "stochastic parrots" remains central to AI research. This study investigates this question through the lens of mechanistic interpretability, focusing on formal syllogistic inference—specifically the "Barbara" syllogism (AAA-1: "All A are B; All B are C; therefore All A are C"). By mapping the internal activations of models like GPT-2 Medium, researchers have identified a specific "reasoning circuit" responsible for these logical deductions.

Methodology and Circuit Discovery

To dissect the model's internal processes, the researchers employed several interventional techniques designed to isolate causal pathways. Activation Patching was used to compare "clean" prompts against "corrupted" ones where key logical terms were altered. By swapping activations between these runs, specific attention heads necessary for correct logic were identified.

The experimental framework for identifying reasoning circuits, including clean and corrupted runs, activation patching, and logit lens analysis.

Additionally, the Logit Lens technique allowed for the projection of internal states at various layers back into vocabulary space, revealing the model's intermediate "thoughts." The study utilized three distinct datasets: a symbolic dataset for pure logic, a belief-consistent dataset using true real-world facts, and a belief-inconsistent dataset using logically valid but factually false premises to test the tension between logic and pre-trained knowledge. Through these methods, a minimal set of attention heads was discovered that remains sufficient for performing the reasoning task.

The Three-Stage Reasoning Mechanism

The investigation revealed that the model derives logical conclusions through a consistent three-stage internal process rather than a single-step retrieval. This mechanism follows a predictable path across the model's layers:

  1. Naive Recitation: In the early layers, the model tends to repeat the first premise, essentially reciting the input without logical processing.
  2. Middle-Term Suppression: A crucial step involving specific "suppression heads" (e.g., $h_{11.10}$ in GPT-2 Medium). These heads inhibit information from the middle term (the 'B' in the syllogism) to prevent the model from simply repeating the wrong part of the prompt.
  3. Mediation: Finally, "mover heads" propagate the correct logical conclusion to the final token position, completing the transitive inference.
A schematic of the symbolic syllogistic argument circuit in GPT-2 Medium, highlighting duplication, suppression, and mover heads.

This circuit emerges as a "phase transition" once models reach a certain scale (approximately 400M parameters), becoming remarkably consistent across different model families like Llama, Qwen, and Pythia. Smaller models fail to develop this circuit, suggesting that logical reasoning is an emergent property of scale.

Impact of World Knowledge and Belief Bias

A significant finding of the research is the interference of pre-existing world knowledge with formal logic. In "belief-inconsistent" scenarios—where the logical conclusion contradicts a known fact (e.g., "All people are blond")—the model's performance drops significantly. Internally, "knowledge heads" containing memorized facts compete with the "logic heads" of the reasoning circuit.

This "knowledge contamination" explains why LLMs often struggle to prioritize formal rules over their training data biases, leading to a ~300% change in logit difference compared to purely symbolic tasks. The identified circuit is both necessary and sufficient for syllogistic schemes where the model achieves >60% accuracy, yet it remains fragile in the face of strong prior beliefs.

Conclusion and Future Directions

The identification of a dedicated reasoning circuit suggests that LLMs can indeed learn systematic rules of logic, such as the transitive property. The same circuit works across 15 different types of unconditionally valid syllogisms, suggesting a generalizable "transitive reasoning" template.

However, these circuits are easily disrupted by conflicting world knowledge. Future research may focus on "steering" these circuits—enhancing logic heads while muting belief-bias heads—to develop more robust and hallucination-resistant AI systems. While currently limited to categorical syllogisms, this work provides a foundational map for understanding how machines think through complex logical structures and highlights the ongoing struggle between learned rules and memorized data.

Summary updated

BibTeX
@inproceedings{kim2025mechanistic,
  author = {Geonhee Kim and Marco Valentino and André Freitas},
  title = {{A Mechanistic Interpretation of Syllogistic Reasoning in Auto-Regressive Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure