Table of Contents
Fetching ...

STARK: Strategic Team of Agents for Refining Kernels

Juncheng Dong, Yang Yang, Tao Liu, Yang Wang, Feng Qi, Vahid Tarokh, Kaushik Rangadurai, Shuang Yang

TL;DR

GPU kernel optimization is highly challenging due to irregular memory hierarchies and hardware-specific behavior. STARK proposes a novel agentic framework that decomposes the task into planning, coding, and debugging through a grounded-instruction workflow and dynamic context, guided by a strategic tree-based search. Across KernelBench, STARK achieves perfect success rates and substantial speedups over Torch baselines, with up to $16\times$ faster runtimes, and outperforms prior single-agent and reflexion-based approaches. The results demonstrate that coordinated LLM agents can effectively navigate complex kernel design spaces, enabling scalable, automated optimization with practical impact for AI workloads. The work also suggests directions for broader operator support, hardware architectures, and co-design of AI algorithms and infrastructure.

Abstract

The efficiency of GPU kernels is central to the progress of modern AI, yet optimizing them remains a difficult and labor-intensive task due to complex interactions between memory hierarchies, thread scheduling, and hardware-specific characteristics. While recent advances in large language models (LLMs) provide new opportunities for automated code generation, existing approaches largely treat LLMs as single-shot generators or naive refinement tools, limiting their effectiveness in navigating the irregular kernel optimization landscape. We introduce an LLM agentic framework for GPU kernel optimization that systematically explores the design space through multi-agent collaboration, grounded instruction, dynamic context management, and strategic search. This framework mimics the workflow of expert engineers, enabling LLMs to reason about hardware trade-offs, incorporate profiling feedback, and refine kernels iteratively. We evaluate our approach on KernelBench, a benchmark for LLM-based kernel optimization, and demonstrate substantial improvements over baseline agents: our system produces correct solutions where baselines often fail, and achieves kernels with up to 16x faster runtime performance. These results highlight the potential of agentic LLM frameworks to advance fully automated, scalable GPU kernel optimization.

STARK: Strategic Team of Agents for Refining Kernels

TL;DR

GPU kernel optimization is highly challenging due to irregular memory hierarchies and hardware-specific behavior. STARK proposes a novel agentic framework that decomposes the task into planning, coding, and debugging through a grounded-instruction workflow and dynamic context, guided by a strategic tree-based search. Across KernelBench, STARK achieves perfect success rates and substantial speedups over Torch baselines, with up to faster runtimes, and outperforms prior single-agent and reflexion-based approaches. The results demonstrate that coordinated LLM agents can effectively navigate complex kernel design spaces, enabling scalable, automated optimization with practical impact for AI workloads. The work also suggests directions for broader operator support, hardware architectures, and co-design of AI algorithms and infrastructure.

Abstract

The efficiency of GPU kernels is central to the progress of modern AI, yet optimizing them remains a difficult and labor-intensive task due to complex interactions between memory hierarchies, thread scheduling, and hardware-specific characteristics. While recent advances in large language models (LLMs) provide new opportunities for automated code generation, existing approaches largely treat LLMs as single-shot generators or naive refinement tools, limiting their effectiveness in navigating the irregular kernel optimization landscape. We introduce an LLM agentic framework for GPU kernel optimization that systematically explores the design space through multi-agent collaboration, grounded instruction, dynamic context management, and strategic search. This framework mimics the workflow of expert engineers, enabling LLMs to reason about hardware trade-offs, incorporate profiling feedback, and refine kernels iteratively. We evaluate our approach on KernelBench, a benchmark for LLM-based kernel optimization, and demonstrate substantial improvements over baseline agents: our system produces correct solutions where baselines often fail, and achieves kernels with up to 16x faster runtime performance. These results highlight the potential of agentic LLM frameworks to advance fully automated, scalable GPU kernel optimization.
Paper Structure (23 sections, 4 equations, 13 figures, 3 tables, 1 algorithm)

This paper contains 23 sections, 4 equations, 13 figures, 3 tables, 1 algorithm.

Figures (13)

  • Figure 1: Speedup of STARK over baseline agents on KernelBench (L1–L3) with same number of attempts. Bars report GPU wall-clock speedups ($\times$) relative to the Sampling and Reflexion agents; higher is better. STARK reaches up to $16\times$ over Reflexion (L2) and $10.7\times$ over Sampling (L1).
  • Figure 2: Overview of STARK. (a) Prior LLM-based kernel optimizers rely on a monolithic agent with local iterative refinement. (b) STARK replaces this with a collaborative multi-agent workflow (plan/code/debug) coupled with strategic search over a tree memory. (c) The plan agent issues grounded instructions that anchor edits to code spans; dynamic context windows surface role-specific history; and the debug agent repairs failures. See Section \ref{['sec:stark']} for details.
  • Figure 3: Dynamic Context Window. Nodes with $\checkmark$'s represent selected nodes.
  • Figure 4: Prompt Template for Agents.
  • Figure 5: System Message for All Agents.
  • ...and 8 more figures