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

EvoEngineer: Mastering Automated CUDA Kernel Code Evolution with Large Language Models

Ping Guo, Chenyu Zhu, Siyuan Chen, Fei Liu, Xi Lin, Zhichao Lu, Qingfu Zhang · DOI

Abstract

Optimizing CUDA kernels for high-performance GPU computing remains a specialized and labor-intensive task. While Large Language Models (LLMs) show potential in code generation, their application to CUDA optimization is hindered by strict correctness requirements and a lack of systematic frameworks. We present EvoEngineer, the first framework to formalize CUDA optimization as a structured evolution process. By separating high-level search strategies from low-level prompt engineering and employing advanced population management, EvoEngineer achieves a median speedup of 2.72× over baseline kernels with a 69.8% code validity rate. Our results demonstrate that automated LLM-driven evolution can discover optimizations that surpass industry-standard library implementations.

Introduction

In modern AI infrastructure, performance is dictated by the efficiency of CUDA kernels. However, writing high-performance CUDA code is often considered a "black art," requiring deep knowledge of hardware architecture and parallel programming. Existing LLM-based approaches to code optimization often struggle with the zero-tolerance nature of CUDA errors and typically conflate optimization strategies with specific prompt phrasing, leading to "strategy blindness." EvoEngineer addresses these challenges by providing a systematic, modular framework for kernel evolution.

The EvoEngineer Framework

The core of EvoEngineer is the decomposition of the code evolution process into two orthogonal components: Traverse Techniques and Population Management.

Traverse Techniques

To avoid the pitfalls of ad-hoc prompting, EvoEngineer employs a two-layer design for its search strategy:

  1. Solution Guiding Layer: This layer defines the high-level strategy, determining what information (e.g., historical solutions, optimization insights, or task context) is provided to the LLM.
  2. Prompt Engineering Layer: This layer translates the high-level strategy into the specific textual prompts sent to the model. This separation allows researchers to evaluate the effectiveness of an underlying algorithm independently of its linguistic phrasing.

Population Management

This component manages the candidate solutions across successive generations. It utilizes strategies such as Elite Preservation to maintain the highest-performing kernels and Diversity Management to ensure the search explores a wide variety of optimization approaches.

The EvoEngineer framework architecture, detailing the Solution Guiding, Prompt Engineering, and Population Management components.

The framework was implemented in three variants: EvoEngineer-Free (resource-efficient), EvoEngineer-Insight (incorporating reasoning-based optimization insights), and EvoEngineer-Full (the most comprehensive implementation).

Experimental Setup

EvoEngineer was evaluated on 91 real-world CUDA kernels from the KernelBench benchmark. These kernels cover six computational categories: Matrix Multiplication, Convolution, Activation & Pooling, Normalization & Reduction, Loss Functions, and Cumulative Operations. This diverse set ensures the framework is tested against various parallelization patterns and dependency constraints.

Results and Analysis

EvoEngineer demonstrates state-of-the-art performance in automated kernel evolution. The framework achieved a median speedup of 2.72× across the benchmark, with peak performance reaching up to 36.75× for specific operations.

Correctness and Efficiency

A critical metric for CUDA generation is the "validity rate"—the percentage of generated code that compiles and produces correct numerical results. EvoEngineer-Full maintained a 69.8% validity rate, significantly outperforming baseline LLM generation methods. The study also highlighted a trade-off between token usage and performance; while more complex strategies consume more tokens, they drastically reduce the frequency of "broken" code.

Performance comparison of EvoEngineer variants and other models, showing Functional Correctness (Pass@1) versus Speedup Rate.

Comparison to Expert Implementations

In a comparison involving 50 operations where a 2× speedup was theoretically possible, EvoEngineer delivered the highest speedup in 56% of cases compared to other automated methods. Notably, the framework frequently discovered optimizations that outperformed hand-tuned kernels found in the PyTorch library.

Discussion and Future Work

While EvoEngineer marks a significant step forward, several challenges remain. CUDA optimization is highly hardware-sensitive; kernels optimized for the NVIDIA RTX 4090 used in this study may not be optimal for other architectures like the H100. Additionally, the inherent noise in GPU timing can occasionally lead the evolutionary algorithm to discard superior candidates.

Future work will focus on extending the framework to support AMD GPUs via ROCm/HIP and developing more "agentic" paradigms. In these future iterations, LLMs will not only generate code but also critique their own outputs and explain their optimization reasoning in a continuous, self-improving dialogue.

Summary updated

BibTeX
@misc{guo2025evoengineer,
  author = {Ping Guo and Chenyu Zhu and Siyuan Chen and Fei Liu and Xi Lin and Zhichao Lu and Qingfu Zhang},
  title = {{EvoEngineer: Mastering Automated CUDA Kernel Code Evolution with Large Language Models}},
  year = {2025},
  eprint = {2510.03760},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.03760},
}
Figure