mlsanityData to 14 Oct 2026

Loop Invariant Generation: A Hybrid Framework of Reasoning optimised LLMs and SMT Solvers

arXiv 2508.00419 ↗First posted 1 Aug 2025cs.LO cs.LG cs.PLcited by 0

On the map: LLM reasoning → Reasoning benchmarks and evaluation

Abstract (arXiv)

Loop invariants are essential for proving the correctness of programs with loops. Developing loop invariants is challenging, and fully automatic synthesis cannot be guaranteed for arbitrary programs. Some approaches have been proposed to synthesize loop invariants using symbolic techniques and more recently using neural approaches. These approaches are able to correctly synthesize loop invariants only for subsets of standard benchmarks. In this work, we investigate whether modern, reasoning-optimized large language models can do better. We integrate OpenAI's O1, O1-mini, and O3-mini into a tightly coupled generate-and-check pipeline with the Z3 SMT solver, using solver counterexamples to iteratively guide invariant refinement. We use Code2Inv benchmark, which provides C programs along with their formal preconditions and postconditions. On this benchmark of 133 tasks, our framework achieves 100% coverage (133 out of 133), outperforming the previous best of 107 out of 133, while requiring only 1-2 model proposals per instance and 14-55 seconds of wall-clock time. These results demonstrate that LLMs possess latent logical reasoning capabilities which can help automate loop invariant synthesis. While our experiments target C-specific programs, this approach should be generalizable to other imperative languages.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Reasoning benchmarks and evaluation, one of 17 directions in LLM reasoning. Builds on 4 of its 25 references that are in the map. First posted on arXiv 1 Aug 2025.

Builds on

4 of 25 references.

References · 4

  1. 2023GPT-4 Technical Reportcited by 18,396
  2. 2023A Comprehensive Capability Analysis of GPT-3 and GPT-3.5 Series Modelscited by 246
  3. 2023Lemur: Harmonizing Natural Language and Code for Language Agentscited by 72
  4. 2023Finding Inductive Loop Invariants using Large Language Modelscited by 36

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025A Neurosymbolic Approach to Loop Invariant Generation via Weakest Precondition Reasoning
  2. 2026ReaComp: Compiling LLM Reasoning into Symbolic Solvers for Efficient Program Synthesis
  3. 2026Neuro-Symbolic Software Verification: Hyper-charging Local Language Models with Symbolic Reasoning at Scale
  4. 2025Integrating Symbolic Execution with LLMs for Automated Generation of Program Specifications
  5. 2026Not All Invariants Are Equal: Curating Training Data to Accelerate Program Verification with SLMs
  6. 2025CODE-DITING: A Reasoning-Based Metric for Functional Alignment in Code Evaluation
  7. 2025Understanding Formal Reasoning Failures in LLMs as Abstract Interpreters
  8. 2025rStar-Coder: Scaling Competitive Code Reasoning with a Large-Scale Verified Dataset