Abstract
Large Language Models (LLMs) frequently struggle with complex multi-hop reasoning because they treat text as a linear sequence, often overlooking implicit connections between entities. This paper introduces Reasoning with Graphs (RwG), a framework that prompts LLMs to explicitly construct and iteratively refine a knowledge graph from input text before solving a problem. By transforming implicit context into structured triples, RwG significantly boosts performance on logical puzzles and multi-hop question-answering tasks.
Introduction: The Linear Bottleneck
While LLMs excel at many natural language tasks, they often stumble on "multi-hop" reasoning—problems where the answer requires connecting disparate pieces of information scattered across a text. The authors identify a core limitation: LLMs typically process information as a sequence. In complex logical puzzles, such as family tree riddles, the relationships between entities are often implicit. For example, if a text states "Alice has a brother" and "Alice's father has a son," a human naturally builds a mental map to realize those might be the same person. LLMs, however, often fail to "connect the dots" unless those connections are explicitly laid out.
Existing prompting methods like Chain-of-Thought (CoT) or Graph-of-Thoughts (GoT) focus on structuring the reasoning process (the steps of thinking), but they do not necessarily structure the underlying knowledge found in the context.
The RwG Framework
The authors propose Reasoning with Graphs (RwG), a two-stage framework designed to bridge this gap by externalizing the model's mental map into a verifiable structure.
Unlike previous methods that structure the sequence of thoughts, RwG focuses on structuring the context itself. This approach transforms the reasoning task from navigating a dense, linear text to traversing a sparse, structured graph.
Iterative Graph Construction
The core of RwG is a "generate-verify-refine" loop that ensures the extracted knowledge is both accurate and complete:
- Initial Generation: The LLM extracts entities and relationships from the context to build a base graph, represented as triples (
Head, Relation, Tail). - Verification: The model checks if the current graph satisfies all constraints mentioned in the text and contains enough information to answer the target question.
- Refinement: If the graph is incomplete or inconsistent, the LLM is prompted to infer missing nodes (entities) or edges (relationships). This continues until the graph passes verification or a maximum iteration limit is reached.
This iterative process is crucial. The paper demonstrates that using a graph that has not passed final verification leads to significantly lower performance, highlighting that the refinement loop is the engine of the framework's success.
Experimental Evaluation
RwG was evaluated across a diverse set of reasoning benchmarks:
- Logical Reasoning: Including AIW & AIW+ (family relationship puzzles), LogiQA (civil service exam logic), and AR-LSAT (analytical reasoning from the LSAT).
- Multi-hop Question Answering: Standard benchmarks like HotpotQA, MuSiQue, and 2WikiMultihopQA, as well as Clutrr for kinship reasoning.
- Temporal Reasoning: Testing on Time-Sensitive-QA to handle facts that change over time.
Key Insights and Results
The research yielded several critical insights into why RwG is effective:
- Knowledge Structure vs. Thought Structure: The bottleneck for many tasks isn't the LLM's logic, but its perception of the facts. A graph provides a "cheat sheet" that clarifies relationships.
- Path Shortening: In multi-hop QA, a reasoning chain might span several sentences in raw text. In a graph, that same connection is often a direct edge or a short jump, reducing the cognitive load on the model.
- The Power of Inferred Nodes: In datasets like AIW+, many entities are unnamed. RwG prompts the model to create "placeholder" nodes (e.g., "Alice's unnamed cousin"), preventing the model from losing track of these entities during calculation.
The performance gains were substantial. On the difficult AIW+ dataset, GPT-4o’s accuracy jumped from 11.76% with vanilla prompting to 52.94% using RwG. On the AR-LSAT dataset, RwG combined with Self-Consistency achieved 45.21%, significantly outperforming the vanilla model's 36.08%.
Conclusion
Reasoning with Graphs represents a shift from optimizing how a model thinks to optimizing what it sees. By structuring implicit knowledge into an explicit graph, RwG enables LLMs to handle complex, multi-step dependencies that were previously out of reach. Future work may involve integrating specialized graph neural networks or fine-tuning models specifically to serve as high-fidelity graph builders.
Summary updated