Logiformer: A Two-Branch Graph Transformer Network for Interpretable Logical Reasoning

Fangzhi Xu, Qika Lin, Jun Liu, Yudai Pan, Lingling Zhang · DOI

Introduction

While modern large language models (LLMs) like RoBERTa excel at contextual pattern matching, they frequently struggle with formal logical reasoning. Tasks that require identifying argument flaws or determining necessary truths from premises demand an understanding of structural relationships that go beyond word-level statistics. Current models often fail due to long-distance dependencies—where logical units at the start of a passage relate to those at the end—and the "discrete-continuous gap," the difficulty of fusing discrete logical rules with continuous neural embeddings.

Logiformer addresses these challenges through a novel "two-branch" graph transformer architecture. By decomposing text into semantic "logical units" and utilizing their relationships as structural biases, Logiformer bridges the gap between linguistic flexibility and logical precision.

Methodology: The Two-Branch Architecture

Logiformer processes text through two distinct, parallel branches designed to capture different types of structural information:

  1. Logical Branch: This branch identifies causal relationships by detecting explicit connectives (e.g., if, unless, because, therefore) and negations (not, no). It constructs a "Logical Graph" where nodes represent semantic units and edges represent the flow of causal reasoning.
  2. Syntax Branch: This branch captures co-occurrence. If two separate units mention the same subject (e.g., "Paula"), they are linked in a "Syntax Graph," regardless of their distance in the original text.
Decomposition of text into logical units and their associated causal, co-occurrence, and negation relations.

Graph Transformer with Attention Bias

Rather than using standard Graph Neural Networks (GNNs), which can suffer from "over-smoothing," Logiformer employs a Fully Connected Graph Transformer. In this setup, the adjacency matrices from the Logical and Syntax graphs serve as attention biases. This mechanism encourages the model to prioritize interactions between nodes with known logical or syntactic connections, effectively embedding discrete graph structures directly into the transformer's continuous attention mechanism.

The Logiformer architecture, showing the parallel Logical and Syntax branches feeding into a decoder with a dynamic gate mechanism.

Finally, a dynamic gate mechanism learns to weight the importance of each branch for a given question, while a question-aware self-attention module refines the final representation before answer prediction.

Key Insights

  • Logical Units over Tokens: By breaking text into short phrases or sentences (logical units), the model mimics human cognition, evaluating arguments as a series of connected claims rather than a stream of individual words.
  • One-Hop Interaction: The fully connected transformer structure allows distant logical units to interact in a single step. This "one-hop" capability effectively solves the long-distance dependency problem that hindered previous chain-based models.
  • Interpretability: Operating on discrete units allows for the visualization of attention maps. Researchers can see exactly which parts of a premise the model prioritized to reach its conclusion, providing a window into the model's reasoning process.

Experimental Results

Logiformer was evaluated on two premier benchmarks: ReClor (sourced from GMAT/LSAT exams) and LogiQA (sourced from the National Civil Servants Examination of China).

  • ReClor: Logiformer achieved 63.50% accuracy on the test set, becoming the first single model using a RoBERTa encoder to surpass human performance (63.00%).
  • LogiQA: The model reached 42.55% accuracy, a significant improvement over previous state-of-the-art models like FocalReasoner (40.25%).
  • Ablation Studies: Removing either the logical or the syntax branch resulted in a performance drop, confirming that both causal structure and word-level co-occurrence are essential for deep argument comprehension.

Limitations and Future Directions

Despite its success, Logiformer has areas for further development. Currently, the syntax branch relies on literal word overlap; it may fail to link units that are semantically identical but use different vocabulary (e.g., "gets married" vs. "wedding"). Additionally, the model still finds "Identify a Flaw" questions challenging, as these require identifying what is missing from an argument rather than what is present. Future work may involve contrastive learning to better distinguish subtle logical nuances.

Summary updated

BibTeX
@inproceedings{xu2022logiformer,
  author = {Fangzhi Xu and Qika Lin and Jun Liu and Yudai Pan and Lingling Zhang},
  title = {{Logiformer: A Two-Branch Graph Transformer Network for Interpretable Logical Reasoning}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2022},
  doi = {10.1145/3477495.3532016},
}
Figure