paperbot · PL 论文追踪

全部论文 待读 收藏

P1 Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models

面向精确类型错误检测的大语言模型反射式单元测试生成
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 7/10 · 该论文属于“AI→PL”方向,利用 LLM 结合类型约束分析与反射验证来生成单元测试并检测 Python 类型错误,具有问题驱动和真实项目验证,契合用户对 LLM 改进程序分析/验证的兴趣。但它主要面向测试生成与类型错误检测,并非核心静态分析或形式化验证,也不涉及 Agentic 程序、浮点程序分析或贝叶斯程序分析,因此匹配中上而非正中核心。引用 3 inbox
Chen Yang, Ziqi Wang, Yanjie Jiang, Lin Yang, Yuteng Zheng, Jianyi Zhou, Junjie Chen
crossref: 2026-09-12

AI 速览

一句话:提出 rTED,用类型约束分析与反射验证引导 LLM 生成单元测试,精准检测 Python 类型错误并降低误报。

Python 类型错误常导致运行时失败,现有静态分析工具虽无需执行即可检测,但误报率高;单元测试生成虽有高覆盖率潜力,却缺乏针对性引导,难以生成暴露 bug 的测试。为此,本文提出 rTED:一种类型感知的测试生成技术,将逐步类型约束分析与反射式验证相结合,引导大语言模型生成测试并抑制误报。作者在 BugsInPy 与 TypeBugs 两个基准上评估,rTED 比四种最先进技术多检测出 22~29 个类型错误,精确率提升 173.9%~245.9%;在六个真实开源 Python 项目中发现 12 个此前未知的类型错误。

问题
Python 类型错误易引发运行时故障,而静态分析误报高、无引导的单元测试生成难以稳定暴露此类错误。
方法
rTED 将逐步类型约束分析与反射式验证结合,用于引导大语言模型生成类型感知的单元测试,并抑制误报。
评估
在 BugsInPy 和 TypeBugs 基准上对比四种 SOTA 技术,并在六个真实开源 Python 项目中验证,统计检出的类型错误数与精确率。
原文摘要(Abstract)

Type errors in Python often lead to runtime failures, posing significant challenges to software reliability and developer productivity. Existing static analysis tools aim to detect such errors without execution but frequently suffer from high false positive rates. Recently, unit test generation techniques offer great promise in achieving high test coverage, but they often struggle to produce bug-revealing tests without tailored guidance. To address these limitations, we present rTED, a novel type-aware test generation technique for automatically detecting Python type errors. Specifically, rTED combines step-by-step type constraint analysis with reflective validation to guide the test generation process and effectively suppress false positives. We evaluated rTED on two widely-used benchmarks, BugsInPy and TypeBugs. Experimental results show that rTED can detect 22 ∼ 29 more benchmarked type errors than four state-of-the-art techniques. rTED is also capable of producing fewer false positives, achieving an improvement of 173.9%∼245.9% in precision. Furthermore, we applied rTED to six real-world open-source Python projects, and successfully discovered 12 previously unknown type errors, demonstrating rTED’s practical value.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9270,
  title = {Reflective Unit Test Generation for Precise Type Error Detection with Large Language Models},
  author = {Chen Yang and Ziqi Wang and Yanjie Jiang and Lin Yang and Yuteng Zheng and Jianyi Zhou and Junjie Chen},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00233}
}