CUDA-L1: 대조적 강화 학습을 통한 CUDA 최적화 개선
CUDA-L1: Improving CUDA Optimization via Contrastive Reinforcement Learning
July 18, 2025
저자: Xiaoya Li, Xiaofei Sun, Albert Wang, Jiwei Li, Chris Shum
cs.AI
초록
대형 언어 모델(Large Language Models)의 급속한 발전으로 인한 GPU 컴퓨팅 자원에 대한 수요의 기하급수적 증가는 자동화된 CUDA 최적화 전략의 시급한 필요성을 야기했습니다. 최근 LLM의 발전이 코드 생성에 있어 유망한 가능성을 보여주고 있지만, 현재 최첨단 모델들(예: R1, o1)은 CUDA 속도 개선에 있어 낮은 성공률을 보이고 있습니다. 본 논문에서는 CUDA 최적화를 위한 자동화된 강화 학습 프레임워크인 CUDA-L1을 소개합니다.
CUDA-L1은 CUDA 최적화 작업에서 성능 개선을 달성했습니다: NVIDIA A100에서 학습된 이 모델은 KernelBench의 250개 CUDA 커널 전반에 걸쳐 평균 17.7배의 속도 향상을 보였으며, 최대 449배의 속도 향상을 기록했습니다. 또한, 이 모델은 GPU 아키텍처 간 우수한 이식성을 보여주었는데, A100에 특화되어 최적화되었음에도 H100에서 평균 17.8배, RTX 3090에서 19.0배, L40에서 16.5배, H800에서 14.7배, H20에서 13.9배의 속도 향상을 달성했습니다. 이러한 벤치마크 결과를 넘어, CUDA-L1은 다음과 같은 주목할 만한 특성을 보여줍니다: 1) 다양한 CUDA 최적화 기법을 발견하고 이를 전략적으로 결합하여 최적의 성능을 달성함; 2) CUDA 최적화의 근본적인 원리를 발견함; 3) 명백하지 않은 성능 병목 현상을 식별하고, 성능을 저해하는 겉보기에는 유익해 보이는 최적화를 거부함.
CUDA-L1의 능력은 강화 학습이 초기에 낮은 성능을 보이는 LLM을 인간 전문가나 도메인 지식 없이 속도 향상 기반 보상 신호만으로 효과적인 CUDA 최적화 도구로 변모시킬 수 있음을 보여줍니다. 더 중요한 것은, 학습된 RL 모델이 획득한 추론 능력을 새로운 커널에까지 확장할 수 있다는 점입니다. 이러한 패러다임은 CUDA 연산의 자동화된 최적화 가능성을 열어주며, GPU 효율성을 크게 증진시키고 GPU 컴퓨팅 자원에 대한 증가하는 압박을 완화할 수 있는 잠재력을 가지고 있습니다.
English
The exponential growth in demand for GPU computing resources, driven by the
rapid advancement of Large Language Models, has created an urgent need for
automated CUDA optimization strategies. While recent advances in LLMs show
promise for code generation, current SOTA models (e.g. R1, o1) achieve low
success rates in improving CUDA speed. In this paper, we introduce CUDA-L1, an
automated reinforcement learning framework for CUDA optimization.
CUDA-L1 achieves performance improvements on the CUDA optimization task:
trained on NVIDIA A100, it delivers an average speedup of x17.7 across all 250
CUDA kernels of KernelBench, with peak speedups reaching x449. Furthermore, the
model also demonstrates excellent portability across GPU architectures,
achieving average speedups of x17.8 on H100, x19.0 on RTX 3090, x16.5 on L40,
x14.7 on H800, and x13.9 on H20 despite being optimized specifically for A100.
Beyond these benchmark results, CUDA-L1 demonstrates several remarkable
properties: 1) Discovers a variety of CUDA optimization techniques and learns
to combine them strategically to achieve optimal performance; 2) Uncovers
fundamental principles of CUDA optimization; 3) Identifies non-obvious
performance bottlenecks and rejects seemingly beneficial optimizations that
harm performance.
The capabilities of CUDA-L1 demonstrate that reinforcement learning can
transform an initially poor-performing LLM into an effective CUDA optimizer
through speedup-based reward signals alone, without human expertise or domain
knowledge. More importantly, the trained RL model extend the acquired reasoning
abilities to new kernels. This paradigm opens possibilities for automated
optimization of CUDA operations, and holds promise to substantially promote GPU
efficiency and alleviate the rising pressure on GPU computing resources.