TritonTune: LLM-Guided Multi-Agent Optimization of GPU Kernel Configurations

Shukai Duan, Mihai Capotă, Guixiang Ma, Hou-Jen Ko, Rafael Wang, Steve Cho, Shahin Nazarian, Paul BogdanNeurIPS 2026

TL;DR

Deploying fast GPU code isn’t just about writing clever algorithms; it’s about picking the right "launch configurations"—knobs like tile sizes and thread counts—that routinely leave 2× performance on the table when left at their defaults. TritonTune pairs two domain-specialized LLM agents with a lightweight, real-hardware local search to find optimal GPU kernel configurations in a fraction of the time required by traditional autotuners. Better yet, because it never alters the underlying source code and verifies every candidate on silicon, it guarantees zero performance regressions and exact numerical correctness.

What Problem Does This Paper Address?

Modern machine learning relies heavily on Triton—the programming model behind PyTorch 2’s torch.compile and engines like vLLM—to run custom GPU operations (kernels). How fast a Triton kernel runs depends critically on how its work is sliced up on the hardware: block sizes (tile dimensions), warps (groups of 32 threads), pipeline stages, and shared memory budgets.

Usually, engineers handle this via exhaustive autotuning: manually defining a grid of guesses and benchmarking all of them. This has major pain points:

  1. Manual effort: Humans have to guess and hardcode the search grid per kernel.
  2. The "long tail" of shapes: Every time input tensor dimensions change in production, the painfully slow search re-triggers.
  3. Rigid defaults: Many compiler-generated kernels skip autotuning altogether, relying on fixed heuristics that don't transfer well when moving from, say, an older NVIDIA V100 to a newer Hopper or Ada GPU.

Recent AI approaches try to solve GPU optimization by having LLMs rewrite kernel source code, risking subtle bugs or broken outputs. TritonTune asks a complementary question: Can LLMs read compiled code and reason about hardware bottlenecks to tune launch knobs directly—safely and in just a handful of tries?

Methods

Instead of modifying source code, TritonTune inspects the kernel's compiled Triton GPU Intermediate Representation (TTGIR) alongside target GPU specs (like cache sizes and Streaming Multiprocessor counts).

Figure 1: TritonTune architecture (left-to-right). The input “workload” bundles the kernel’s IR, tensor shapes and dtypes, and the current launch configuration. Two Domain Agents reason through com- plementary lenses (memory hierarchy, SM occupancy) and each proposes a complete configuration. The Orchestrator reconciles the two proposals — combining a deterministic conflict-detection and grid-metric step with LLM-mediated synthesis — to emit N ranked candidates and benchmarks them on hardware. Phased Search expands the search through Phase 1–3 around the orchestrator’s best candidate. Every measured (config, speedup) pair from both the orchestrator’s evaluation and phased search, including the original baseline, is written to the shared Cache; the Best config returned at the end is selected from the cache, falling back to the original whenever no candidate improves on it. On a regression, the system retries with scoped per-agent feedback for up to I iterations.

What makes the architecture novel is how it divides LLM reasoning by hardware lens rather than by role (like coder vs. critic):

  • DataMovementAgent (DMA): Obsesses over the memory hierarchy—data reuse, memory coalescing, and overlapping data loads with compute via deeper software pipelines.
  • ResourceBudgetAgent (RBA): Focuses on Streaming Multiprocessor (SM) compute limits—thread occupancy, register pressure, and warp scheduling, assisted by a deterministic occupancy calculator.
  • Orchestrator: Spots parameter conflicts between the two agents, computes deterministic grid-efficiency metrics, and uses an LLM call plus diversity rules to synthesize a small set of 3 ranked candidates.

Because static LLM guesses can't predict every silicon quirk, TritonTune feeds these candidates into a 3-phase closed-loop hardware search (~9 benchmarks per shape):

  1. Phase 1: Benchmarks the orchestrator's synthesis alongside each agent’s top pick.
  2. Phase 2: Benchmarks the backup alternatives of whichever source won Phase 1.
  3. Phase 3 (Neighborhood Search): Takes a page from classical local search, tweaking one knob at a time (e.g., doubling block size or shifting pipeline stages by ±1) around the running winner.

Every candidate is checked for element-wise numerical accuracy against the original kernel. If everything runs slower, agents get targeted feedback to retry; if nothing beats the original baseline, TritonTune safely falls back to the original configuration.

Datasets

No new datasets were introduced for training (the system uses off-the-shelf DeepSeek deepseek-chat). For evaluation, the authors used TritonBench, filtering for kernels that compile on V100 and run long enough (>0.01 ms) to avoid timer noise. This yielded 19 kernels across 393 input shapes, spanning hand-written Triton kernels, torch.compile Inductor-generated kernels, and quantized (INT4) operations.

