AI
New LLM system automates formal specification writing for large-scale program verification
Researchers introduce SpecSyn, which uses language models to generate and refine formal specifications, achieving over 90% precision on real-world verification tasks.
Building formal specifications—the detailed rules that software must follow—remains one of the most labor-intensive hurdles in formal program verification. SpecSyn, a new technique described in a recent arXiv paper, tackles this bottleneck by leveraging large language models to automatically generate and refine specifications for real-world code.
The challenge with current approaches#
Formal verification ensures software correctness with mathematical rigor, but writing the complete set of specifications needed to verify even moderately complex programs demands significant manual effort. While existing LLM-based methods have shown promise, they struggle with two critical limitations: they cannot efficiently handle large programs, and they lack ways to measure or guarantee that the specifications they produce are actually strong enough to catch bugs or enforce intended behavior.
How SpecSyn works#
Rather than trying to process an entire program at once, SpecSyn breaks code into smaller, manageable segments and processes each piece through an iterative generation pipeline. The key innovation lies in its refinement step: the system uses semantic-non-equivalent program mutations—artificial variations of the code—to test whether generated specifications are strong enough to discriminate between correct and incorrect behavior. Specifications that fail to catch these mutations are automatically strengthened.
Performance on real-world code#
In extensive evaluation, SpecSyn maintained precision above 90% and recall above 75% across test cases, substantially outperforming comparable LLM-based approaches. When applied to open-source programs, the system successfully handled 1,022 out of 1,421 target verification properties, demonstrating practical viability on genuine software verification challenges.

