The Task
Multi-hop reasoning requires composing multiple logical relationships to arrive at a conclusion. Given a set of facts and a query, the model must chain together several inference steps to produce the correct answer.
We use family relationships as a controlled testbed: understanding "Who is the father of the mother of X?" requires composing two relationships (father-of and mother-of) to identify the maternal grandfather. This task scales naturally in difficulty by increasing the number of relationship compositions required.
Why This Matters
Multi-hop reasoning is fundamental to complex question answering, knowledge graph traversal, and logical inference. Systems that excel at compositional reasoning can tackle real-world problems requiring multiple steps of deduction—from legal document analysis to scientific hypothesis generation.
Synthetic Dataset
We constructed a synthetic dataset of family relationship queries with controlled complexity levels. Each level requires a specific number of logical "hops" to reach the answer, allowing systematic evaluation of how reasoning depth affects model performance.
Basic Composition
Extended Chain
Complex Inference
Deep Reasoning
Experimental Setup
We compared our Quantum-Enhanced Transformer Multi-Head Attention (QETMHA) architecture against a classical transformer baseline with identical parameter counts. Both models were trained on the same dataset with equivalent training procedures, evaluated across all hop levels to assess how quantum advantages scale with reasoning complexity.
Results
Training Accuracy
Validation Accuracy
Final Test Accuracy by Reasoning Depth
Key Findings
- Clear advantage on simpler compositions: QETMHA achieves near-perfect accuracy on 2-hop problems where classical attention reaches only 65%, demonstrating strong compositional reasoning capabilities.
- Consistent outperformance across depths: At every hop level, QETMHA outperformed the classical baseline, with the absolute advantage most pronounced on 2-hop and 3-hop tasks.
- Graceful degradation: Both architectures struggle with 4-hop and 5-hop reasoning, but QETMHA maintains a relative advantage, suggesting the quantum attention mechanism provides benefits even as tasks exceed current model capacity.
- Faster learning: QETMHA shows steeper accuracy improvements during training, particularly after epoch 2, indicating more efficient extraction of compositional patterns.
Implications
These results demonstrate that quantum attention mechanisms provide measurable advantages on compositional reasoning tasks. The pronounced benefit on 2-hop and 3-hop problems—fundamental building blocks of complex inference—suggests significant potential for applications in knowledge graph reasoning, multi-step question answering, and logical inference systems. The challenge of deeper reasoning (4+ hops) for both architectures indicates an important direction for future research.