KACoBench: Evaluating Kernel-Algorithm Co-Optimization by AI Agents

KACoBench (arXiv:2612.05286) from ByteDance Seed and CUHK-Shenzhen evaluates whether AI agents can jointly design approximate algorithms (quantization, sparsity, low-rank) and fast GPU kernels across 203 real inference cases. Frontier agents score between 2.42 (DeepSeek-V4.1-Flash) and 5.43 (Claude Opus 5) geometric-mean speedup with automated cheating review.
KACoBench: Evaluating Kernel-Algorithm Co-Optimization by AI Agents: KACoBench (arXiv:2612.05286) from ByteDance Seed and CUHK-Shenzhen evaluates whether AI agents can jointly design approximate algorithms (quantization, sparsity, low-rank) and fast GPU kernels across 203 real inference cases. Frontier agents score between 2.42 (DeepSeek-V4.1-Flash) and 5.43 (Claude Opus 5) geometric-mean speedup with automated cheating review. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 203 Hierarchical Real-Model Cases: Covers 67 L1 local operations (4 families), 92 L2 modules (7 families), and 44 L3 end-to-end model evaluations.
- Numerical & Structural Inspection Allowed: Exposes real activation outliers, causal attention masks, and shared weights so agents co-design algorithms and kernels together.
- Strict Quality & Anti-Cheat Gating: Enforces <=1% downstream degradation at L3, Tukey-fenced INT8 relative L2 bounds at L1/L2, and a separate LLM submission review for cheat_detected.
- Demonstrates Co-Optimization Synergy: In Stable Diffusion case studies, jointly modifying algorithm + kernel outperforms changing either dimension in isolation.
import { createAgent } from '@smoke-monkey/harness';// Automated kernel-algorithm co-optimization loop with warmup timing & L2 fidelity checkconst agent = createAgent({agentId: 'kacobench-kernel-optimizer',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8000/v1',model: 'claude-opus-5',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},});async function main() {const result = await agent.run('Inspect public input activation outlier channels in case_l2/, fuse INT8/Triton matmul kernel, and verify relative L2 error stays below b_i.');console.log('Kernel Optimization Result:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Mastering LLM Inference Optimization From Theory to Cost Effective Deployment: Mark Moyou
GPU Programming | Threads, Warps, HBM, FlashAttention | Triton Lecture 1
What Is KACoBench and Why Separate Kernel Tuning From Algorithm Design Fails?
KACoBench (arXiv:2612.05286) is a 203-case benchmark built by ByteDance Seed and CUHK-Shenzhen to evaluate LLM agents on kernel–algorithm co-optimization for neural network inference. While KernelBench and FlashInfer-Bench fix the mathematical computation and evaluate pure CUDA/Triton rewrites, KACoBench lets agents adapt the algorithm itself—using quantization, pruning, low-rank projection, or operation reordering—provided they implement fast kernels and satisfy strict quality constraints.
Each case exposes representative weights and inputs so agents can inspect numerical properties like outlier channels, softmax sparsity, or shared projections. Quality constraints cap L3 model degradation at 1% relative (q_cand >= q_ref - 0.01|q_ref|), and bound L1/L2 outputs against $b_i = \min(e_i^{\mathrm{INT8}}, \tau_\ell)$ using Tukey's fence $\tau_\ell = Q_{3,\ell} + 1.5(Q_{3,\ell} - Q_{1,\ell})$:
| Frontier LLM Agent | L1 Score (67 cases) | L1 >=4x (%) | L2 Score (92 cases) | L2 >=4x (%) | L3 Score (44 cases) | L3 >=4x (%) | Overall Score | Pass Rate (%) |
|---|---|---|---|---|---|---|---|---|
| Claude Opus 5 | 8.69 | 46.3% | 5.03 | 39.1% | 3.67 | 47.7% | 5.43 | 82.8% |
| Kimi K3 | 8.35 | 34.3% | 4.89 | 55.4% | 2.68 | 40.9% | 4.78 | 86.7% |
| GPT-6.1 Sol | 6.62 | 40.3% | 4.48 | 42.4% | 3.59 | 52.3% | 4.74 | 83.3% |
| Seed-Evolving | 3.92 | 13.4% | 2.69 | 29.3% | 1.54 | 11.4% | 2.53 | 78.3% |
| DeepSeek-V4.1-Flash | 2.19 | 10.4% | 2.91 | 33.7% | 2.23 | 15.9% | 2.42 | 72.9% |
Measuring Kernel Speedup Fairly Without Weight-Packing Cheats
In KACoBench, initialization (__init__, where static weights can be quantized, packed, or JIT-compiled) is separated from forward timing, and candidate speedups are floored at 1.0x and aggregated by equally weighted geometric means across problems, families, and levels. Crucially, a post-evaluation code reviewer audits every winning submission for cheating—such as caching outputs, altering measurement timers, or skipping required layers—resetting the case score to 1.0 if flagged.
import torch
def kacobench_l2_fidelity_check(ref_out: torch.Tensor, cand_out: torch.Tensor, int8_err: float, tukey_cap: float) -> bool:
"""Verify candidate relative L2 error satisfies b_i = min(e_INT8, tau_l)."""
rel_l2 = (torch.linalg.norm(cand_out - ref_out) / (torch.linalg.norm(ref_out) + 1e-12)).item()
bound = min(int8_err, tukey_cap)
print(f"rel_l2={rel_l2:.6f}, bound={bound:.6f}")
return rel_l2 <= bound
# Example smoke check
ref = torch.randn(4, 1024)
cand = ref + 0.002 * torch.randn_like(ref)
assert kacobench_l2_fidelity_check(ref, cand, int8_err=0.015, tukey_cap=0.020)Local Output Fidelity Does Not Guarantee End-to-End L3 Preservation
KACoBench explicitly separates L1/L2 numerical L2 error bounds from L3 downstream task checks because small per-layer approximation errors can compound unpredictably across deep transformer blocks.
Frequently Asked Questions
Q:How is KACoBench structured across inference levels?
KACoBench comprises 203 cases across three levels: L1 (67 local operation cases across 4 families), L2 (92 module cases across 7 families), and L3 (44 full-model cases across 10 families).
Q:Which LLMs scored highest on KACoBench?
Claude Opus 5 achieved the highest overall geometric-mean score at 5.43 (82.8% pass rate), followed by Kimi K3 at 4.78 (highest pass rate at 86.7%) and GPT-6.1 Sol at 4.74 (83.3% pass rate).
Q:How does KACoBench set numerical error limits for L1 and L2?
Each input uses b_i = min(e_i^INT8, tau_l), taking the minimum of a reference INT8 implementation error and Tukey’s upper fence tau_l = Q3 + 1.5*(Q3 - Q1) over public errors.
Q:Why does KACoBench run an independent review after evaluation?
To detect gaming or cheat_detected patterns—such as bypassing computation, memoizing inputs, or misusing evaluation hooks—without running untrusted review logic.
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.