Mind's Eye of LLMs: Visualization-of-Thought Elicits Spatial Reasoning in Large Language Models

Wenshan Wu, Shaoguang Mao, Yadong Zhang, Yan Xia, Li Dong, Lei Cui, Furu Wei

TL;DR

This paper introduces "Visualization-of-Thought" (VoT) prompting, a novel technique that encourages Large Language Models (LLMs) to "visualize" their intermediate reasoning steps as if they were creating mental images. This approach significantly boosts LLMs' spatial reasoning capabilities, even outperforming existing multimodal models on tasks like navigation and puzzle-solving.

What Problem Does This Paper Address?

While LLMs excel at many reasoning tasks, their ability to perform spatial reasoning – a fundamental aspect of human cognition – remains relatively unexplored. Humans naturally use a "mind's eye" to create mental images and simulate scenarios, which greatly aids in spatial understanding and decision-making. This paper investigates whether LLMs can be prompted to mimic this cognitive process to improve their spatial reasoning, a capability that is crucial for many real-world applications like robotics and navigation.

Methods

The core contribution is the Visualization-of-Thought (VoT) prompting strategy. Instead of just generating a chain of thought, VoT explicitly instructs the LLM to visualize the state of its reasoning at each intermediate step. This visualization is presented as a text-based representation (e.g., a 2D grid using special characters) that acts as an internal "mental image." The LLM then uses this visualization to inform its subsequent reasoning steps. This approach is applied in a zero-shot manner, meaning it doesn't require task-specific fine-tuning or few-shot examples.

Datasets

The authors introduce new synthetic datasets for three spatial reasoning tasks:

  • Natural Language Navigation: A 3x3 grid with landmarks, requiring navigation based on textual instructions.
  • Visual Navigation: 2D grid worlds with obstacles and paths, where LLMs must generate navigation instructions. This includes route planning and next-step prediction.
  • Visual Tiling: A 2D rectangle with masked polyomino pieces, where LLMs must identify the correct polyomino variant to fill the space.

These datasets are designed to control difficulty levels, allowing for a nuanced evaluation of LLM performance.

Key Insights and Ideas

  • LLMs have a latent "mind's eye": The success of VoT suggests that LLMs possess an underlying capability to generate internal representations akin to mental images, which can be elicited through specific prompting.
  • Visualizing reasoning improves spatial tasks: Explicitly prompting LLMs to visualize their intermediate steps dramatically enhances their performance on spatial reasoning tasks, demonstrating the power of grounded reasoning.
  • VoT can outperform multimodal models: Surprisingly, VoT applied to text-only LLMs achieved better results than some multimodal LLMs on certain spatial tasks, highlighting the potential of text-based visualization.
  • Code pre-training might be a source: The authors hypothesize that exposure to ASCII art in code comments during pre-training might contribute to LLMs' ability to generate and manipulate visual representations.
  • Prompting is key: The effectiveness of VoT is highly sensitive to the prompt. Removing the word "reasoning" from the prompt can lead to a drop in performance, indicating that the explicit instruction to visualize the reasoning process is crucial.

Key Results

  • Significant performance gains: VoT consistently improved LLM performance across all tested spatial reasoning tasks. For instance, in natural language navigation, GPT-4 VoT outperformed GPT-4 w/o Viz by 23.5%.
  • Outperforming baselines: GPT-4 VoT significantly outperformed other GPT-4 settings (CoT, w/o Viz) and even GPT-4V CoT on several tasks.
  • Visual Tiling Accuracy: VoT achieved 55.28% accuracy in visual tiling, compared to 48.61% for GPT-4 CoT.
  • Natural Language Navigation Accuracy: GPT-4 VoT achieved 63.94% accuracy, significantly higher than GPT-4 CoT (54.15%) and GPT-4 w/o Viz (46.98%).
  • Spatial Visualization Capabilities: LLMs demonstrated compliance rates of around 51-52% in spatial visualization tasks, though accuracy was lower (24-26%). However, when visualizations were accurate, LLMs made correct decisions 65-77% of the time.

Limitations and Future Work

  • Limitations:
    • The emergent "mind's eye" ability is more pronounced in advanced LLMs; smaller models may struggle.
  • Current visualizations are limited to 2D grid representations; more complex 3D semantics and shapes need to be explored.
  • Visual state tracking can be sensitive to prompts, and LLMs may sometimes generate inaccurate visualizations or struggle with spatial understanding despite correct visualizations.
  • VoT might underperform in tasks where logical reasoning without visualization is sufficient (e.g., certain natural language navigation tasks solvable by mathematical calculation).
  • Future Work:
    • Investigate VoT's efficacy in multimodal LLMs (MLLMs).
  • Develop methods for automatic data augmentation from real-world scenarios.
  • Explore learning generalized internal representations of mental images.
  • Extend visualization to more complex 3D shapes and scenarios.

Summary updated

BibTeX
@inproceedings{wu2024mind,
  author = {Wenshan Wu and Shaoguang Mao and Yadong Zhang and Yan Xia and Li Dong and Lei Cui and Furu Wei},
  title = {{Mind's Eye of LLMs: Visualization-of-Thought Elicits Spatial Reasoning in Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=50yYMg7cjo},
}
Figure