Structure Guided Prompt: Instructing Large Language Model in Multi-Step Reasoning by Exploring Graph Structure of the Text

Kewei Cheng, Nesreen K. Ahmed, Theodore L. Willke, Yizhou Sun

Abstract

Large Language Models (LLMs) frequently encounter difficulties when reasoning requires multiple logical steps across complex relationships. This paper introduces Structure Guided Prompt (SGP), a zero-shot framework that instructs LLMs to first convert unstructured text into a knowledge graph and then navigate that graph to find answers. By externalizing the model's reasoning chain into a structured format, SGP significantly outperforms standard Chain-of-Thought (CoT) methods on complex relational tasks, showing improved robustness to increased reasoning depth.

Introduction

While LLMs like GPT-4 demonstrate impressive capabilities, they often fail at "multi-step reasoning"—tasks where the answer must be inferred through a chain of logic rather than stated directly. The authors identify three primary challenges: relational complexity, linguistic diversity, and irrelevant noise in the source text. Existing techniques like Chain-of-Thought (CoT) encourage step-by-step thinking but lack a formal structure to organize information. SGP addresses this by forcing the model to externalize its mental model into a structured graph before attempting to solve the problem.

Methodology: The SGP Framework

The SGP framework is a three-stage, task-agnostic prompting strategy designed for zero-shot settings:

  1. Concept Map Construction: The LLM extracts facts from the text and represents them as a knowledge graph (triples of subject, relation, object).
  2. Task-specific Planning: The model identifies target entities and plans a navigation strategy (e.g., tracing a path in a family tree).
  3. Execution: The model traverses the generated graph, performing local inferences at each "hop" to reach a final conclusion.
SGP converts unstructured text into a knowledge graph to facilitate multi-step reasoning.

By breaking the process into extraction, planning, and traversal, SGP reduces cognitive load and grounds reasoning in explicit facts.

Evaluation and Datasets

The researchers evaluated SGP across six diverse reasoning tasks using four benchmarks:

  • CLUTRR: Predicting complex family relationships requiring 3 to 10 hops.
  • BIG-bench hard (BBH): Including tasks like tracking shuffled objects (Dynamic KG), logical deduction (Graph Sorting), and retrieving data under specific conditions (Graph Query).
  • HotpotQA: Multi-hop question answering requiring information from disparate text sections.
  • Entailment Bank: Multi-step logical inference.

Key Results

SGP consistently outperformed 0-shot CoT across nearly all tasks. Notably, on the most difficult 10-hop CLUTRR tasks, SGP with GPT-4 achieved 29.9% accuracy, compared to just 9.3% for 0-shot CoT.

Performance comparison between SGP (Ours) and 0-shot CoT across various reasoning tasks.

In the "shuffled object" task (Dynamic KG), SGP showed a massive 146% improvement over standard CoT. For logical deduction tasks involving seven objects, SGP reached 82.4% accuracy, significantly higher than the 63.6% achieved by 0-shot CoT.

Discussion and Insights

A key insight is that graphs serve as an "External Memory." Unlike linear CoT, the structured graph prevents the model from forgetting or hallucinating relationships during long reasoning chains. Furthermore, SGP demonstrates remarkable robustness to "hops." While standard CoT performance typically plummets as reasoning complexity increases, SGP's accuracy remains relatively stable.

Limitations and Future Work

Despite its success, SGP is a pipeline, making it susceptible to error propagation; a mistake in graph construction often leads to failure in later stages. Long context also poses a challenge, as models may miss relevant triples in extensive text. Future work may explore multi-agent approaches where a second LLM acts as a "verifier" to check the consistency of the generated graph and reasoning path.

Summary updated

BibTeX
@inproceedings{cheng2024structure,
  author = {Kewei Cheng and Nesreen K. Ahmed and Theodore L. Willke and Yizhou Sun},
  title = {{Structure Guided Prompt: Instructing Large Language Model in Multi-Step Reasoning by Exploring Graph Structure of the Text}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.528},
}
Figure