Key Insights and Ideas

  • Prompting through separate lenses beats one "know-it-all" prompt: When the authors merged both memory and compute instructions into a single unified agent, performance dropped from 2.24× to 1.93×. A single prompt averages out the priors, whereas two distinct agents genuinely disagree—proposing identical configs only 14% of the time—giving the hardware benchmark starkly different starting points (e.g., DMA pushes 2–4 pipeline stages while RBA prefers 1 stage).
Figure 2: DMA vs RBA preferred-configuration divergence over 366 shapes. (a) The agents propose identical configurations on only 14% of shapes, differing on num_stages 63%, block_size 62%, and num_warps 17%. (b) DMA leans toward deeper pipelines, with mode 2 and 40% of shapes at 3–4 stages, while RBA leans shallow with mode 1 covering 60%. (c) Both agents predominantly choose num_warps=8, with secondary mass at 16 for RBA and split between 4 and 16 for DMA.
  • LLMs find the right neighborhood, not the exact address: LLMs reliably jump into a high-performing region of the parameter space, but 58.0% of the final winning configurations actually came from Phase 3's simple single-knob local perturbation. Combining global LLM intuition with local classical search is what unlocks peak speed.
  • Zero-shot hardware portability: Because GPU specs are passed as structured inputs, the exact same pipeline and prompts generalized across three NVIDIA generations (Volta, Ampere, Ada) without manual retuning.

Key Results

  • Speedup & Efficiency on V100: Across 393 shapes, TritonTune achieved a 2.24× geometric-mean speedup, improving 82% (322/393) of shapes with zero regressions.
  • Beating Classical Baselines in 15–25× Less Time: Compared against Random Search (1.70×, 39 hours), Bayesian Optimization (1.50×, 29 hours), and OpenTuner's AUC bandit (1.93×, 50 hours), TritonTune achieved higher speedups while finishing the entire benchmark sweep in just 2 hours.
  • Cross-GPU Generalization: Without prompt changes, TritonTune delivered geometric-mean speedups of 1.97× on L40S, 1.85× on A100, and 1.55× on A40.

Limitations and Future Work

  • Algorithmic Ceiling: Because TritonTune leaves kernel source code untouched, it hits a natural roofline ceiling; if a kernel’s core algorithm is suboptimal or already saturates memory bandwidth, launch knobs can't save it. (Though it could sequentially follow a code-generating LLM!)
  • LLM Overhead per Shape: Tuning every shape independently requires 3 LLM calls per shape, though the authors note configurations can be amortized across similar shapes to cut 95% of LLM costs.
  • Hardware Scope: Current experiments focus on NVIDIA GPUs up to Ada (SM89). Extending to newer Hopper warp-specialized knobs (SM90+), non-NVIDIA hardware, and running the two domain agents in parallel to halve LLM wait times are slated for future work.

Summary updated

Abstract

Tuning Triton GPU kernel launch configurations is a critical but labor-intensive step in production ML system deployment. Existing approaches rely on exhaustive autotuning, which requires manually defined search spaces and becomes prohibitively slow for the long tail of operator shapes. We present **TritonTune**, a multi-agent system that combines LLM-guided search with closed-loop empirical validation to optimize Triton kernel configurations safely and efficiently. TritonTune pairs two domain-specialized LLM agents with complementary expertise in data movement and compute resource allocation, resolves their proposals through a lightweight orchestration layer, and refines the best candidate through a phased benchmark search on real hardware. Per-agent feedback drives targeted corrections when regressions occur, and a hardware-validated fallback ensures that no accepted configuration measures slower than the original on the tuned kernel, shape, and device. On 19 TritonBench kernels and 393 input shapes spanning hand-written, `torch.compile`-generated, and quantized operators, TritonTune achieves a **2.24×** per-shape geometric-mean speedup on an NVIDIA V100 with 82% of shapes improved, with no accepted shape measuring slower than the original. Cross-GPU runs on L40S, A40, and A100 further confirm that our design generalizes beyond V100. These results show that LLM-guided multi-agent optimization, when grounded in hardware measurement, can serve as a practical, safe complement to exhaustive autotuning.
BibTeX
@inproceedings{duan2026tritontune,
  author = {Shukai Duan and Mihai Capotă and Guixiang Ma and Hou-Jen Ko and Rafael Wang and Steve Cho and Shahin Nazarian and Paul Bogdan},
  title = {{TritonTune: LLM-Guided Multi-Agent Optimization of GPU Kernel Configurations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=0JiQIE135s},
}
Figure