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:
- Manual effort: Humans have to guess and hardcode the search grid per kernel.
- The "long tail" of shapes: Every time input tensor dimensions change in production, the painfully slow search re-triggers.
- 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).
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):
- Phase 1: Benchmarks the orchestrator's synthesis alongside each agent’s top pick.
- Phase 2: Benchmarks the backup alternatives of whichever source won Phase 1.
- 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).
- 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