arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.19873cs.LGcs.AIcs.PL
收藏

从大到小:通过推理图迁移CUDA优化专业知识

From Large to Small: Transferring CUDA Optimization Expertise via Reasoning Graph

Institute of Computing Technology, Chinese Academy of Sciences(中国科学院计算技术研究所);University of Chinese Academy of Sciences(中国科学院大学);South China University of Technology(华南理工大学)

Junfeng Gong, Zhiyi Wei, Junying Chen, Cheng Liu, Huawei Li

AI总结:

提出ReGraphT框架,通过推理图将LLM级CUDA优化知识迁移至SLM,利用蒙特卡洛图搜索实现高效探索,在CUDAEval和ParEval上平均加速2.33倍,使SLM接近LLM性能且无隐私风险。

摘要:

尽管CUDA编程和领域专用库已取得显著发展,但有效利用具有大规模并行引擎的GPU仍然困难。大型语言模型(LLMs)在从顺序代码生成优化的CUDA代码方面展现出强大潜力。然而,在实践中使用LLMs面临两大挑战:基于云的API存在代码泄露风险,而本地部署通常计算成本高昂且效率低下。这些缺点激发了人们对小型语言模型(SLMs)的兴趣,它们更轻量且更注重隐私。令人鼓舞的是,近期研究表明SLMs在特定任务上可以达到与LLMs相当的性能。虽然SLMs能在领域特定任务上匹配LLMs,但根据我们的实验,其有限的推理能力导致在复杂CUDA生成中表现次优。为弥合这一差距,我们提出ReGraphT,一个无需训练、基于检索增强生成的框架,将LLM级别的推理迁移至更小的模型。ReGraphT将CUDA优化轨迹组织成结构化推理图,将组合的CUDA优化建模为状态转换,并利用蒙特卡洛图搜索(MCGS)进行高效探索。我们还提出了一个CUDA专用基准,其难度层级由推理复杂度定义,以更全面地评估模型。实验表明,ReGraphT优于HPC专用微调模型和其他检索增强方法,在CUDAEval和ParEval上实现了平均2.33倍的加速。当与DeepSeek-Coder-V2-Lite-Instruct和Qwen2.5-Coder-7B-Instruct搭配时,ReGraphT使SLMs能够接近LLM级别的性能,且无相关隐私风险或过多计算开销。

英文摘要:

Despite significant evolution of CUDA programming and domain-specific libraries, effectively utilizing GPUs with massively parallel engines remains difficult. Large language models (LLMs) show strong potential in generating optimized CUDA code from sequential code. However, using LLMs in practice faces two major challenges: cloud-based APIs pose risks of code leakage, and local deployment is often computationally expensive and inefficient. These drawbacks have spurred interest in small language models (SLMs), which are more lightweight and privacy-friendly. Encouragingly, recent studies show that SLMs can achieve performance comparable to LLMs on specific tasks. While SLMs can match LLMs on domain-specific tasks, their limited reasoning abilities lead to suboptimal performance in complex CUDA generation according to our experiments. To bridge this gap, we propose ReGraphT, a training-free, retrieval-augmented generation framework that transfers LLM-level reasoning to smaller models. ReGraphT organizes CUDA optimization trajectories into a structured reasoning graph, modeling the combined CUDA optimizations as state transitions, and leverages Monte Carlo Graph Search (MCGS) for efficient exploration. We also present a CUDA-specific benchmark with difficulty tiers defined by reasoning complexity to evaluate models more comprehensively. Experiments show that ReGraphT outperforms HPC-specific fine-tuned models and other retrieval-augmented approaches, achieving an average 2.33X speedup on CUDAEval and ParEval. When paired with DeepSeek-Coder-V2-Lite-Instruct and Qwen2.5-Coder-7B-Instruct, ReGraphT enables SLMs to approach LLM-level performance without the associated privacy risks or excessive computing overhead.

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

↑