Integrating Symbolic Execution with LLMs for Automated Generation of Program Specifications
Not on the map. Why?
Abstract (arXiv)
Automatically generating formal specifications including loop invariants, preconditions, and postconditions for legacy code is critical for program understanding, reuse and verification. However, the inherent complexity of control and data structures in programs makes this task particularly challenging. This paper presents a novel framework that integrates symbolic execution with large language models (LLMs) to automatically synthesize formally verified program specifications. Our method first employs symbolic execution to derive precise strongest postconditions for loop-free code segments. These symbolic execution results, along with automatically generated invariant templates, then guide the LLM to propose and iteratively refine loop invariants until a correct specification is obtained. The template-guided generation process robustly combines symbolic inference with LLM reasoning, significantly reducing hallucinations and syntactic errors by structurally constraining the LLM's output space. Furthermore, our approach can produce strong specifications without relying on externally provided verification goals, enabled by the rich semantic context supplied by symbolic execution, overcoming a key limitation of prior goal-dependent tools. Extensive evaluation shows that our tool SESpec outperforms the existing state-of-the-art tools across numerical and data-structure benchmarks, demonstrating both high precision and broad applicability.
Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). First posted on arXiv 11 Jun 2025.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2025Can Large Language Models Reason About Complex Execution Paths? An Empirical Study on Pythoncited by 0
- 2026Privilege and confidentiality in generative AI workflowscited by 0
- 2026Specula: Scaling formal specifications for autonomous model checking of system codecited by 0
- 2026Model-Driven Requirements Configuration with Three-Valued Uncertainty Scoringcited by 0
- 2026Model-Driven Requirements Configuration with Three-Valued Uncertainty Scoring28 Jul 2026
- 2026Specula: Scaling formal specifications for autonomous model checking of system code28 Jul 2026
- 2026Privilege and confidentiality in generative AI workflows6 Jul 2026
- 2025Can Large Language Models Reason About Complex Execution Paths? An Empirical Study on Python23 Nov 2025
Similar, not cited
Close in wording, no citation either way
- 2025Enhancing LLM-based Specification Generation via Program Slicing and Logical Deletion
- 2025Can LLMs Reason About Program Semantics? A Comprehensive Evaluation of LLMs on Formal Specification Inference
- 2026Teaching LLMs Program Semantics via Symbolic Execution Traces
- 2025Understanding Formal Reasoning Failures in LLMs as Abstract Interpreters
- 2026Inferring Code Correctness from Specification
- 2025Loop Invariant Generation: A Hybrid Framework of Reasoning optimised LLMs and SMT Solvers
- 2026CoRE: A Fine-Grained Code Reasoning Benchmark Beyond Output Prediction
- 2026Teaching Code LLMs to Reason with Intermediate Formal Specifications