arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.13987cs.SE
收藏

基于代理的张量测试:用于深度学习库模块的单元测试生成

ATTest: Agent-Driven Tensor Testing for Deep Learning Library Modules

Nanjing University(南京大学);Nanjing University of Science and Technology(南京理工大学)

Zhengyu Zhan, Ye Shang, Jiawei Liu, Chunrong Fang, Quanjun Zhang, Zhenyu Chen

AI总结:

ATTest通过基于代理的框架生成深度学习库模块的高效单元测试,显著提升测试覆盖率和稳定性。

摘要:

深度学习(DL)库的单元测试因复杂的数值语义和隐含的张量约束而具有挑战性。传统的基于搜索的软件测试(SBST)常常存在语义盲点,无法满足高维张量的约束,而大型语言模型(LLMs)则在跨文件上下文和不稳定代码修改方面遇到困难。本文提出了ATTest,一种用于模块级单元测试生成的基于代理的张量测试框架。ATTest协调了一个七阶段的流水线,包括约束提取和迭代的“生成-验证-修复”循环,以维持测试稳定性并缓解上下文窗口饱和问题。在PyTorch和TensorFlow上的评估表明,ATTest在PynguinML等最先进的基线方法上表现显著更好,分别实现了平均分支覆盖率为55.60%和54.77%。结果展示了基于代理的工作流如何在数值库中弥合语义鸿沟,同时确保可审计的测试合成。

英文摘要:

The unit testing of Deep Learning (DL) libraries is challenging due to complex numerical semantics and implicit tensor constraints. Traditional Search-Based Software Testing (SBST) often suffers from semantic blindness, failing to satisfy the constraints of high-dimensional tensors, whereas Large Language Models (LLMs) struggle with cross-file context and unstable code modifications. This paper proposes ATTest, an agent-driven tensor testing framework for module-level unit test generation. ATTest orchestrates a seven-stage pipeline, which encompasses constraint extraction and an iterative "generation-validation-repair" loop, to maintain testing stability and mitigate context-window saturation. An evaluation on PyTorch and TensorFlow demonstrates that ATTest significantly outperforms state-of-the-art baselines such as PynguinML, achieving an average branch coverage of 55.60% and 54.77%, respectively. The results illustrate how agent-driven workflows bridge the semantic gap in numerical libraries while ensuring auditable test synthesis. Source code: https://github.com/iSEngLab/ATTest.git

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

↑