KForge: A Multi-Agent System for Cross-Platform Kernel Synthesis

Taras Sereda, Burak Bartan, Ankita Nayak, Tom St. John, Natalie Serrino, Zain AsgarDL4C @ ICML 2026

TL;DR

KForge is a multi-agent LLM system designed to synthesize and optimize low-level GPU kernels across diverse hardware platforms (NVIDIA, AMD, Intel, and Apple). By pairing a "Generation Agent" with a "Performance Analysis Agent," the system can outperform vendor-tuned libraries like NVIDIA’s TensorRT-LLM, achieving a 2.12% throughput boost on modern LLM inference and a massive 5.13× speedup on Intel hardware.

What Problem Does This Paper Address?

While Large Language Models (LLMs) have become remarkably good at writing Python or JavaScript, they struggle with low-level "performance code" like GPU kernels. Writing a kernel isn't just about logic; it’s about managing memory hierarchies, instruction sets, and hardware-specific parallelism.

The authors identify three main hurdles:

  1. Performance as a First-Class Citizen: A kernel that is "correct" but slow is useless in production.
  2. The CUDA Bias: Most LLM training data is heavily skewed toward NVIDIA’s CUDA. Writing for "underrepresented" platforms like Intel (SYCL) or Apple (Metal) is significantly harder for standard models.
  3. Complex Feedback Loops: Optimization requires interpreting multi-modal data—ranging from text-based logs to visual profiling charts from tools like NVIDIA Nsight.

Methods

KForge tackles these challenges using a multi-agent iterative loop that mimics the workflow of a human kernel engineer. The system splits the work between two specialized agents:

  • The Generation Agent: This agent focuses on functional correctness. It takes a high-level task description (often a PyTorch reference) and produces the kernel code. It uses a "functional pass" to iteratively fix compilation errors and numerical mismatches based on runtime feedback.
  • The Performance Analysis Agent: Once the code works, this agent takes over. It interprets profiling data (including screenshots of visual profilers) to identify bottlenecks. It then emits specific optimization recommendations (e.g., "use shared memory for this tile") that steer the Generation Agent’s next attempt.

The system is model-agnostic (tested here with Claude 3.5 Opus) and supports six programming models, including CUDA, Triton, and Metal, through a uniform synthesis interface.

Datasets

The researchers evaluated KForge using two primary benchmarks:

  • GPT-OSS-20B: A production-grade Mixture-of-Experts (MoE) model architecture. They targeted specific decode kernels (like RMSNorm and MoE finalize) to see if KForge could beat the industry-standard TensorRT-LLM baseline.
  • KernelBench Level 2: A suite of 37 complex workloads involving GEMM (General Matrix Multiply) and "tail-ops" (pointwise activations and reductions). This was used specifically to test performance on the Intel Arc B580, a platform where hand-tuned references are scarce.

Key Insights and Ideas

  • Separation of Concerns: By splitting generation and analysis, the authors prevent "long-context degradation." Profiling data is dense; having a dedicated agent to distill that data into a single, actionable recommendation prevents the coder agent from getting overwhelmed.
  • Cross-Platform Translation: KForge can use a reference implementation from one architecture (like CUDA) to help "teach" the agent how to write for another (like Metal), effectively bridging the gap in LLM training data for non-NVIDIA platforms.
  • Automated "Expert" Techniques: Manual inspection showed that the agents independently "discovered" and applied sophisticated optimization techniques, such as layer-wise fusion (combining multiple operations to save memory bandwidth) and mixed-precision execution (using FP16 for math but FP32 for accumulation).

Key Results

  • Beating the Giants: On an NVIDIA B200, KForge-generated kernels achieved a 2.12% increase in end-to-end throughput over NVIDIA’s own TensorRT-LLM. While 2% sounds modest, in the world of high-scale inference, these gains represent massive savings in compute costs and energy.
  • Dominating on Intel: On the Intel Arc B580, KForge achieved a 5.13× geometric mean speedup over the best available baselines (torch.compile and eager-mode PyTorch).
  • Scaling with Workload: The "MoE finalize" kernel showed that KForge’s optimizations actually scaled better than the baseline; as batch sizes increased from 8 to 128, the speedup grew from 1.08× to 1.43×.

Limitations and Future Work

The authors note two primary limitations:

  1. Source-Level Dependency: Currently, KForge requires a source-level reference (like a PyTorch implementation) to start. Synthesizing kernels from a purely behavioral specification (i.e., "make a kernel that does X") remains a harder, unsolved challenge.
  2. Composition Issues: A faster individual kernel doesn't always lead to a faster system. Sometimes a fast kernel changes "occupancy" on the GPU in a way that slows down subsequent operations.

Future work aims to expand KForge’s scope to optimize entire blocks of a model (like an entire Attention or MoE block) as a single unit, rather than individual kernels, to better capture these compositional gains.

Summary updated

BibTeX
@inproceedings{sereda2026kforge,
  author = {Taras Sereda and Burak Bartan and Ankita Nayak and Tom St. John and Natalie Serrino and Zain Asgar},
  title = {{KForge: A Multi-Agent System for Cross-Platform Kernel Synthesis}},
  booktitle = {DL4C @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=VgXXDc22dH},
}
Figure