JAXBench: Benchmarking Autonomous TPU Kernel Optimization

Arya Tschand, Charles Hong, Julian Walker, Shengnan Cai, Shangkun Wang, Suvinay Subramanian, Sundar Dev, Vijay Janapa Reddi, Amir Yazdanbakhsh, Sethuraman Sankaran

TL;DR

JAXBench is the first native benchmark designed to evaluate how well AI agents can optimize code for Google’s Tensor Processing Units (TPUs). By providing 50 real-world workloads and a rigorous evaluation harness, the paper demonstrates that while LLMs struggle with TPU-specific programming (Pallas) due to a lack of training data, providing them with curated hardware documentation and structured search allows them to outperform standard compilers by an average of 1.36x.

What Problem Does This Paper Address?

In the world of AI hardware, performance is king. To get the most out of accelerators like GPUs and TPUs, developers write "kernels"—low-level programs that manage how data moves through the hardware. While there has been an explosion of benchmarks for AI-generated GPU kernels (using languages like CUDA or Triton), the TPU ecosystem has been left behind.

TPUs are fundamentally different from GPUs. While GPUs use a "massively parallel" model (SIMT), TPUs are sequential machines that rely on wide vector registers and systolic Matrix Multiply Units (MXUs). They also use a unique software stack called Pallas. Because Pallas code is rare in the public datasets used to train LLMs, models often "hallucinate" incorrect code or fail to account for TPU-specific constraints like memory hierarchy and tiling. JAXBench provides the "shared target" needed for researchers to measure and improve AI's ability to write these specialized kernels.

Methods

The authors developed a three-part framework:

  1. The Benchmark Suite: 50 JAX workloads, including 17 production-grade operators (like Flash Attention and Mamba-2 layers) and 33 fused operator sequences. Crucially, these are sized to be "compute-bound," meaning they actually push the hardware to its limits so that optimization gains are meaningful.
  2. Evaluation Harness: A system that uses jax.profiler to capture precise, device-side execution times. This eliminates "noise" from Python overhead, ensuring that speedup measurements are reproducible.
  3. Agent Evaluation: The researchers tested four AI-driven approaches:
  4. Best-of-N: Simple one-shot generation.
  5. Iterative Refinement: A feedback loop where the AI sees its own errors and tries again.
  6. Iterative + Context: The feedback loop plus a "cheat sheet" of TPU documentation.
  7. Autocomp: A specialized agent that distills thousands of pages of documentation into a structured prompt and uses beam search to find the fastest kernel.

Datasets

The paper introduces JAXBench, which consists of:

  • 17 Priority Kernels: Extracted from the MaxText library, representing state-of-the-art models like Llama-3.1, DeepSeek-V3, and AlphaFold2.
  • 33 Fused Operators: Translated from the existing KernelBench (originally for PyTorch) into idiomatic JAX.
  • Expert Baselines: For 8 of the kernels, they included hand-optimized Pallas implementations from the Tokamax library to serve as an "upper bound" for what a human expert can achieve.

Key Insights and Ideas

  • The Information Gap: The biggest hurdle for LLMs isn't "reasoning"—it's a lack of information. Plain iterative refinement only achieved 5.8% correctness. Simply injecting TPU documentation into the prompt lifted that to 37.3%.
  • Compute-Bound vs. Memory-Bound: Many previous benchmarks used small problem sizes where performance was dominated by "bookkeeping" (memory traffic). JAXBench forces the kernels into the "compute-bound" regime, where the AI must master complex tiling and pipelining to see any speedup.
  • Search vs. Documentation: While documentation gets the AI to "correct" code, structured search (like Autocomp’s beam search) is what converts that correctness into "performance." Autocomp was better at finding the specific block sizes and schedules that beat the standard XLA compiler.

Key Results

  • Beating the Compiler: Autocomp achieved a 1.36x geomean speedup over the standard XLA baseline, with 76% of its generated kernels outperforming the compiler.
  • Closing the Expert Gap: On a subset of kernels, Autocomp reached roughly 77% of the performance of hand-tuned expert kernels.
  • Model Scaling: Moving from a smaller model (Gemini 3 Flash) to a larger one (Gemini 3.1 Pro) resulted in massive gains, with speedups jumping from 1.59x to 3.82x on a 5-kernel subset.
  • Correctness: With proper context, iterative agents were able to solve 48 out of 50 benchmarks, a significant leap from the 13/50 solved by one-shot generation.

Limitations and Future Work

  • Single-Chip Focus: Currently, JAXBench only evaluates kernels on a single TPU chip. In the real world, models run on "pods" of thousands of chips.
  • Missing Collectives: The benchmark does not yet include "collective communication" (like all-reduce or shard-mapping), which is critical for multi-chip training.
  • Future Directions: The authors suggest that JAXBench could be used as a reward signal for Reinforcement Learning (RL), allowing models to "learn" TPU optimization through trial and error on these 50 workloads.

Reference: JAXBench: Benchmarking Autonomous TPU Kernel Optimization, Anonymous Authors (Under review at ICML).

Summary updated

BibTeX
@inproceedings{tschand2026jaxbench,
  author = {Arya Tschand and Charles Hong and Julian Walker and Shengnan Cai and Shangkun Wang and Suvinay Subramanian and Sundar Dev and Vijay Janapa Reddi and Amir Yazdanbakhsh and Sethuraman Sankaran},
  title = {{JAXBench: Benchmarking Autonomous TPU Kernel Optimization}},
  booktitle = {DL4C @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=RFpZOuhIk3},
}
Figure