Enhancing and Evaluating Logical Reasoning Abilities of Large Language Models

Shujie Deng, Honghua Dong, Xujie SiSeT LLM @ ICLR 2024

TL;DR

This paper introduces a novel framework that combines Large Language Models (LLMs) with the Z3 symbolic solver to improve logical reasoning. By adding a self-refinement module, the framework significantly boosts accuracy on various logical reasoning tasks, outperforming previous methods. The study also highlights key limitations in LLMs' ability to translate natural language into logical structures.

What Problem Does This Paper Address?

Large Language Models (LLMs) have shown impressive capabilities, but they struggle with complex logical reasoning. While integrating LLMs with symbolic solvers has shown promise, existing methods like Logic-LM face challenges in scaling across different tasks. LLMs often fail to accurately interpret logical rules, leading to errors like "hallucinations" in their outputs. This paper aims to bridge this gap by creating a more robust and unified approach to enhance LLMs' logical reasoning abilities.

Methods

The proposed framework consists of three core modules:

  1. LLM Translation Module: This module takes natural language problems and translates them into executable Z3 code. It uses a combination of instruction and user prompts, along with a two-shot prompting approach and Chain-of-Thought (CoT) strategy, to ensure the generated code is syntactically correct, semantically aligned with the problem, and produces one of the expected output options.
  2. Z3 Symbolic Solver Module: This module utilizes the Z3 SMT solver, a high-performance tool for checking the satisfiability of logical formulas. It executes the Z3 code generated by the LLM to derive the final answer.
  3. Self-Refinement Module: This innovative module addresses cases where the LLM-generated code is not executable. It captures error messages from the Z3 solver and feeds them back to the LLM as additional prompts, guiding it to regenerate the code. This iterative process continues until the code is executable, significantly improving the reliability of the translation.

Datasets

The framework was evaluated on four diverse datasets covering deductive reasoning, first-order logic (FOL) reasoning, and constraint satisfaction reasoning (CSP):

  • ProntoQA: Deductive Reasoning (500 samples)
  • ProofWriter: Deductive Reasoning (4200 samples)
  • FOLIO: First Order Logic Reasoning (1208 samples)
  • LogicalDeduction: Constraint Satisfaction Reasoning (4500 samples)

The paper does not introduce new datasets but uses existing ones to benchmark the proposed framework against Logic-LM.

Key Insights and Ideas

  • Dual Process Theory Inspiration: The framework draws inspiration from the dual process theory of human cognition, leveraging LLMs for rapid, intuitive inferences and symbolic solvers for deliberate, logical accuracy.
  • Unified Z3 Integration: Instead of task-specific solvers, the framework uses a single, powerful Z3 solver across various logical reasoning tasks, aiming for better scalability.
  • Self-Correction for Reliability: The Self-Refinement Module is crucial for improving the robustness of LLM-generated code, ensuring that errors in translation are iteratively corrected.
  • LLM Translation Limitations: The analysis of failure cases reveals that LLMs struggle with accurately interpreting relationships, understanding context beyond literal translation, and correctly applying logical structures.

Key Results

The proposed framework demonstrated significant improvements over the existing Logic-LM approach:

  • Accuracy Gains: The framework achieved an average accuracy improvement of 4.86% for GPT-3.5-Turbo and 7.82% for GPT-4 across the four datasets.
  • High Performance on GPT-4: For GPT-4, the framework reached near-saturation accuracy (94-98%) on ProntoQA, ProofWriter, and Logical Deduction.
  • FOLIO Challenges: The FOLIO dataset, being more diverse in context and complex in logic operations, showed lower accuracy compared to other datasets, indicating ongoing challenges in first-order logic reasoning.

Limitations and Future Work

The authors acknowledge several limitations and suggest future directions:

  • Failure Case Analysis: The study identified specific LLM translation failures, including misinterpretation of relationships, literal translation without contextual understanding, and misapplication of logical structures.
  • Need for More Complex Tasks: The near-peak performance of GPT-4 on some datasets suggests a need for more challenging and diverse reasoning tasks, potentially through synthetic datasets like LogicBench.
  • Verifying Correct Predictions: Current multiple-choice formats might mask translation inaccuracies. Future work could involve an LLM self-checker for pre-validation of translations.
  • Natural Language Responses: Using natural language responses instead of fixed options could help reduce the likelihood of false positives.

Summary updated

BibTeX
@inproceedings{deng2024enhancing,
  author = {Shujie Deng and Honghua Dong and Xujie Si},
  title = {{Enhancing and Evaluating Logical Reasoning Abilities of Large Language Models}},
  booktitle = {SeT LLM @ ICLR},
  year = {2024},
  url = {https://openreview.net/forum?id=xw06d8NQAd},
}
Figure