arXiv:2611.03517cs.LGNov 2026

Manuscript Offprint

arXiv:2611.03517

Ask, Don't Equip: Question-Driven Coding Agents for Deep Kernel Optimization

Gabriele Oliaro, Jaeseong Lee, Zhaoyuan Su, Sreeram Vennam, Zhihao Jia, Samyam Rajbhandari

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

LLM agents for GPU kernel optimization sit at two ends of a structure–freedom tradeoff. Scripted agents fix what the model does at each step, via a learned policy, an optimization menu, or fixed roles, and are sample-efficient where the recipe applies and stall where it does not. Open-ended agents let a self-directed model mutate a population of kernels and pay for the freedom in trials: thousands of evaluations, repeated edits, and wrong candidates. Both respond to hard targets by equipping the agent with more: parsed profiler output, disassembly analysis, retrieval over documentation and libraries, and stores of lessons. We argue that both lack direction, a hypothesis about where the remaining gap is, and that a short question asked at the right moment supplies it without narrowing what the agent may do next. We present KERNELSEEK, a question-driven agent that makes an existing CUDA kernel faster with no operator-specific knowledge and no faster implementation to imitate: a general-purpose coding agent, a minimal harness that enforces a verifiable goal, and questions at decision points, first from a human, then from a bank the agent applies to itself. On the same task, evaluator, hardware, and week, a tool-rich autonomous agent built in the prevailing style plateaued at 0.50× FlashAttention-3 after 133 model-driven steps; KERNELSEEK reached 1.13×. It then produced dependency-free FlashAttention forward kernels for Hopper and Blackwell, single CUDA files with no CUTLASS, CuTe, cuBLAS, or cuDNN, correct on all 182 scenarios per architecture and 1.16× FlashAttention-3 and 1.46× FlashAttention-4 (geometric mean). Across 162 human messages and 11.5K agent tool calls, every large gain followed a question that moved the agent to a different layer of the system or rejected a claimed limit, never one that supplied information. We release the kernels, harness, question bank, and all traces.

1 INTRODUCTION

GPU kernels are one of the main levers on the efficiency of large language model training and serving (Miao et al., 2025). Attention is the clearest case: each GPU generation has required a new implementation to reach the hardware’s potential, from FlashAttention on Ampere (Dao et al., 2022; Dao, 2024) to FlashAttention-3 on Hopper (Shah et al., 2024) and FlashAttention-4 on Blackwell (Zadouri et al., 2026), each rewrite reporting a 1.5–2× speedup over its predecessor (Dao, 2024; Shah et al., 2024), and serving systems ship specialized attention engines of their own (Kwon et al., 2023; Ye et al., 2025; Miao et al., 2024). Such kernels are deep targets: their performance hinges on whole-pipeline choreography (warp-specialized producers and consumers, asynchronous tensor-core MMAs, copies ordered by barrier phases, register budgets, persistent schedulers, the host dispatch path) rather than on local edits, their correctness hinges on hardware invariants that documentation states

only in passing, and they must win across a production feature surface of paged caches, grouped heads, masks, ragged batches, split decode, and low precision rather than on one shape. Domain-specific languages (Tillet et al., 2019; Spector et al., 2025) and template libraries (Thakkar et al., 2023) lower the barrier, but state-of-the-art kernels still take expert teams months per architecture (Shah et al., 2024; Zadouri et al., 2026), and NVIDIA’s own production kernels sit well below the hardware’s speed of light on many shapes (Lin et al., 2026).

Kernel generation has therefore become an active application of LLM coding agents, with benchmarks (Ouyang et al., 2025; Xing et al., 2026; Lin et al., 2026; Oliaro et al., 2026), models trained with reinforcement learning to emit kernels (Baronio et al., 2026; Li et al., 2026; Dai et al., 2026; Liu et al., 2026), agentic pipelines (Hong et al., 2025; Wei et al., 2025; Sun et al., 2026a), evolutionary search with an LLM as the mutation operator (Novikov et al., 2025; Lange et al., 2025a; Chen et al., 2026), and deployments across whole production backends (Liao et al., 2025; Cursor & NVIDIA, 2026). These agents sit at the two ends of a structure–freedom tradeoff. Scripted agents fix in advance

¹Snowflake AI Research ²Carnegie Mellon University. Correspondence to: Gabriele Oliaro goliaro@cs.cmu.edu.

Preprint.

what the model does at each step: a generate-test-refine loop with a learned policy (Baronio et al., 2026; Li et al., 2026; Liu et al., 2026), a menu of optimizations (Hong et al., 2025), a team with fixed roles (Wei et al., 2025; Sun et al., 2026a), or a harness in which humans gate every promotion (Shui et al., 2026). The script makes them sample-efficient but encodes what to try: Autocomp's performance collapses without its optimization menu (Hong et al., 2025), and fixed-loop RL that is competitive on single operators fails on fused models (Liu et al., 2026; Zhu et al., 2026; Dai et al., 2026). Open-ended agents let an LLM mutate a population of programs (Romera-Paredes et al., 2024; Novikov et al., 2025; Lange et al., 2025a; Guo et al., 2025; Wiedemann et al., 2026), and AVO makes a self-directed coding agent the variation operator itself (Chen et al., 2026). The freedom buys results, up to 10.5% over FA4 for AVO (Chen et al., 2026) and a 32% speedup of a FlashAttention kernel for AlphaEvolve (Novikov et al., 2025), and is paid for in trials: AVO's agent explored more than 500 directions over seven days to commit 40 versions and needed a supervisor to break cycles of failing edits (Chen et al., 2026), about 30% of the lines such agents add are byte-identical to lines they deleted earlier (Pelleriti et al., 2026), and 30–55% of LLM-evolved CUDA candidates are incorrect (Guo et al., 2025; Varadharajan et al., 2026).

