GPU Kernel Scientist: An LLM-Driven Framework for Iterative Kernel Optimization
Martin Andrews, Sam Witteveen · 2025 · 34 citationsRead the paper
Optimizing GPU kernels for high performance is a complex task, often demanding deep architectural knowledge, extensive profiling, and iterative experimentation. This challenge is amplified when targeting newer or less-documented GPU architectures where traditional development aids are scarce. This paper introduces an LLM-powered "GPU Kernel Scientist," an automated methodology for iteratively refining accelerator kernels. Our methodology employs LLMs in a multi-stage, evolutionary process: (a) strategically selecting promising prior code versions as a basis for new iterations; (b) generating hypotheses for optimization experiments, based on existing code and assimilated knowledge from general GPU literature; and (c) autonomously implementing these experiments through code modification and subsequent submission to an external evaluation system, using only observed timing data as performance feedback. We detail how this approach navigates the challenges of the AMD MI300 target architecture and leverages LLMs to compensate for limited domain-specific human expertise. In addition to our results, we present the architectural design, operational workflow, and qualitative insights, highlighting the potential of LLM-driven agents to democratise and accelerate GPU kernel optimization, especially in resource-constrained or rapidly updating hardware environment.
What the full text shows
Working prototype- The LLM-driven framework optimized a GEMM kernel to a performance level significantly better than naive HIP and PyTorch reference implementations. — ≈ 450 μs vs. ≈ 850 μs (PyTorch) and ≈ 5000 μs (Naive HIP) (AMD MI300 GPU, geometric average execution time over 18 matrix input sizes)
- The system successfully implemented low-precision mixed-precision arithmetic using AMD Matrix Cores. (FP8 inputs, FP32 accumulation, BF16 output using rocWMMA library)
- Setup
- Target hardware: AMD MI300 GPU; LLMs used: Gemini 2.5 Flash and Gemini 2.5 Pro; Benchmark: 18 specific matrix input sizes.
- How
- An iterative evolutionary framework using three LLM stages: an Evolutionary Selector to pick base/reference kernels, an Experiment Designer to hypothesize optimizations, and a Kernel Writer to implement code changes. The system uses only end-to-end timing data as a feedback signal for optimization.
- Limitations
- Lack of fine-grained profiling data (relied solely on black-box timing results). · Slow optimization progress due to sequential external evaluation (no parallel operation). · Limited target-specific documentation for the MI300 architecture.
Summarized by Gemma 4 from the open-access full text · 22 Nov 2026. Read it