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

将深度学习框架测试建立在数据流基础上

Grounding Deep Learning Framework Testing in Data Flow

State Key Laboratory for Novel Software Technology, Nanjing University(南京大学软件新技术国家重点实验室);UNIST(蔚山科学技术院)

Jiatao Ge, Yanzhou Mu, Yinglong Zou, Yibo Hu, Zhenyu Chen, Chunrong Fang

AI总结:

该研究提出基于数据流的FlowMuT测试方法,通过TFG捕获运行时信息,在PyTorch和MindSpore上测试发现55个基线遗漏bug,提升了数据流多样性与合法变异体率。

摘要:

数据流是深度学习(DL)框架执行的基础,包括自动微分和算子融合优化。涉及数据流的bug会导致结果错误或意外行为。现有测试方法主要通过算子拓扑表示模型,忽略了运行时张量值、属性以及算子输入要求,因此无法区分拓扑相似模型中的数据流,即便这些差异会影响框架行为。我们引入张量流图(Tensor Flow Graph,TFG)以捕获运行时张量状态和算子输入要求,其节点表示算子及其输入要求,边记录张量值和属性。基于TFG,我们提出FlowMuT,一种以数据流为基础的基于变异的测试方法。变异被表示为受约束子图替换,变异算子源自前期工作及对可变数据流对象的分析。每一轮中,FlowMuT为种子模型构建TFG,将变异算子与TFG位点配对,利用数据流约束过滤非法候选;它采用LinUCB根据覆盖率和影响选择候选,执行变异体,更新选择反馈,并将每个被接受的变异体作为下一个种子。我们在PyTorch和MindSpore上,使用不同应用场景的代表性模型评估FlowMuT。FlowMuT针对所有基线方法遗漏的案例提交了55份bug报告,开发者确认了41份报告并修复了其中7份报告描述的bug。FlowMuT的数据流多样性比最强基线高43.4%,合法变异体率为96.7%,而无约束时为86.4%。这些结果表明,从数据流视角进行测试是可行且有效的。

英文摘要:

Data flow underlies deep learning (DL) framework execution, including automatic differentiation and operator-fusion optimization. Bugs involving data flow can cause incorrect results or unexpected behavior. Existing testing methods represent models primarily by operator topology, omitting runtime tensor values and properties and operator input requirements. They therefore cannot distinguish data flows in models with similar topologies, even when these differences affect framework behavior. We introduce the Tensor Flow Graph (TFG) to capture runtime tensor states and operator input requirements. Its nodes represent operators and their input requirements, while its edges record tensor values and properties. Building on the TFG, we propose FlowMuT, a mutation-based testing method grounded in data flow. Mutations are represented as constrained subgraph replacements, with mutation operators derived from prior work and an analysis of mutable data flow objects. In each round, FlowMuT builds a TFG for the seed model, pairs mutation operators with TFG sites, and filters illegal candidates using data flow constraints. It uses LinUCB to select a candidate based on coverage and impact, executes the mutant, updates selection feedback, and uses each accepted mutant as the next seed. We evaluate FlowMuT on PyTorch and MindSpore using representative models from diverse application scenarios. FlowMuT submitted 55 bug reports for cases missed by all baseline methods; developers confirmed 41 reports and fixed the bugs described in 7 reports. FlowMuT achieves 43.4% higher data flow diversity than the strongest baseline and a legal mutant rate of 96.7%, compared with 86.4% without constraints. These results show that testing from a data flow perspective is practical and effective.

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

↑