发现PyTorch编译器隐性正确性错误,提出针对性检测工具AlignGuard。
Demystifying the Silence of Correctness Bugs in PyTorch Compiler
- 基于实证分析提炼编译错误特征,构建针对性检测方法。
- 在最新torch.compile中发现23个新错误,14个被标记为高优先级。
- 利用大模型变异测试用例,适合框架开发者和可靠性研究人员。
AI基础设施的性能优化对大语言模型(LLM)的快速应用至关重要。PyTorch编译器(torch.compile)作为深度学习模型(包括LLM)的核心优化工具,备受关注。然而,torch.compile易出现正确性错误,导致编译后模型输出错误但不触发异常、崩溃或警告,严重威胁下游LLM应用的可靠性。来自PyTorch社区的数据表明,19.2%的高优先级问题由torch.compile引发的错误输出导致,是第二常见的错误类别(仅次于程序崩溃的19.57%)。然而,尚无系统研究专门刻画并检测此类错误。本文首次对torch.compile中的正确性错误进行实证研究,分析其特征,并评估现有测试工具的检测效果。基于研究结果,我们提出一种名为AlignGuard的验证技术,通过整合从实证中提取的错误特征,结合大模型驱动的测试用例变异,实现对正确性错误的检测。截至撰写时,AlignGuard已成功发现23个新的torch.compile正确性错误,均获PyTorch开发团队确认或修复,其中超过一半(14/23)被标记为高优先级,证明了该技术的有效性。
原文摘要 · Abstract (English)
Performance optimization of AI infrastructure is key to the fast adoption of large language models (LLMs). The PyTorch compiler (torch.compile), a core optimization tool for deep learning (DL) models (including LLMs), has received due attention. However, torch.compile is prone to correctness bugs, which cause incorrect outputs of compiled DL models without triggering exceptions, crashes, or warnings. These bugs pose a serious threat to the reliability of downstream LLM applications. Data from the PyTorch community shows that 19.2% of high-priority issues are incorrect outputs of compiled DL models induced by torch.compile bugs, the second-most-common bug category (only behind program crashes at 19.57%). However, no systematic study has been conducted to specifically characterize and thereby detect these bugs. In this paper, we present the first empirical study of the correctness bugs in torch.compile, examine their characteristics, and assess the effectiveness of existing fuzzers in detecting them. Based on our findings, we propose a proof-of-concept testing technique named AlignGuard, tailored specifically for detecting correctness bugs in torch.compile. AlignGuard incorporates bug characteristics distilled from our empirical study, applying LLM-based test mutation to existing test cases for correctness bug detection. At the time of writing, AlignGuard has successfully detected 23 new correctness bugs in recent torch.compile. All these bugs have been confirmed or fixed by the PyTorch development team, and over half (14/23) of them are even marked as high-priority bugs, underscoring the usefulness of our technique.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。