Language Models can be Logical Solvers

Jiazhan Feng, Ruochen Xu, Junheng Hao, Hiteshi Sharma, Yelong Shen, Dongyan Zhao, Weizhu ChenarXiv 2023 · DOI

Abstract

Large Language Models (LLMs) frequently struggle with multi-step deductive reasoning, often producing unfaithful logic or hallucinations. This paper introduces LoGiPT, a model fine-tuned to directly emulate the internal, step-by-step reasoning processes of symbolic logical solvers. By distilling deterministic traces from a theorem prover into a neural network, LoGiPT achieves state-of-the-art performance on complex deductive reasoning benchmarks, significantly outperforming GPT-4-based solver-augmented pipelines.

Introduction

While LLMs are powerful, their reasoning in natural language is often "brittle." Previous attempts to mitigate this involved solver-augmented LMs, where an LLM parses a question into a symbolic language (e.g., Prolog) for an external solver. However, this creates a bottleneck: a single syntax error in the LLM's output causes the external solver to fail. LoGiPT addresses this by training the model to internalize the solver's logic, learning to follow strict symbolic syntax and derivation steps internally.

Comparison of traditional solver-augmented pipelines versus the LoGiPT approach.

Methodology: Revealing and Refining the Solver Process

The core innovation of LoGiPT is the distillation of the mechanical process of a symbolic solver into the language model.

  1. Revealing the Solver Trace: The researchers modified the pyke symbolic solver to output its internal operations—such as Bind, Unbind, and Use rule—which are typically hidden from the user.
  2. Instruction Tuning: These internal traces were structured into a 4-turn conversational format. In this setup, the human provides context, the LM defines predicates and executes symbolic reasoning, the human asks a query, and the LM provides a formatted answer based on its derived facts.
  3. Fine-tuning: This structured dataset was used to fine-tune open-source models, specifically Vicuna-13B and CodeLlama-13B, creating the LoGiPT model.

Experimental Setup

The models were evaluated on two challenging 5-hop deductive reasoning benchmarks:

  • ProofWriter: Tests reasoning under the Open-World Assumption (OWA), where missing facts are considered "Unknown."
  • PrOntoQA: A synthetic dataset testing pure logic under the Closed-World Assumption (CWA), where missing facts are considered "False."

Results and Discussion

LoGiPT demonstrated a significant performance leap over existing state-of-the-art (SOTA) methods. On the ProofWriter dataset, LoGiPT (based on CodeLlama-13B) achieved 89.50% accuracy, surpassing LogicLM (GPT-4 based) which scored 79.66%. On PrOntoQA, it reached 96.40% accuracy, rivaling GPT-4’s few-shot Chain-of-Thought performance.

Performance comparison of LoGiPT against closed-source, open-source, and solver-augmented LMs.

Key Insights

  • Process vs. Outcome Distillation: Training on the mechanical process of the solver, rather than just the final answer, forces the model to maintain a deterministic logic chain.
  • Symbolic Language Necessity: Replacing symbolic steps with natural language led to a sharp drop in performance, confirming that rigid symbolic structure is essential for logical consistency.
  • Robustness: By learning the solver's grammar during training, LoGiPT bypasses the syntax-sensitivity issues that plague standard parser-based pipelines.

Conclusion and Future Work

LoGiPT proves that LMs can be trained to act as reliable logical solvers by emulating symbolic processes. While currently focused on deductive reasoning and Prolog-style logic, future work could expand this framework to inductive or abductive reasoning and more complex logical languages.

Summary updated

BibTeX
@misc{feng2023language,
  author = {Jiazhan Feng and Ruochen Xu and Junheng Hao and Hiteshi Sharma and Yelong Shen and Dongyan Zhao and Weizhu Chen},
  title = {{Language Models can be Logical Solvers}},
  year = {2023},
  eprint = {2311.06158},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.06158},
}
Figure