We argue that what both ends lack is direction: a hypothesis about where the remaining gap is. A script hard-codes direction and cannot supply it where the script is wrong; open-ended search samples for it, and samples poorly, because LLMs are not open-ended optimizers. They search greedily from their priors (Redko et al., 2026), anchor on the solution in the prompt (Jones & Steinhardt, 2022), stop early out of conservatism or after a run of failures (Merouani et al., 2025), cycle through near-duplicate variants (Li et al., 2025; Dong et al., 2025), and report completion the environment contradicts (Advani, 2026). Information is not what is missing: both ends already hand the agent profilers, documentation, and reference implementations (Chen et al., 2026; MIT HAN Lab, 2026), and such feedback helps only when it supplies the specific thing the model lacks, which profiler and compiler output rarely does (Redko et al., 2026). What moves the same models is a hypothesis posed from outside: intrinsic self-correction fails where external feedback succeeds (Huang et al., 2024), a human's feedback on a model's own code raised repair success by 1.57× through structural changes the model did not propose (Olausson et al., 2024), and in the FlashInfer kernel contest, agents given expert directions beat the same agents running alone on every kernel (Shui et al., 2026). Our reading, and our traces, say that a question changes the task. "Make this faster" is open-ended, and the model answers it greedily. "Is the baseline winning on kernel cycles or only on wall-clock?" is bounded, and to answer it the model will tear

Figure

Figure 1. KERNELSEEK vs. a scripted, tool-rich autonomous agent on the same FA3 case-study task: the same evaluator, 26 configurations, H200 node, and week. Lines are the lineage's best geomean (solid) and worst configuration (dashed); dots are individual candidates; ticks mark human turns to KERNELSEEK. The equipped agent's model was active for the 62 hours shown; the shaded band is a period with no KERNELSEEK activity.

out and rewrite a part of the kernel it would never touch on its own. A well-placed question supplies direction without narrowing what the agent may do next, which neither more structure, more freedom, nor more tooling can.

This paper presents KERNELSEEK, a question-driven agent for optimizing CUDA kernels. KERNELSEEK takes an existing kernel as its seed and makes it faster; it is not tied to an operator, and it does not need a faster implementation to imitate. It keeps the freedom of the open-ended agents, a general-purpose coding agent with no script and no pre-digested context, and recovers the efficiency of the scripted ones by supplying direction at decision points: when progress stalls, when the agent claims a limit or completion, and after suspiciously large wins. Its only purpose-built component is a minimal harness that checks every candidate against the seed's outputs and an fp32 reference, times every scenario against the seed, and states the goal as a stop condition that is verified rather than requested. A good question contains no answer: it names a hypothesis the agent has not considered, and testing it takes a measurement the agent can make with ordinary tools. Questions that recur harden into a bank the agent applies to itself, and KERNELSEEK composes with evolutionary search by wrapping the same agent in an AVO-style lineage whose directives are questions.

We evaluate KERNELSEEK on a case study chosen because a strong upstream exists to measure against: FA3-and FA4-class attention kernels as single CUDA files with no CUTLASS, CuTe, cuBLAS, or cuDNN, across the feature surface that vLLM exposes, with the upstream kernels as correctness oracle and yardstick. Against an autonomous agent we built for the same task in the style of AVO and its successors, with an orchestrated loop, pre-digested profiles, documentation retrieval, and a store of learned lessons, KERNELSEEK reached 1.13× FA3 in geometric mean over the same 26 configurations on the same machine in the same week, where the autonomous agent plateaued at 0.50× after 133 model-driven steps (Figure 1). Carried through to full campaigns, KERNELSEEK produced fa3_hopper.cu and fa4_blackwell.cu, correct on all 182 Hopper and all runnable Blackwell scenarios, at 1.16× FA3 and 1.46× FA4 in geomean, including 1.10× FA4 on production shapes from SOL-ExecBench (Lin et al., 2026). Across the 16 sessions that produced them, KERNELSEEK made 11.5K tool calls per 162 human messages: asking did not mean using fewer tools, but using them on the right thing.

This paper makes three contributions.

  • We identify the failure modes of autonomous agents on deep kernel targets that neither more structure, more freedom, nor more tooling fixes, and show them co-occurring in a tool-rich agent built to the prevailing recipe (§3).
  • We present KERNELSEEK, an operator-agnostic question-driven kernel agent built from a minimal harness, a verifiable goal, and a reusable question bank, and show how it composes with evolutionary search (§2).
  • We compare KERNELSEEK with the equipped agent on the same task, evaluator, hardware, and week, analyze 162 human messages and 11.5K tool calls to show which questions redirected the agent and why (§5), and release fa3_hopper.cu and fa4_blackwell.cu, to our knowledge the fastest open-source FA3- and FA4-class forward kernels on the scenarios we evaluate, with the harness, question bank, and complete traces of both approaches (§4).