评测大模型从自然语言生成高效CUDA代码的能力,发现编译成功但功能错误率高。
CUDABench: Benchmarking LLMs for Text-to-CUDA Generation
- 构建覆盖多领域、多难度的文本转CUDA测试集
- 提出三重评估体系:编译通过率、运行验证、性能得分
- 揭示大模型缺乏领域知识且难以发挥硬件性能
近期研究显示大型语言模型(LLMs)具备生成GPU内核的潜力。现有基准主要集中于高级语言到CUDA的翻译,忽视了更具挑战性的自然语言转CUDA任务。鉴于GPU编程具有硬件特异性与性能敏感性,准确评估LLM生成的程序性能十分困难。本文提出CUDABench,一个全面的基准,用于评估LLM的文本到CUDA生成能力。首先,我们构建CUDABench-Set,涵盖人工智能、科学计算、数据统计等多元应用领域,覆盖广度-深度-难度评估空间。进一步提出CUDABench-Score与生成验证流程,评估(1)编译正确性,(2)基于执行的函数一致性,(3)一种基于roofline的新指标——Performance-Score。对前沿LLMs的基准测试揭示了关键发现与挑战:编译成功率高但功能正确率低,缺乏领域特定算法知识,未能有效利用GPU硬件资源。该基准已开源:https://github.com/CUDA-Bench/CUDABench。
原文摘要 · Abstract (English)
Recent studies have demonstrated the potential of Large Language Models (LLMs) in generating GPU Kernels. Current benchmarks focus on the translation of high-level languages into CUDA, overlooking the more general and challenging task of text-to-CUDA generation. Furthermore, given the hardware-specific and performance-critical features of GPU programming, accurately assessing the performance of LLM-generated GPU programs is nontrivial. In this work, we introduce CUDABench, a comprehensive benchmark designed to evaluate the text-to-CUDA capabilities of LLMs. First, we construct CUDABench-Set, which covers Breadth-Depth-Difficulty evaluation space in diverse application domains, including artificial intelligence, scientific computing, and data analytics, etc. Furthermore, we propose CUDABench-Score and Generative Verification Pipeline that assess (1) compilation correctness, (2) functional consistency through execution-based verification, and (3) a novel roofline-based metric, Performance-Score. Benchmarking state-of-the-art LLMs reveals insightful findings and challenges of text-to-CUDA, such as a notable mismatch between high compilation success rates and low functional correctness, a lack of domain-specific algorithmic knowledge, and suboptimal utilization of GPU hardware resources. Our benchmark is available at https://github.com/CUDA-Bench/CUDABench.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。