A Stepwise-Enhanced Reasoning Framework for Large Language Models Based on External Subgraph Generation

Xin Zhang, Yang Cao, Baoxing Wu, Xinyi Chen, Kai Song, Siying LiarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) demonstrate remarkable fluency but frequently struggle with logical consistency and factual grounding in complex, multi-step reasoning tasks. This paper presents the Stepwise-Enhanced Reasoning (SGR) framework, designed to anchor LLM inference in reality by dynamically generating query-specific subgraphs from external Knowledge Graphs (KGs). By decomposing complex questions into verifiable steps grounded in structured data, SGR significantly reduces hallucinations and outperforms standard prompting techniques on multi-hop reasoning benchmarks.

Introduction

While LLMs excel at pattern recognition, they often lack a robust "world model," leading to "hallucinations" where the model generates plausible-sounding but factually incorrect information. Standard Retrieval-Augmented Generation (RAG) typically relies on unstructured text snippets, which can be noisy and fail to capture the complex relational dependencies required for multi-hop reasoning. Knowledge Graphs (KGs) provide a structured alternative, storing facts as triples (e.g., [Entity] -> [Relation] -> [Entity]). However, effectively integrating these graphs without rigid, manual templates remains a challenge.

The SGR Framework

The SGR framework addresses these limitations through a three-phase process that leverages the structural power of KGs to guide LLM reasoning.

The SGR framework workflow, illustrating the transition from input question to structured subgraph generation, followed by direct or joint retrieval reasoning.
  1. Structured Subgraph Generation: SGR identifies core entities and relations within a user's query to build a "schema"—a blueprint of relevant knowledge. It then extracts a specific subgraph from a database (such as Neo4j), filtering out irrelevant data and focusing the model on the necessary factual neighborhood.
  2. Stepwise Reasoning Enhancement: The LLM is prompted to perform reasoning one step at a time, strictly following the paths defined within the generated subgraph. This ensures that every inference step is traceable and grounded in a real-world relationship.
  3. Direct and Collaborative Reasoning:
    • Direct Retrieval: A specialized "Cypher LLM" translates natural language into Cypher queries to retrieve candidate answers directly from the graph database.
  4. Joint Reasoning: If direct retrieval is insufficient, the LLM and KG enter an iterative loop where the LLM generates hypotheses that are verified and expanded using the graph until a consistent answer is reached.

Experimental Evaluation

The framework was evaluated on three major benchmarks for multi-hop question answering: Complex WebQuestions (CWQ), WebQSP, and GrailQA. These datasets test a model's ability to reason across multiple steps and generalize to unseen logical structures.

Key Results

SGR demonstrated significant performance improvements over strong baselines, including standard ChatGPT and Chain-of-Thought (CoT) prompting.

Performance comparison of SGR against various baselines across CWQ, WebQSP, and GrailQA datasets.

As shown in the results table, SGR paired with GPT-4 achieved a Hits@1 score of 0.632 and an accuracy of 0.590 on the CWQ dataset, substantially outperforming standard CoT (0.388 Hits@1). Ablation studies further highlighted the importance of the external graph; removing the Neo4j retrieval component caused ChatGPT-based accuracy on CWQ to drop from 0.526 to 0.374.

Insights and Future Directions

The success of SGR underscores several key insights:

  • Structure Over Context: Providing the structural "blueprint" of knowledge via a graph is often more effective than providing raw text context.
  • Traceability: Mapping reasoning to specific nodes and edges makes the LLM's output verifiable, addressing the "black box" nature of traditional models.
  • Schema Importance: The ability to plan the required knowledge (schema-based filtering) is as critical as the knowledge itself.

Future work will focus on reducing the computational overhead of dynamic subgraph generation and improving scalability for real-time applications. The researchers suggest that SGR could be particularly transformative in high-stakes fields like medicine, where reasoning must be strictly grounded in verified clinical facts.

Summary updated

BibTeX
@misc{zhang2025stepwise,
  author = {Xin Zhang and Yang Cao and Baoxing Wu and Xinyi Chen and Kai Song and Siying Li},
  title = {{A Stepwise-Enhanced Reasoning Framework for Large Language Models Based on External Subgraph Generation}},
  year = {2025},
  eprint = {2512.23356},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2512.23356},
}
Figure