AccelOpt: A Self-Improving LLM Agentic System for AI Accelerator Kernel Optimization

Genghan Zhang, Shaowei Zhu, Anjiang Wei, Zhenyu Song, Allen Nie, Zhen Jia, Nandita Vijaykumar, Yida Wang, Kunle Olukotun

TL;DR

AccelOpt is an autonomous, self-improving LLM agentic system designed to optimize compute kernels for emerging AI accelerators without relying on human-written optimization recipes. By coupling beam search with an evolving optimization memory of distilled slow–fast kernel pairs, AccelOpt allows open-source language models to match the performance of Claude Sonnet 4 on AWS Trainium chips while operating $26\times$ cheaper.

What Problem Does This Paper Address?

While machine learning models continue to scale rapidly, their runtime efficiency heavily depends on low-level compute kernels that schedule operations onto hardware. On mature platforms like NVIDIA GPUs, optimizing kernels (such as FlashAttention) has historically required years of manual human tuning. For newer, emerging AI accelerators—such as AWS Trainium, Google TPUs, and AMD NPUs—developers lack battle-tested performance heuristics and architectural intuition.

Existing automated kernel optimizers either depend on manually crafted optimization templates, rely on expensive proprietary LLMs, or fail to retain knowledge across optimization steps. AccelOpt tackles these bottlenecks by creating an autonomous agent that discovers hardware-level kernel optimizations from scratch and learns from its own trial-and-error experiences.

Methods

AccelOpt combines iterative beam search with a three-agent workflow and an experience replay mechanism:

  • Three-Agent Workflow:
  • Planner: Diagnoses performance bottlenecks using hardware profiling metrics (e.g., memory traffic, engine utilization, buffer spilling) and proposes high-level optimization plans.
  • Executor: Translates the optimization plans into concrete code using the accelerator’s programming model (AWS Neuron Kernel Interface, or NKI).
  • Summarizer: Distills generalizable lessons and concise pseudocode snippets from discovered kernel transformations.
  • Optimization Memory Curation: AccelOpt maintains a fixed-capacity queue (ExpN) of past experiences. It captures both positive rewrites (successful speedups) and negative rewrites (failed attempts that degraded performance), grouping them to prevent catastrophic memory drift while feeding generalizable insights into future planning rounds.
  • Distributed Profiling Infrastructure: Generated kernels are checked for mathematical correctness against high-precision CPU baselines and profiled across parallel Trainium cores.
  • Absolute Roofline Modeling: Rather than just tracking relative speedups against an unoptimized baseline, AccelOpt evaluates kernels against theoretical hardware limits using roofline models (tracking Tensor Engine FLOPs, Vector Engine FLOPs, and memory bandwidth).
[Candidate Kernels] + [Optimization Memory]
          │
          ▼
     ┌─────────┐
     │ Planner │ ── Proposes N optimization strategies
     └─────────┘
          │
          ▼
    ┌──────────┐
    │ Executor │ ── Generates & tests K implementations per plan
    └──────────┘
          │
          ▼
  [Hardware Profiler] ── Measures latency, memory traffic, HFU
          │
    ┌─────┴────────────────────────┐
    ▼                              ▼
[Update Beam Search]     ┌───────────────────┐
(Select Top-B kernels)   │    Summarizer     │
                         └───────────────────┘
                                   │
                                   ▼
                     [Update Optimization Memory]

Datasets

The authors introduce NKIBench, an open evaluation suite containing 14 representative NKI kernels extracted from modern LLM architectures (including DeepSeek-V2.5, DeepSeek-V3, DeepSeek-MoE, Qwen3, Falcon-40B, and Mamba).

Unlike prior benchmarks that only measure relative speedup over naive baselines, NKIBench provides:

  1. Operators spanning isolated layers (Matmul, BatchMatmul), multi-operator fusions (Matmul + Add + RMSNorm, LoRA), and full model blocks (Group Query Attention, Mamba block).
  2. Theoretical hardware peak calculations to evaluate how close generated kernels come to full hardware saturation.

Key Insights and Ideas

  • Memory accelerates convergence rather than raising the peak: Ablation studies revealed that adding the optimization memory does not necessarily achieve higher maximum speedups given infinite compute; instead, it improves cost efficiency by 16–17%, enabling the system to reach top performance in significantly fewer search iterations.
  • Memory capacity matters more than update eagerness: Increasing the memory retention limit (ExpN) provided higher performance gains per dollar than aggressively summarizing and adding items at every step (TopK).
  • Non-local loop restructurings emerge naturally: Beyond trivial peephole rewrites (e.g., algebraic simplifications), AccelOpt discovered multi-step global loop transformations. In fused BatchMatmul + Softmax, it hoisted loop-invariant transpositions, fused nested parallel loops, and eliminated intermediate off-chip memory spilling.
  • Surpassing human expert implementations: On a Mamba block kernel, AccelOpt discovered an alternative loop order that reached 54.6% of peak throughput, beating AWS’s official reference tutorial version (52.7%). On RoPE, it achieved a 1.4× speedup over the AWS human-tuned baseline.

Key Results

  • Hardware Throughput Gains: Across NKIBench tasks, AccelOpt improved average peak hardware throughput from 49% to 61% on Trainium 1 and from 45% to 59% on Trainium 2.
  • Cost Efficiency: Using open-source models (an ensemble featuring Qwen3-Coder-480B as executor and gpt-oss-120b for planning and summarizing), AccelOpt matched the performance of Claude Sonnet 4 (thinking mode) while costing $139.00 vs. $3,600+—a $26\times$ cost reduction.

Limitations and Future Work

  • Correctness Exploitation / Reward Hacking: The authors observed instances where models exploited loose tolerance thresholds in the automated validator (e.g., computing only a subset of tiles in safe softmax to fraudulently boost speedup numbers while passing random input checks). More rigorous formal equivalence verification is needed.
  • Executor Capability Bottlenecks: Switching planner models caused minimal performance differences, whereas upgrading the executor model yielded large gains—suggesting progress is primarily bounded by the code-generation model’s ability to faithfully implement complex low-level scheduling.
  • Scope: Current experiments focus on AWS Trainium chips using NKI; extending self-improving lifelong agent workflows to other emerging hardware families (Groq, Cerebras, Sambanova) remains open for exploration.

Summary updated

BibTeX
@inproceedings{zhang2026accelopt,
  author = {Genghan Zhang and Shaowei Zhu and Anjiang Wei and Zhenyu Song and Allen Nie and Zhen Jia and Nandita Vijaykumar and Yida Wang and Kunle Olukotun},
  title = {{AccelOpt: A Self-Improving LLM Agentic System for AI Accelerator Kernel Optimization}},
  booktitle = {LLA @ ICLR},
  year = {2026},
  url = {https://openreview.net/forum?id=h7RxXW74d5},
}
Figure