potentialpaper

Fun2spec: Code Contract Synthesis At Scale

Shubham Ugare, Tarun Suresh, Sasa Misailovic, Julien Vanegue

ICLR 2026 submission

Edit this page

Or clone it with git

The page gets its repository with its first edit, so start in the web editor.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

Abstract. Specification synthesis -- the problem of inferring program specification from program implementation -- is an undecidable problem. Therefore, machine learning and more specifically, autoregressive large language models (LLMs) are a good fit for solving this problem. We demonstrate that code contracts, the most widespread software specification mechanism, can be generated by LLMs and validated using a software testing oracle on large real-world codebases. This oracle acts as an approximate code contract verifier. It only selects LLM-generated contracts that are test-valid, guaranteeing that the obtained contracts are at least as good as the test suite provided by the program. Our tool Fun2spec is the first code contract synthesis tool applied to real-world large-scale low-level C and C++ programs of millions of lines of code, raising the state-of-the-art of automated software verification using LLMs.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

add · history

No versions are recorded yet: its preprint, the venues it went to and what they decided, the camera-ready. Missing a version?

We don't know of a submission of this paper to a venue with open reviews. Missing a submission?

Loading the discussion…