CUDABeaver: Benchmarking LLM-Based Automated CUDA Debugging

Shiyang Li, Haoyang Chen, Mattia Fazzini, Caiwen Ding

TL;DR

When LLMs try to fix broken CUDA code, they often cheat—not maliciously, but by throwing away complex GPU optimizations and replacing them with a slow, safe fallback that merely passes the tests. The authors call this repair by degeneration, and they introduce CUDABeaver, a 213-task benchmark that separates real CUDA debugging from code generation. They also show that a model's apparent debugging skill depends heavily on how you score it, with stricter performance requirements dropping pass rates by up to 29.1 percentage points.

What Problem Does This Paper Address?

Debugging CUDA is notoriously tricky: bugs hide in asynchronous execution, memory hierarchies, and hardware-specific quirks, often surfacing far from where they actually occurred. Existing LLM benchmarks mostly test kernel generation (writing CUDA from scratch) or general CPU-side debugging.

When an LLM is asked to fix a broken GPU kernel, standard pass@k metrics only check whether the code compiles and passes correctness tests. As a result, a model can "fix" a racecar of a kernel by turning it into a bicycle—a correct, much slower program that abandons the original optimization structure.

Figure 1: Repair by degeneration. Here, the racecar denotes an optimized GPU kernel and the bicycle a correct-but-slow fallback; a useful repair preserves optimization structure, but LLMs often simplify candidates into slower correct programs.

Methods

To isolate debugging from generation, CUDABeaver uses a debug-from-broken-start protocol. Every fixer model starts from the exact same 4-tuple—(prompt, broken_kernel, error_log, native_harness)—with a single editable file and a 5-iteration budget.

Instead of reporting a single, brittle pass@k number, the authors propose a protocol-conditional metric, pass@k(M, C, A), which explicitly tracks the model $M$, corpus $C$, and four evaluation axes $A$:

  • Performance gate ($A_1$): Requiring a fix to be both correct and fast enough ($\text{speedup} \ge p$, varied from $0$ to $1.0$, default $0.7$).
  • Sampling strategy ($A_2$): Comparing iterative debugging (appending error feedback across turns) against repeated sampling (resetting the prompt each time).
  • Feedback richness ($A_3$) and History depth ($A_4$): Varying how much diagnostic detail and conversation history the model sees.
Figure 3: Iterative vs. repeated debugging pipelines (axis A2). The iterative pipeline appends feedback after each failed attempt and exits early on success; the repeated pipeline resets to the initial prompt each attempt. Both feed identical outputs to the same pass@k aggregator.

They also introduce four stagnation signals (duplicate_code, code_cycle, category_oscillation, and no_progress) to catch models spinning their wheels, and decompose pass@k into pass@1 (first-try fixes) and debug_rate@k (recovery from initial failures).

Datasets

CUDABeaver is a newly introduced corpus of 213 reproducible CUDA debugging tasks drawn from 10 source families—including adapted tasks from KernelBench and CUDABench, NVIDIA libraries (CUTLASS, cuBLAS, cuFFT, cuSPARSE, cuSOLVER, Apex LayerNorm), and frontier kernels like FlashAttention and ThunderKittens.

The broken starts come from real LLM generation failure trajectories and curator modifications, spanning five failure buckets: compile errors, logic errors, memory crashes, timeouts, and performance-broken kernels. Every task is filtered for solvability, meaning at least one tested model can produce a correct (if un-gated) solution.

Figure 2: Corpus coverage across workload size (lines of code, log scale, x), various domains (y), and 5 curation-time failure-modes (color; runtime outcomes use a separate 8-category taxonomy).

Key Insights and Ideas

  • Performance gates expose "repair by degeneration": Models look much stronger when you only grade correctness ($p = 0$). Once you demand they preserve speed, scores plummet.
  • Protocol choices reshape leaderboards: Changing feedback richness, history depth, or sampling strategy doesn't just shift scores—it swaps middle-tier model rankings (Kendall's $\tau = 0.60$ across default-to-alternative comparisons).
  • More feedback or history isn't always better: The best setting is model-specific. For example, GPT-5.4 thrives on raw stderr diagnostics ($L_3^*$), while Kimi-k2.6 peaks at a moderate feedback level ($L_2$) and degrades with more.
  • Stagnation is common: Even strong models waste their budget—four of the seven tested models are dominated by no_progress on failing trajectories, while two others frequently repeat duplicate_code.

Key Results

Evaluating seven frontier LLMs (GPT-5.4, Qwen3.6-Plus, Gemma-4-31B-it, Qwen3.6-27B, Kimi-k2.6, GLM-4.7, and MiniMax-M2.7) on an NVIDIA RTX PRO 6000 Blackwell GPU:

  • Performance-gate swing: Raising $p$ from $0$ to $1.0$ drops pass@5 by 3.3 to 29.1 percentage points across models. GPT-5.4 has the steepest drop, falling from 52.1% at $p = 0$ to 23.0% at $p = 1.0$, though it remains #1 across all thresholds.
  • Protocol swings: Varying sampling strategy, feedback richness, and history depth produces maximum swings of 7.5, 15.5, and 8.0 percentage points, respectively.
  • Recovery vs. first-try: At $p = 0$, debug_rate@5 ranges from 5.7% (GLM-4.7) to 32.0% (GPT-5.4), showing all models can recover from at least some initial failures.
  • Cross-architecture check: Replicating on an NVIDIA H200 (Hopper) GPU under correctness-only scoring ($p = 0$) preserves the iterative ranking of GPT-5.4 (70.4%), Gemma-4-31B-it (45.5%), and Qwen3.6-27B (37.6%), with 86.4% agreement on performance-gate decisions at $p = 0.7$.
Figure 4: (Left) Median speedups of validly timed repairs first passed at iteration 1 or later, and the below-parity fraction among timed later passes. Cohort sizes are in Table 12. (Right) Full-corpus pass@5 versus p ∈[0, 1], with denominator 213. The dashed line marks p = 0.7.

Limitations and Future Work

The authors note that CUDABeaver's broken starts come from AI-assisted CUDA generation trajectories rather than human-written production bugs, which may follow a different distribution. Performance gates also rely on architecture-specific reference timings, and so far the benchmark has only been run on NVIDIA GPUs (Blackwell and Hopper). Extending the evaluation to human-written bug trackers and other AI accelerator architectures is a natural next step.

Summary updated

BibTeX
@inproceedings{li2026cudabeaver,
  author = {Shiyang Li and Haoyang Chen and Mattia Fazzini and Caiwen Ding},
  title = {{CUDABeaver: Benchmarking LLM-Based Automated CUDA Debugging}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=cZEC5u5oMz},
}
Figure