SpecGen: Automated Generation of Formal Program Specifications via Large Language Models
Core Concepts
Large Language Models can effectively generate accurate and comprehensive formal program specifications, as demonstrated by SpecGen.
Abstract
The content discusses the challenges in manually crafting formal program specifications and introduces SpecGen, a novel technique leveraging Large Language Models (LLMs) to automate the generation process. SpecGen consists of two phases: conversation-driven specification generation and mutation-based specification generation. Experimental results show that SpecGen outperforms existing methods in generating verifiable specifications for complex programs.
I. Introduction
Formal program specifications are crucial in software development.
Challenges in manual specification creation led to the emergence of automated methods.
SpecGen leverages LLMs for accurate and comprehensive specification generation.
II. Approach
SpecGen utilizes a conversational approach with LLMs for initial query and feedback.
Mutation-based generation corrects erroneous LLM outputs for complex programs.
III. Experimental Results
SpecGen outperforms baselines on SV-COMP and SpecGenBench datasets.
Ablation study shows the importance of different mutation types in SpecGen's performance.
Heuristic selection strategy improves verification efficiency significantly.
User study rates SpecGen's generated specifications close to expert-written oracle specifications.
"Existing methods struggle to accurately capture complex program behaviors."
"SpecGen succeeds in generating verifiable specifications for a wide range of programs."