arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.08254cs.SEcs.AI
收藏

迈向利用语义熵自动验证语言模型合成测试用例

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

University of Washington(华盛顿大学);University of California, Irvine(加州大学欧文分校);Arizona State University(亚利桑那州立大学)

Hamed Taherkhani, Jiho Shin, Muhammad Ammar Tahir, Md Rakib Hossain Misu, Vineet Sunil Gattani, Hadi Hemmati

AI总结:

本文提出VALTEST框架,利用语义熵自动验证LLM生成的测试用例,提升测试有效性与代码生成性能。

摘要:

现代基于大型语言模型(LLM)的编程代理常常依赖测试执行反馈来完善其生成的代码。这些测试是通过LLM合成生成的。然而,LLM可能会生成无效或虚构的测试用例,这可能误导反馈循环并降低代理在完善和改进代码方面的性能。本文介绍了VALTEST,一种新的框架,利用语义熵来自动验证由LLM生成的测试用例。分析测试用例的语义结构并计算基于熵的不确定性度量,VALTEST训练一个机器学习模型来将测试用例分类为有效或无效,并过滤掉无效的测试用例。在多个基准数据集和各种LLM上的实验表明,VALTEST不仅将测试有效性提高了高达29%,还提高了代码生成性能,这体现在pass@1分数的显著增加。我们的广泛实验还揭示了语义熵是区分有效和无效测试用例的可靠指标,这为改进软件测试和代码生成中使用的LLM生成的测试用例的正确性提供了稳健的解决方案。

英文摘要:

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 introduces VALTEST, a novel framework that leverages semantic entropy to automatically validate test cases generated by LLMs. Analyzing the semantic structure of test cases and computing entropy-based uncertainty measures, VALTEST trains 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 that VALTEST not 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, which provides a robust solution for improving the correctness of LLM-generated test cases used in software testing and code generation.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