Advancing Spatial Reasoning in Large Language Models: An In-Depth Evaluation and Enhancement Using the StepGame Benchmark

Fangjun Li, David C. Hogg, Anthony G. Cohn

Abstract: Artificial intelligence (AI) has made remarkable progress across various domains, with large language models like ChatGPT gaining substantial attention for their human-like text-generation capabilities. Despite these achievements, improving spatial reasoning remains a significant challenge for these models. Benchmarks like StepGame evaluate AI spatial reasoning, where ChatGPT has shown unsatisfactory performance. However, the presence of template errors in the benchmark has an impact on the evaluation results. Thus there is potential for ChatGPT to perform better if these template errors are addressed, leading to more accurate assessments of its spatial reasoning capabilities. In this study, we refine the StepGame benchmark, providing a more accurate dataset for model evaluation. We analyze GPT’s spatial reasoning performance on the rectified benchmark, identifying proficiency in mapping natural language text to spatial relations but limitations in multi-hop reasoning. We provide a flawless solution to the benchmark by combining template-to-relation mapping with logic-based reasoning. This combination demonstrates proficiency in performing qualitative reasoning on StepGame without encountering any errors. We then address the limitations of GPT models in spatial reasoning. To improve spatial reasoning, we deploy Chain-of-Thought and Tree-of-thoughts prompting strategies, offering insights into GPT’s cognitive process. Our investigation not only sheds light on model deficiencies but also proposes enhancements, contributing to the advancement of AI with more robust spatial reasoning capabilities.

Introduction

Spatial reasoning—the ability to understand and navigate the physical relationships between objects—is a fundamental pillar of human cognition. While Large Language Models (LLMs) like GPT-4 have demonstrated exceptional proficiency in linguistic tasks, their ability to maintain a coherent "mental map" over complex, multi-step descriptions remains a significant frontier in AI research. This study, presented at AAAI-24, investigates these limitations using the StepGame benchmark and proposes novel methods to bridge the gap between linguistic understanding and logical spatial reasoning.

The Challenge of Multi-Hop Reasoning

The StepGame benchmark presents models with stories consisting of spatial facts (e.g., "A is above B," "B is left of C") and asks for the relationship between two distant agents in the chain. As the number of "hops" (the sequence of relations) increases, the difficulty scales exponentially.

A 10-hop spatial reasoning story and its corresponding relational graph visualization.

Our initial investigation revealed that the benchmark itself contained "template errors"—instances where the natural language descriptions did not logically match the intended spatial labels. By manually auditing and rectifying these templates, we established a clean dataset that allows for a fair evaluation of an LLM's true reasoning capacity.

Methodology

1. Benchmark Rectification

We identified and corrected 14 flawed mapping rules within the original StepGame templates. This rectification ensures that model failures are attributed to reasoning deficiencies rather than ambiguous or incorrect ground-truth data.

2. The Hybrid Logic-LLM Solution (Map+ASP)

To establish a performance ceiling, we developed a hybrid system that decouples linguistic parsing from logical reasoning. We utilized the LLM's strength in "mapping"—translating natural language into spatial primitives—and fed these primitives into an Answer Set Programming (ASP) reasoner using the Clingo solver. This approach treats spatial reasoning as a formal coordinate-based problem.

The pipeline for mapping natural language sentences to symbolic ASP facts for formal logical reasoning.

3. Advanced Prompting Strategies

To improve the native reasoning of LLMs without external solvers, we implemented two advanced prompting techniques:

  • Customized Chain-of-Thought (CoT): We prompted the model to assign 2D coordinates (e.g., x, y) to each agent as it processed the story, transforming linguistic relations into mathematical offsets.
  • Tree-of-Thoughts (ToT): For complex 10-hop scenarios, we employed a Breadth-First Search (BFS) strategy. This allows the model to explore multiple potential linking chains, evaluate their relevance to the target query, and backtrack when a path proves illogical.

Key Results and Insights

Our evaluation yielded several critical insights into the nature of AI spatial cognition:

  • Mapping vs. Reasoning: GPT-4 is highly proficient at 1-hop mapping (understanding single relations) but struggles with the logical chaining required for multi-hop tasks. Without specialized prompting, GPT-4’s accuracy plummeted from 100% at 1-hop to just 25% at 10-hops.
  • The Power of Formal Logic: The hybrid Map+ASP approach achieved 100% accuracy across all hop levels, proving that the primary bottleneck for LLMs is the logical integration of facts, not the understanding of the language itself.
  • Prompting Breakthroughs: By combining ToT and CoT strategies, we enabled GPT-4 to maintain a remarkable 95% accuracy even at the 10-hop level. This suggests that structured cognitive heuristics can significantly mitigate the inherent reasoning limitations of transformer architectures.

Conclusion

This research demonstrates that while LLMs are not inherently robust spatial reasoners, their performance can be dramatically enhanced through benchmark rectification, hybrid symbolic integration, and structured prompting. Future work will focus on extending these methods to non-templated, naturalistic spatial language and integrating more complex topological and distance-based reasoning into a unified framework.

Summary updated

BibTeX
@inproceedings{li2024advancing,
  author = {Fangjun Li and David C. Hogg and Anthony G. Cohn},
  title = {{Advancing Spatial Reasoning in Large Language Models: An In-Depth Evaluation and Enhancement Using the StepGame Benchmark}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  url = {https://openreview.net/forum?id=xNXPN0WACp},
}
Figure