DSPy-based neural-symbolic pipeline to enhance spatial reasoning in LLMs.

Wang, Rong; Sun, Kun · Neural Netw · 2026

basic_science · Level V

Where this comes from

Abstract

Spatial reasoning is crucial for Large Language Models (LLMs) but remains a persistent challenge. Existing neural-symbolic approaches offer partial solutions but suffer from inflexible design and limited effectiveness. We present a neural-symbolic framework that integrates LLMs with Answer Set Programming (ASP) through an iterative feedback loop, enabling precise and reliable refinement of generated logic programs. Evaluated on two benchmark datasets across multiple reasoning tasks and LLMs, our DSPy-based pipeline achieves 82-93 % and 71-80 % accuracy, surpassing direct prompting, Chain-of-Thought, and a two-stage "Facts+Rules" method by up to 43 % and 25 %, respectively. The lightweight "Facts+Rules" alternative we proposed also improves baseline performance by 9-27 % while reducing computational overhead. Key innovations driving these gains include (1) modular separation of semantic parsing and logical reasoning, (2) iterative error-handling feedback between LLMs and ASP solvers, and (3) domain-specific symbolic representations for efficient reasoning. The system offers strong interpretability and generalizability, allowing application across diverse and complex tasks. Moreover, our proposed system could substantially advance AI architectures capable of human-like, multi-component reasoning, contributing to the development of artificial general intelligence.

Medical subject headings