指导 LLM 成为更好的 CUDA 优化器
Tutoring LLM into a Better CUDA Optimizer
AI总结:
本文评估最新推理 LLM 生成优化 CUDA 代码的能力,通过提示指导、自动与人工评估及交互式纠错,发现其编码能力较强但需指导才能达到专家优化水平。
摘要:
大型语言模型(LLM)最近的飞跃引发了编程工具(如 GitHub Copilot)的革命,这些工具可以帮助完成代码生成、调试,甚至性能优化。在本文中,我们聚焦于最新推理模型为预定义的知名任务生成优化 CUDA 代码的能力。我们的目标是确定 LLM 自身能够执行哪些类型的代码优化和并行模式,以及它们是否可以通过指导(在提示中提供更详细的提示和准则)得到改进。生成的解决方案同时接受了自动评估(正确性和加速比)与人工评估(代码审查),以提供更细致的视角。我们还尝试了一种交互式方法,使 LLM 能够在一个会话中修复其先前的错误。结果表明,LLM 是相当熟练的编码者;然而,它们需要指导才能达到并行计算专家提供的优化解决方案水平。
英文摘要:
Recent leaps in large language models (LLMs) caused a revolution in programming tools (like GitHub Copilot) that can help with code generation, debugging, and even performance optimization. In this paper, we focus on the capabilities of the most recent reasoning models to generate optimized CUDA code for predefined, well-known tasks. Our objective is to determine which types of code optimizations and parallel patterns the LLMs can perform by themselves and whether they can be improved by tutoring (providing more detailed hints and guidelines in the prompt). The generated solutions were evaluated both automatically (for correctness and speedup) and manually (code reviews) to provide a more detailed perspective. We also tried an interactive approach where the LLM can fix its previous mistakes within a session. The results indicate that LLMs are quite skilled coders; however, they require tutoring to reach optimized solutions provided by parallel computing experts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。