Instantiation-based Formalization of Logical Reasoning Tasks using Language Models and Logical Solvers

Mohammad Raza, Natasa Milic-Frayling

TL;DR

Semantic Self-Verification (SSV) is a new neuro-symbolic approach that significantly boosts the logical reasoning capabilities of Large Language Models (LLMs) by using a solver to verify their work. By generating concrete examples to test abstract logical formalizations, SSV achieves state-of-the-art accuracy on complex puzzles and provides a "verified" flag with near-100% precision, potentially automating human-in-the-loop verification for many tasks.

What Problem Does This Paper Address?

While LLMs are impressive, they frequently stumble on complex logical reasoning tasks, like those found in the LSAT. A popular solution is to have the LLM translate a natural language (NL) problem into a formal program (e.g., Python or Z3 code) that a specialized logical solver can execute.

The bottleneck is the translation gap: LLMs often make subtle semantic errors when formalizing NL constraints into abstract logic. For example, a model might accidentally use an "Exists" quantifier when a "ForAll" is required. Because natural language is informal and the target code is rigid, these small bugs lead to completely wrong answers, and users have no way of knowing if the output is trustworthy without manual checking.

Methods

The authors introduce Semantic Self-Verification (SSV), a framework that treats the LLM as both a coder and a test-case generator.

  1. Program Generation: The LLM translates the NL problem (like the one in Figure 1) into a formal representation, such as Z3 SMT solver code (Figure 2).
  2. Semantic Verification: Instead of just running the code, the LLM is prompted to generate concrete instantiations (simple "if-then" examples) for every constraint in the problem. For a constraint like "Stacy does not repair any machine Yolanda repairs," the LLM might generate a positive example ("Stacy repairs radios, Yolanda repairs TVs") and a negative one ("Stacy and Yolanda both repair TVs").
  3. Solver-Based Check: The logical solver then checks if the abstract formalization is consistent with these concrete examples. If the code uses the wrong quantifier (as shown in Figure 4), the solver will flag the inconsistency.
  4. Semantic Repair: If a check fails, the failing example is fed back to the LLM as a "semantic error" to guide it in fixing the code.
  5. Near-Certain Reasoning: If the code passes all checks and satisfies well-formedness properties, the system returns the answer with an isVerified = True flag.
Figure 4: How concrete examples catch abstract formalization errors.

Datasets

The researchers evaluated SSV across five diverse logical reasoning benchmarks:

  • AR-LSAT: Analytical reasoning questions from actual Law School Admission Tests (the most challenging).
  • FOLIO: Expert-crafted real-world knowledge problems requiring first-order logic.
  • LogicalDeduction: Object sequence ordering tasks from the BigBench benchmark.
  • PrOntoQA: Synthetic deductive reasoning tasks.
  • ProofWriter: Implications and proofs over natural language.

Key Insights and Ideas

  • Concrete vs. Abstract: LLMs are much better at generating simple, concrete examples of a rule than they are at writing the abstract rule itself in code. SSV leverages this strength to verify the harder task.
  • Consistency as Truth: The core idea is akin to a "consensus-based ensemble." By checking if two independent outputs from the LLM (the abstract code and the concrete examples) agree through the lens of a logical solver, the system can filter out hallucinations.
  • Reducing Human Effort: By providing a high-confidence isVerified signal, the system can automate the "easy" cases, allowing humans to focus only on the complex ones where the AI couldn't verify its own logic.

Key Results

SSV sets a new high bar for logical reasoning in AI:

  • Accuracy Leap: On the difficult AR-LSAT dataset, SSV achieved 71.3% accuracy, a massive jump from the previous state-of-the-art (Logic-LM) at 43%, and even surpassing the average human performance of 59.7%.
  • Perfect Precision: When using GPT-4, the "verified" flag had 100% precision on AR-LSAT, FOLIO, and LogicalDeduction. If the system said it was sure, it was right.
  • Significant Coverage: The system was able to verify 21.7% of the hardest cases and over 75% of the cases in easier datasets like ProofWriter.
Figure 3: Towards near-perfect reasoning: SSV achieves new SoTA accuracy and 100% verification precision on the AR-LSAT law school tests dataset (all systems using GPT-4 as base LLM).

Limitations and Future Work

  • Ambiguity: Natural language is inherently ambiguous. Verification proves consistency, not necessarily that the AI interpreted a vague sentence exactly as a human would.
  • Insufficient Examples: Currently, the system only generates one positive and one negative example per constraint. This might miss "corner cases" where the logic fails.
  • Model Sensitivity: The precision and coverage drop when using weaker models like GPT-3.5, suggesting that the quality of the underlying LLM is still a critical factor.
  • Future Directions: The authors suggest exploring more exhaustive example generation strategies and applying this consistency-based verification to other domains like mathematical proofs or automated planning.

Summary updated

Abstract

Robustness of reasoning remains a significant challenge for large language models, and addressing it is essential for the practical applicability of AI-driven reasoning systems. We introduce Semantic Self-Verification (SSV), a novel approach that addresses the key challenge in combining language models with the rigor of logical solvers: to accurately formulate the reasoning problem from natural language to the formal language of the solver. SSV uses a consistency-based approach to produce strong abstract formalizations of problems using concrete instantiations that are generated by the model and verified by the solver. In addition to significantly advancing the overall reasoning accuracy over the state-of-the-art, a key novelty that this approach presents is a feature of verification that has near-perfect precision over a significant coverage of cases, as we demonstrate on open reasoning benchmarks. We propose such *near-certain reasoning* as a new approach to reduce the need for manual verification in many cases, taking us closer to more dependable and autonomous AI reasoning systems.
BibTeX
@inproceedings{raza2025instantiation,
  author = {Mohammad Raza and Natasa Milic-Frayling},
  title = {{Instantiation-based Formalization of Logical Reasoning Tasks using Language Models and Logical Solvers}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.24963/ijcai.2025/516},
}
Figure