Architecture
~8 min readUpdated: December 2026

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

KACoBench Kernel-Algorithm Co-Optimization for Neural Network Inference

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.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

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.

Key Architectural Takeaways
Quick Implementation Examplekacobench-kernel-agent.ts
kacobench-kernel-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Automated kernel-algorithm co-optimization loop with warmup timing & L2 fidelity check
const 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);
Video Guides

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 AgentL1 Score (67 cases)L1 >=4x (%)L2 Score (92 cases)L2 >=4x (%)L3 Score (44 cases)L3 >=4x (%)Overall ScorePass Rate (%)
Claude Opus 58.6946.3%5.0339.1%3.6747.7%5.4382.8%
Kimi K38.3534.3%4.8955.4%2.6840.9%4.7886.7%
GPT-6.1 Sol6.6240.3%4.4842.4%3.5952.3%4.7483.3%
Seed-Evolving3.9213.4%2.6929.3%1.5411.4%2.5378.3%
DeepSeek-V4.1-Flash2.1910.4%2.9133.7%2.2315.9%2.4272.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.

python
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.

Google Search Questions & Answers

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 guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness