Kaizen:用于大语言模型翻译的高性能计算应用的变质模糊测试和差分测试
Kaizen: Metamorphic Fuzzing and Differential Testing for LLM-Translated HPC Applications
AI总结:
研究大语言模型驱动的高性能计算应用代码翻译的正确性评估,提出用变质模糊测试和差分测试框架Kaizen,经源码变异、语法输入模糊等生成等价程序,暴露语义差异,评估揭示了编译成功与正确性的关系。
摘要:
大语言模型越来越多地用于跨异构高性能计算编程模型移植科学代码。但当前评估方法无法可靠确保行为正确性。我们提出Kaizen,一个用于评估大语言模型翻译的高性能计算代码正确性的变质模糊测试和差分测试框架。Kaizen通过源代码变异进行变质模糊测试,通过基于语法的输入模糊测试探索行为多样性,并通过差分测试暴露原始应用程序和翻译后的应用程序之间的语义差异。我们在内核级和全程序粒度上使用三个微调的大语言模型对16个科学应用程序的CUDA到OpenMP翻译进行了评估。我们的评估表明:(1)编译成功不能很好地代表正确性;(2)大语言模型翻译的程序表现出系统的编译时错误模式,内核级翻译有九类,全程序翻译有27类;(3)编译后幸存的语义错误通常依赖于输入,需要差分测试来暴露;(4)全程序翻译比内核级翻译困难得多。这些发现凸显了对大语言模型辅助的高性能计算代码翻译进行面向正确性评估的必要性。
英文摘要:
Large language models (LLMs) are increasingly used to port scientific codes across heterogeneous high-performance computing (HPC) programming models, such as translating CUDA to OpenMP, OpenACC, Kokkos or SYCL. However, current evaluations use compilation success, token-level similarity, or developer-written tests from static benchmarks, which cannot reliably ensure behavioral correctness. We present Kaizen, a metamorphic fuzzing and differential testing framework for evaluating the correctness of LLM-translated HPC code. Kaizen uses metamorphic fuzzing via source-code mutation to generate semantically equivalent programs, grammar-based input fuzzing to explore behavioral diversity, and differential testing to expose semantic divergences between original and translated applications that compile and pass developer-written tests yet produce incorrect scientific results. We evaluate Kaizen on CUDA-to-OpenMP translation of 16 scientific applications from seven domains using three fine-tuned LLMs at kernel-level and full-program granularity. Our evaluation reveals that (1) compilation success is a poor proxy for correctness; (2) LLM-translated programs exhibit systematic compile-time error patterns, with nine categories for kernel-level translation and 27 for full-program translation; (3) semantic errors that survive compilation are often input-dependent and require differential testing to expose; and (4) full-program translation is substantially harder than kernel-level translation. These findings highlight the need for correctness-oriented evaluation of LLM-assisted HPC code translations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。