TL;DR
Large Language Models (LLMs) are already great at writing Python, so why not have them write ultra-fast GPU kernels from scratch? The authors introduce CUDABench, the first comprehensive benchmark evaluating how well AI translates plain English directly into optimized CUDA code—and judge it not just by whether it works, but by how close it gets to the physical limits of the silicon. Spoiler alert: modern AI knows CUDA grammar inside and out, yet struggles mightily to make the hardware truly sing.
What Problem Does This Paper Address?
Writing high-performance CUDA—the low-level code that orchestrates thousands of parallel GPU threads—is notoriously difficult. Recently, researchers started asking LLMs to automate this. However, existing benchmarks mostly test code-to-code translation (like turning a clean PyTorch snippet into CUDA), where the algorithmic logic is already handed to the AI on a silver platter. They also focus heavily on standard Machine Learning operators rather than broader scientific computing.
Furthermore, how do you grade a GPU program? A kernel that outputs the right numbers might still run agonizingly slow. Most benchmarks measure raw execution time, which gets messy fast—it depends entirely on which GPU you own, input sizes, and background system noise. We needed a way to test from-scratch text-to-CUDA generation across diverse fields, paired with a universal yardstick for hardware efficiency.
Methods
To evaluate generated code fairly, the authors built an automated Generative Verification Pipeline paired with a novel metric called the CUDABench-Score.
First, the pipeline synthesizes random test data on the fly (saving massive disk space), compiles the LLM’s code with NVIDIA's nvcc, and checks if the math matches ground-truth outputs within strict numerical tolerances.
If a kernel survives correctness checks, it gets profiled using NVIDIA Nsight Compute to calculate its Performance-Score, grounded in the classic Roofline Model of computer architecture. Every GPU has two hard physical ceilings: how fast it can do math (compute bound) and how fast it can move data from memory (memory bound). By measuring a kernel's "arithmetic intensity" (FLOPs per byte moved), the authors calculate the theoretical maximum speed that specific kernel could possibly achieve on that specific GPU.
The Performance-Score is simply achieved speed divided by attainable speed. Whether you run the test on a datacenter A40 or a gaming RTX 4090, the score normalizes against that chip's physical ceiling—giving us a clean, hardware-independent measure of how well the AI utilized the silicon.
Datasets
The authors introduce CUDABench-Set, a newly constructed text-to-CUDA dataset comprising 1,500 evaluation instances (500 unique tasks across three difficulty levels), all backed by verified ground-truth reference kernels. Unlike prior benchmarks like KernelBench (PyTorch-to-CUDA) or ComputeEval (which lacks performance profiling and uses small inputs), CUDABench-Set spans a 3D evaluation space:
- Breadth: Covers six distinct GPU domains: Deep Learning, Linear Algebra, Computer Vision, Data Analytics, Signal Processing, and Scientific/Financial Simulation.
- Depth: Tests five progressive input scales, from "Tiny" (kilobytes) up to "Huge" (over 1 GB), ensuring kernels are stress-tested under realistic loads.
- Difficulty: Prompts strip away hints across three tiers—from Level 1 (full algorithm + CUDA memory/thread hints), to Level 2 (algorithm only), down to Level 3 (just the task name, like "Black-Scholes," forcing pure concept retrieval).
Key Insights and Ideas
- Syntax is solved; parallel logic is not: Models regularly hit near-100% compilation success, meaning they know CUDA C++ grammar cold. Yet they fail functionally at high rates—tripping over race conditions, thread synchronization, and memory boundaries.
- The niche domain cliff: When stripped of algorithmic explanations (Level 3), LLMs cruise through textbook Linear Algebra (GPT-5.2 fails only 8% of the time) but crash hard in niche domains like Scientific Simulation and Signal Processing (where failure rates surge up to 85%).
- A systemic optimization ceiling: Even when top frontier models write correct code with full hints, they hit an eerily similar performance wall—hovering around 40% of theoretical hardware utilization. Current LLMs simply don't yet grasp deep hardware-aware optimizations like shared memory tiling or warp-level primitives.
Key Results
Evaluating seven state-of-the-art models (including GPT-5.2, Claude 4.5 Sonnet, Gemini 3 Flash, and DeepSeek-V3.2) primarily on an NVIDIA A40 GPU yielded humbling numbers:
- Correctness Leader: On Level 1 (Pass@1), Claude 4.5 Sonnet led functional accuracy at 85.8% (with a 99.8% compilation rate), dropping to 63.2% functional accuracy on Level 3.
- Performance Leader: GPT-5.2 (High) took the top spot on overall CUDABench-Score, peaking at 40.9% on Level 1 (Pass@1) and 29.8% on Level 3—edging out Claude 4.5 Sonnet (40.2%) and Gemini 3 Flash (40.1%).
- Sampling Helps: Allowing three attempts (Pass@3) noticeably boosted scores across the board (e.g., lifting Claude's Level 1 functional accuracy to 90.0% and GPT-5.2's CUDABench-Score to 45.4%), showing promise for test-time search.
- Cross-GPU Consistency: Re-running tests on an RTX 4090 preserved the exact same model rankings and degradation trends, validating the hardware-independent roofline metric.
Limitations and Future Work
The authors note three main boundaries to their current setup:
- Vendor Lock-in: Relying on
nvccand Nsight Compute ties CUDABench strictly to NVIDIA GPUs, leaving AMD (ROCm) or Apple Silicon out of the picture for now. - FP32 & Single Kernels: The benchmark currently evaluates standalone 32-bit floating-point kernels. Modern AI relies heavily on mixed-precision formats (FP16, FP8, FP4), Tensor Cores, kernel fusion, and multi-kernel workflows.
- Data Contamination: While mitigated via rewritten prompts and custom implementations, complete immunity from LLM training-data overlap can never be 100% guaranteed.
Summary updated