Designing custom kernels for TPUs is a complex task requiring deep hardware expertise. A new research paper from Hugging Face introduces MaxKernel, a multi-agent system that leverages large language models (LLMs) and real-time compiler feedback to automate kernel generation.
MaxKernel implements three distinct paradigms: a Human-in-the-Loop (HITL) agent for collaborative step-by-step design, an Autonomous (Auto) agent that runs a fully automated metric/trace-driven optimization loop, and a Graph-Based Autonomous Search that scales the Auto agent for global design-space exploration. All paradigms share a pool of specialized sub-agents handling planning, implementation, self-debugging, testing, and hardware profiling.
The system was evaluated on JaxBench, a suite of 50 diverse TPU kernel tasks, plus real-world workloads from open-source models. Results show MaxKernel consistently matches expert hand-tuned baselines and delivers significant performance gains.
The agent is open-sourced and available on GitHub, enabling broader adoption and further research in accelerator kernel generation.