AgentCompile: An LLM-Guided Compiler for Direct CUDA Inference

Xuanzhe Li, Ziyan Weng, Zhiyu Zhu, Junhui Hou
6/4/2026
1 citation
cs.PLcs.AI

Official code: veneno1213822/AgentCompile (7 stars, Python, last commit 2026-08-04).

Abstract

Transformer inference increasingly relies on specialized compiler and runtime support, while recent LLMs can generate nontrivial CUDA kernels. However, unconstrained generation guarantees neither correctness nor performance.

Show full abstract

We present \textsc{AgentCompile}, an LLM-guided CUDA inference compiler that combines two complementary uses of LLMs. First, the LLM provides advisory metadata for compiler-derived region summaries and bounded candidate spaces. The compiler then instantiates template-based CUDA candidates, validates correctness, selects implementations by measured latency, and falls back when specialization is unsupported or unprofitable. Second, under compiler-defined contracts, the LLM directly generates five classes of decode-critical kernels to accelerate inference, prompted by distilled optimization principles. \textsc{AgentCompile} integrates these kernels into a serving runtime with paged KV cache, continuous batching, preemption, chunked prefill, and bucketed full-step CUDA Graph replay. Across six evaluated model families, \textsc{AgentCompile} achieves speedups of \textbf{2.23--6.98$\times$} over PyTorch eager for single-request generation, and \textbf{1.04--1.16$\times$} over vLLM for both single-request generation and multi-request serving. Our code is publicly available at https://github.com/veneno1213822/AgentCompile.

View on arXivView PDF

Code Implementations(1)

70Python, CudaJul 22, 20263 months ago

Similar Papers

Cite this paper

@article{li2026agentcompile,
  title  = {AgentCompile: An LLM-Guided Compiler for Direct CUDA Inference},
  author = {Xuanzhe Li and Ziyan Weng and Zhiyu Zhu and Junhui Hou},
  year   = {2026},
  eprint = {2606.07665},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.07665v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.07665.svg)](https://codeofpaper.com/paper/2606.07665)

Discussion