NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Optimizing CUDA like a Human: Micro-Profiling Tools as Expert Surrogates for LLM-Based GPU Kernel Optimization

Jiading Gai, Shuai Zhang, Kaj Bostrom, Jin Huang, Vihang Patil, Haoyang Fang, Bernie Wang, Huzefa Rangwala, George KarypisarXiv 2026

TL;DR

KernelPro is an automated, closed-loop multi-agent system that optimizes GPU kernel code by translating raw hardware profiling metrics into actionable, natural language guidance for Large Language Models (LLMs). By mimicking human expert workflows through structured micro-profiling tools and Monte Carlo Tree Search (MCTS), it achieves state-of-the-art speedups on KernelBench and even outperforms hand-tuned Triton code on production workloads while simultaneously improving energy efficiency.

What Problem Does This Paper Address?

Writing high-performance GPU kernels in CUDA requires rare, highly specialized expertise. Human experts optimize code through a disciplined cycle: profiling the kernel, recognizing bottleneck patterns in raw hardware metrics, diagnosing root causes, and applying targeted code transformations.

While recent LLM-based systems can generate competitive CUDA code, they typically dump raw or lightly summarized profiler metrics directly into the LLM prompt. This forces the model to implicitly replicate complex hardware reasoning. The authors argue that this approach conflates two entirely distinct capabilities: interpreting structured hardware telemetry and creatively generating optimized code. As a result, existing AI agents frequently miss critical optimizations, produce inconsistent diagnoses, and get trapped in suboptimal code patterns.

Methods

KernelPro solves this problem by separating hardware diagnosis from code generation using a multi-agent architecture coordinated by a search orchestrator:

  1. Benchmarking Agent (Stage 1): Performs a one-time roofline analysis on the reference implementation to classify its primary bottleneck type (compute-bound, memory-bound, latency-bound, or mixed).
  2. Profiling Agent (Stage 2): Implements Proactive Tool Orchestration. Instead of letting the LLM stochastically choose which tools to call, KernelPro deterministically runs a suite of 15 pluggable micro-profiling tools spanning kernel-level (ncu), instruction-level (SASS binary analysis), and system-level (nsys) profiling. These tools use a formal trigger-analyze-recommend pattern to translate raw hardware counters into explicit natural language advice.
  3. Programmer Agent: Generates candidate implementations. It features an autonomous code search capability over live CUTLASS/CuTe codebases, allowing it to discover layout algebras and hardware-specific instruction shapes to write high-performance kernels from scratch.
  4. Domain-Adapted MCTS: Replaces flat iterative refinement with a tree search strategy utilizing progressive widening, asymmetric branching factors (allocating more exploration budget to successful nodes than failed ones), and log-reward calibration to systematically navigate the optimization landscape.

The overall agentic workflow is illustrated below:

KernelPro agentic optimization workflow showing Stage 1 benchmarking, the iterative MCTS/Greedy loop, and Stage 2 profiling feedback.

To ensure flexibility across engineering workflows, KernelPro normalizes multiple source languages into a unified problem format before code generation:

Figure 2: Multi-language input pipeline: all source languages are normalized to a unified format before being routed through language- specific prompts to produce optimized CUDA kernel.

To prevent prompt noise and signal dilution, tools are filtered based on the initial bottleneck classification:

Table 1: Tool filtering by bottleneck type

Additionally, KernelPro introduces a lexicographic reward function to optimize for energy efficiency as a secondary objective, breaking ties among speed-equivalent solutions by estimating energy costs across documented hardware bottlenecks.

Datasets

The system was evaluated using two primary targets:

  • KernelBench: A benchmark consisting of 250 GPU kernel tasks across three difficulty levels (Level 1: single operators; Level 2: fused/composed operators; Level 3: full model architectures).
  • VeOmni MoE Production Kernels: Expert-optimized Mixture-of-Experts (MoE) grouped-GEMM training workloads characterized by highly challenging, ragged contraction lengths caused by routing imbalances.

Key Insights and Ideas

  • Raw Metrics Are Harmful: Counterintuitively, providing raw hardware counters directly to an LLM without interpretation performs significantly worse than providing no profiling feedback at all. Unstructured metric dumps distract the model, leading it to optimize irrelevant counters or misinterpret hardware limits.
  • Interpretation > Data Access: The true value of automated profiling lies in the semantic translation layer. Telling a model exactly why a bottleneck exists (e.g., "shared memory usage limits concurrent blocks to 2") and prescribing a fix provides a massive boost over raw data.
  • MCTS Escapes Local Optima: Complex GPU optimization landscapes are highly multi-modal. Purely greedy search strategies easily get trapped in local basins, whereas tree search allows the agent to endure dozens of temporary compilation or correctness failures to eventually discover fundamentally superior algorithmic paths.
  • Latency-Hidden Energy Reductions: In bandwidth-bound kernels, extra instructions can execute "for free" underneath memory stalls without affecting latency. An energy-aware agent can identify these latency-hidden inefficiencies and select cheaper instruction streams, reducing dynamic energy consumption at matched execution speeds.

Key Results

  • SOTA on KernelBench: KernelPro achieved complete task coverage (100% solved) and established new state-of-the-art geometric mean speedups of 2.42× on Level 1, 4.69× on Level 2, and 5.30× on Level 3, substantially outperforming the prior SOTA, KernelBlaster.
  • Outperforming Expert Triton Code: On VeOmni's production MoE training kernels, KernelPro achieved a 1.23× speedup over an expert-tuned Triton baseline by generating a from-scratch raw CUDA+CuTe Hopper WGMMA kernel.
  • Component Ablations: Controlled experiments demonstrated that micro-profiling tools provided a 125% higher speedup than raw metrics ($p < 0.0001$). MCTS outperformed greedy search by 26%, and proactive tool orchestration beat reactive function calling by 23%.
  • Energy Savings: In a paired-arm study on a Swish activation kernel, the energy-aware variant achieved a 11.6% measured dynamic energy reduction at identical wall-clock speeds by compiling to just 56 instructions compared to the speed-only baseline's 216 instructions.

Limitations and Future Work

While KernelPro demonstrates groundbreaking capabilities, the authors note a few limitations and areas for future development:

  • The energy-aware optimization framework is currently a preliminary study; a more systematic characterization of speed-decoupled energy reductions is left to future work.
  • Certain massive hardware levers, such as dynamic voltage and frequency scaling (DVFS) and runtime occupancy tuning knobs, are currently outside the scope of KernelPro's source-level code generation.
  • The authors are actively focusing on scaling KernelPro into a sustained open-source contribution pipeline, having already submitted 6 pull requests to the FlashInfer library.

Summary updated

BibTeX
@misc{gai2026optimizing,
  author = {Jiading Gai and Shuai Zhang and Kaj Bostrom and Jin Huang and Vihang Patil and Haoyang Fang and Bernie Wang and Huzefa Rangwala and George Karypis},
  title = {{Optimizing CUDA like a Human: Micro-Profiling Tools as Expert Surrogates for LLM-Based GPU Kernel Optimization}},
  year = {2026},
  eprint = {2606.26453},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.26453},
}
Figure