Proceedingsbeitrag
Zitieren …

Can Formal Specifications Be Synthesized from Tests Alone?

Tianhai Liu  ORCID-iD-Icon 1, Maximilian Müller 1, Tobias Hey ORCID-iD-Icon 1, Vitus Lüntzel ORCID-iD-Icon 2, Muhammad Minhas ORCID-iD-Icon 1, Anne Koziolek ORCID-iD-Icon 1 und Bernhard Beckert ORCID-iD-Icon 1
1 Karlsruher Institut für Technologie (KIT)
2 Institut für Technik der Informationsverarbeitung (ITIV), Karlsruher Institut für Technologie (KIT)
DOI: 10.5445/IR/1000199048
Verlagsausgabe veröffentlicht am 11.11.2026
CC BY 4.0
Abstract

Formal specifications offer strong guarantees, but remain costly to write manually. Recent LLM-based approaches automate this by inferring specifications from source code, yet their reliance on white-box access poses barriers to industrial adoption due to intellectual property risks and deployment costs. Our approach uses LLMs to infer candidate specifications solely from test code and dynamic execution traces: the LLM observes only the program interface, selected inputs, and corresponding outputs or state changes, while the implementation internals remain hidden. Candidate specifications are validated locally using bounded model checking, with feedback guiding iterative refinement. Initial results on the SpecGenBench benchmark suggest that tests can guide LLMs towards meaningful Java Modeling Language specifications, while also highlighting checker compatibility and diagnostic feedback as key challenges for reliable refinement.