Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Balestra, Agustín, Nolasco, Agustín, Molina, Facundo, Garbervetsky, Diego, Degiovanni, Renzo, Aguirre, Nazareno
Format: Preprint
Veröffentlicht: 2026
Schlagworte:
Online-Zugang:https://arxiv.org/abs/2604.10761
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866917401683034112
author Balestra, Agustín
Nolasco, Agustín
Molina, Facundo
Garbervetsky, Diego
Degiovanni, Renzo
Aguirre, Nazareno
author_facet Balestra, Agustín
Nolasco, Agustín
Molina, Facundo
Garbervetsky, Diego
Degiovanni, Renzo
Aguirre, Nazareno
contents Contract assertions, such as preconditions, postconditions, and invariants, play a crucial role in software development, enabling applications such as program verification, test generation, and debugging. Despite their benefits, the adoption of contract assertions is limited, due to the difficulty of manually producing such assertions. Dynamic analysis-based approaches, such as Daikon, can aid in this task by inferring expressive assertions from execution traces. However, a fundamental weakness of these methods is their reliance on the thoroughness of the test suites used for dynamic analysis. When these test suites do not contain sufficiently diverse tests, the inferred assertions are often not generalizable, leading to a high rate of invalid candidates (false positives) that must be manually filtered out. In this paper, we explore the use of large language models (LLMs) to automatically generate tests that attempt to invalidate generated assertions. Our results show that state-of-the-art LLMs can generate effective counterexamples that help to discard up to 11.68\% of invalid assertions inferred by SpecFuzzer. Moreover, when incorporating these LLM-generated counterexamples into the dynamic analysis process, we observe an improvement of up to 7\% in precision of the inferred specifications, with respect to the ground-truths gathered from the evaluation benchmarks, without affecting recall.
format Preprint
id arxiv_https___arxiv_org_abs_2604_10761
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle Improving Dynamic Specification Inference with LLM-Generated Counterexamples
Balestra, Agustín
Nolasco, Agustín
Molina, Facundo
Garbervetsky, Diego
Degiovanni, Renzo
Aguirre, Nazareno
Software Engineering
Contract assertions, such as preconditions, postconditions, and invariants, play a crucial role in software development, enabling applications such as program verification, test generation, and debugging. Despite their benefits, the adoption of contract assertions is limited, due to the difficulty of manually producing such assertions. Dynamic analysis-based approaches, such as Daikon, can aid in this task by inferring expressive assertions from execution traces. However, a fundamental weakness of these methods is their reliance on the thoroughness of the test suites used for dynamic analysis. When these test suites do not contain sufficiently diverse tests, the inferred assertions are often not generalizable, leading to a high rate of invalid candidates (false positives) that must be manually filtered out. In this paper, we explore the use of large language models (LLMs) to automatically generate tests that attempt to invalidate generated assertions. Our results show that state-of-the-art LLMs can generate effective counterexamples that help to discard up to 11.68\% of invalid assertions inferred by SpecFuzzer. Moreover, when incorporating these LLM-generated counterexamples into the dynamic analysis process, we observe an improvement of up to 7\% in precision of the inferred specifications, with respect to the ground-truths gathered from the evaluation benchmarks, without affecting recall.
title Improving Dynamic Specification Inference with LLM-Generated Counterexamples
topic Software Engineering
url https://arxiv.org/abs/2604.10761