Toward Automated Validation of Language Model Synthesized Test Cases Using Semantic Entropy

View at publisher
Authors: Hamed Taherkhani, Jiho Shin, Muhammad Ammar Tahir, Md Rakib Hossain Misu, Vineet Sunil Gattani, Hadi Hemmati
Cited by: 2
References: 59

Abstract

Modern Large Language Model (LLM)-based programming agents often rely on test execution feedback to refine their generated code. These tests are synthetically generated by LLMs. However, LLMs may produce invalid or hallucinated test cases, which can mislead feedback loops and degrade the performance of agents in refining and improving code. This paper introducesVALTEST, a novel framework that leverages semantic entropy to automatically validate test cases generated by LLMs. By analyzing the semantic structure of test cases and computing entropy-based uncertainty measures,VALTESTtrains a machine learning model to classify test cases as valid or invalid and filters out invalid test cases. Experiments on multiple benchmark datasets and various LLMs show thatVALTESTnot only boosts test validity by up to 29% but also improves code generation performance, as evidenced by significant increases in pass@1 scores. Our extensive experiments also reveal that semantic entropy is a reliable indicator to distinguish between valid and invalid test cases and provides a robust solution for improving the correctness of LLM-generated test cases used in software testing and code generation.

Fields of Study & Subjects

Software Testing and Debugging Techniques Software System Performance and Reliability Software Engineering Research

Publication details

Journal / source
IEEE Transactions on Software Engineering
Publisher
Institute of Electrical and Electronics Engineers (IEEE)
Volume
52
Issue
4
Pages
1426–1445
Publication date
13 February 2026