CUDABench: Benchmarking LLMs for Text-to-CUDA Generation

CUDABench is a comprehensive benchmark designed to evaluate Large Language Models (LLMs) on text-to-CUDA code generation. It assesses compilation correctness, functional consistency, and performance efficiency using a roofline model-based metric. The benchmark reveals that while LLMs often generate compilable CUDA code, functional correctness remains significantly lower, highlighting limitations in domain-specific algorithmic knowledge.

CUDABench: Benchmarking LLMs for Text-to-CUDA Generation

Introducing CUDABench: A New Benchmark for Evaluating LLMs on Text-to-CUDA Generation

Researchers have introduced CUDABench, a comprehensive new benchmark designed to rigorously evaluate the capability of Large Language Models (LLMs) to generate functional and performant CUDA code directly from natural language descriptions. This work, detailed in a new paper (arXiv:2603.02236v1), addresses a critical gap in existing benchmarks, which primarily test code translation rather than the more complex and general task of text-to-CUDA generation. Given the hardware-specific and performance-critical nature of GPU programming, accurately assessing LLM outputs is a significant challenge that CUDABench aims to solve.

Beyond Compilation: A Multi-Faceted Evaluation Framework

The CUDABench framework consists of two core components: a diverse dataset and a sophisticated scoring system. First, the team constructed CUDABench-Set, a dataset designed to cover a wide evaluation space across breadth, depth, and difficulty. It spans diverse, demanding application domains such as artificial intelligence, scientific computing, and data analytics.

Second, the researchers propose the CUDABench-Score and a Generative Verification Pipeline. This system moves far beyond simple compilation checks to provide a holistic assessment across three critical dimensions:

  • Compilation Correctness: Does the generated code compile without errors?
  • Functional Consistency: Does the compiled code produce the correct output when executed, verified against ground-truth implementations?
  • Performance-Score: A novel, roofline model-based metric that evaluates how efficiently the generated kernel utilizes GPU hardware resources like memory bandwidth and compute throughput.

Key Findings and Challenges in LLM-Generated GPU Code

Benchmarking state-of-the-art LLMs with CUDABench revealed several insightful and critical findings about the current state of text-to-CUDA capabilities. The results highlight a notable and concerning mismatch: while models often achieve high compilation success rates, their functional correctness—verified through execution—remains significantly lower. This indicates models can generate syntactically valid CUDA that nonetheless fails to perform the intended computation.

Further analysis identified a lack of deep, domain-specific algorithmic knowledge in LLMs, limiting their ability to generate optimal implementations for complex tasks. Perhaps most critically, the Performance-Score metric showed that even functionally correct LLM-generated kernels frequently exhibit suboptimal utilization of GPU hardware resources, leading to inefficient code that leaves potential performance on the table.

Why This Benchmark Matters

The introduction of CUDABench represents a major step forward for AI-assisted programming and high-performance computing research.

  • Raises the Bar for Evaluation: It shifts focus from mere code synthesis to the generation of correct, functional, and performant GPU code, which is essential for real-world deployment.
  • Provides Actionable Insights: The benchmark's multi-faceted scoring pinpoints specific failure modes—like the compilation vs. correctness gap—guiding future model development and training.
  • Accelerates HPC Development: By rigorously testing and improving LLMs' ability to generate efficient CUDA, this work paves the way for AI tools that can dramatically accelerate software development for scientists and engineers working with GPU-accelerated applications.

The benchmark code and dataset are publicly available at https://github.com/CUDA-Bench/CUDABench, providing a vital resource for the research community to measure progress in this challenging and impactful domain.

常见问题