Hugging Face Papers ↗ · 2026-11-22
KernelShift: Benchmarking Kernel Optimization Across Evolving Hardware
Media reports Hugging Face Papers Source language: Chinese
KernelShift benchmarks coding agents on CPU kernel optimization across Arm extensions.
Full text
KernelShift: Benchmarking Kernel
Optimization Across Evolving Hardware
Shuaiwei Huang Email: shuaiweh@andrew.cmu.edu Weihua Du Email: weihuad@andrew.cmu.edu Allen Wu Email: allenwu@andrew.cmu.edu Ivan Fox Affiliation: Carnegie Mellon University Arm Ltd. Email: yiming@andrew.cmu.edu Manupa Karunaratne Yiming Yang Sean Welleck Affiliation: Carnegie Mellon University Arm Ltd. Email: swelleck@andrew.cmu.edu Email: Ivan.Fox@arm.com Email: Manupa.Karunaratne@arm.com
Abstract
Efficient AI computation depends on hardware that evolves over time, shifting the strategies needed to implement performant code. For CPU kernels, a key evolving factor is the set of available architectural extensions, which expose specialized hardware instructions that change the techniques used to optimize kernels. We study how effectively coding agents use these new, potentially unfamiliar extensions to write fast code. We introduce KernelShift, a benchmarking pipeline and a set of environments for evaluating coding agents in kernel optimization across evolving CPU architectures. Its agent-assisted, human-verified pipeline turns code repositories into benchmark instances, and its environments let agents optimize code with feedback from the target hardware. Using this pipeline, we construct 99 kernels from real-world, actively developed repositories (ncnn, llama.cpp, Arm SIMD Loops, and KleidiAI), including inference workloads derived from real model executions. KernelShift supports incorporating new kernels and hardware configurations as libraries and processors evolve. We evaluate agents with proprietary and open-weight models across progressively newer architectural extensions (Arm Neon, SVE, SVE2, and SME2), examining how performance changes as hardware evolves. On established extensions, agents beat the auto-vectorized compiler everywhere (2.42.4–19.8×19.8\times) and exceed general-purpose libraries such as ncnn (getting up to 2.74×2.74\times over its Neon kernels), but fall behind Arm’s hand-tuned KleidiAI kernels (0.70×0.70\times). In end-to-end inference of two LLMs, agent-written kernels achieve a 1.31.3–1.6×1.6\times prefill speedup over llama.cpp’s fast path. However, current agents do not yet reliably adapt to new extensions that require unfamiliar programming models, such as SME2’s matrix tiles.
††footnotetext: ∗Equal contribution. Project website: https://cmu-l3.github.io/kernel-shift/
1 Introduction
Modern ML workloads run across an increasingly diverse range of hardware, from CPUs to GPUs with different architectures and capabilities (Reddi et al., 2020). As these platforms continue to evolve, the optimization strategies needed to use them efficiently evolve as well. Meanwhile, AI coding agents are increasingly being used to optimize performance-critical code. For example, frontier labs such as OpenAI report using AI models to autonomously rewrite and optimize production GPU kernels (Ferrari et al., 2026; Novikov et al., 2025). As AI agents take on more performance-critical optimization, an important question is whether they can adapt their optimization strategies as the underlying hardware evolves over time.
In CPUs, hardware evolution often takes the form of new architectural extensions, which introduce new instructions and expose them to programmers through a new interface. Extensions can improve performance, but exploiting them often requires fundamentally restructuring a kernel’s implementation. For example, Arm’s matrix extensions support accumulating products directly into 2D matrix tiles, enabling implementations of matrix multiplication that differ from those based on earlier 1D vector instructions (Arm, 2026; Remke and Breuer, 2024). An agent can therefore produce correct but suboptimal code if it relies on older vector instructions when newer matrix instructions would be advantageous.
Figure 1: Overview of KernelShift. (Left) Evolving hardware changes the space of performant kernel implementations, requiring both human engineers and coding agents to continually adapt their strategies. (Right) To study this adaptation, KernelShift constructs benchmark tasks from real-world sources and model executions using an agent-assisted, human-verified pipeline.
To study kernel optimization under evolving hardware, we introduce KernelShift (Figure 1 (left)), a benchmarking pipeline and a set of environments for evaluating AI coding agents across evolving CPU architectures. The key idea is to evaluate how agents optimize matched kernels, where coverage permits, across successive architectural extensions that shift the space of performant implementations. Specifically, we evaluate agents across Arm’s vector and matrix extensions (i.e., Neon, SVE, SVE2, and SME2), which provide instructions for parallelizing computations common in machine learning workloads (Stephens et al., 2017; Arm, 2026). Our work builds on a growing literature on hardware-aware kernel optimization (He et al., 2025; Wen et al., 2025; Zang et al., 2026), with a specific focus on sequences of hardware changes that expose progressively newer programming interfaces.
We design an agent-assisted, human-verified pipeline with source-specific adapters for transforming code repositories into benchmark instances (Figure 1 (right)), together with environments that let agents iteratively optimize code using compilation and performance feedback from the target hardware (Figure 2). Using this pipeline, we construct 99 kernel specifications from real-world, actively developed repositories, including workloads derived from real model executions. The pipeline and environments are designed to incorporate new kernels and hardware configurations as libraries and processors evolve.
We evaluate coding agents with proprietary and open-weight models across progressively newer Arm architectural extensions. We measure both optimization performance and their use of newly available instructions, comparing their implementations against compiler-optimized code, production-library implementations, and expert kernels where available. Agents readily find headroom on established vector extensions: on SVE, they beat the auto-vectorized compiler in every source family and exceed general-purpose libraries such as ncnn (getting up to 2.74×2.74\times over its Neon kernels within 40 tool calls), but fall behind Arm’s hand-tuned KleidiAI kernels (0.70×0.70\times). However, this does not reliably carry over to newer programming models: on SME2, agents end up far slower than the expert kernels.
Our main contributions are:
•
KernelShift, a benchmarking pipeline and a set of environments to evaluate coding agents on evolving hardware and programming interfaces. The agent-assisted, human-verified pipeline supports adding kernels and hardware configurations as software libraries and processors evolve.
•
A benchmark of 99 real-world CPU kernels built with this pipeline, including workloads derived from real model executions.
•
An empirical study of coding agents across Arm architecture extensions, measuring both optimization performance and agents’ ability to exploit newly available hardware instructions.
2 KernelShift
Our goal is to evaluate agents’ ability to write performant code for evolving hardware. We introduce our problem setting, motivate our use of architectural extensions to distinguish stages of CPU hardware evolution, and describe our automated pipeline for collecting benchmark instances.
Hardware-aware kernel optimization.
We consider the setting of hardware-aware kernel optimization. In this setting, a kernel is a program that performs a specific computation, such as a matrix multiplication. Each task consists of an initial kernel implementation xx, together with context cc. The context includes the function signature, symbolic tensor shapes, and data types. Concrete workload dimensions and input values remain hidden (Appendix C.3).
The kernel is executed on target hardware, h=(I,m)h=(I,m). Here, II denotes the target instruction-set architecture (ISA), including base instructions and those introduced by supported architectural extensions. Programmers can access specialized instructions through intrinsics: compiler-supported operations exposed in C/C++. The microarchitecture mm is a concrete processor design that implements II on physical hardware. In general, the goal is to develop an agent AA that takes in an initial implementation, context, and hardware, and produces an optimized implementation x′=A(x,c,h)x^{\prime}=A(x,c,h):
maxA𝔼(x,c)∼𝒟,h∼ℋ[s(x,A(x,c,h))],\max_{A}\mathbb{E}_{(x,c)\sim\mathcal{D},\,h\sim\mathcal{H}}\left[s\bigl(x,A(x,c,h)\bigr)\right], (1)
where 𝒟\mathcal{D} is a distribution of optimization tasks and ℋ\mathcal{H} is a distribution of hardware configurations.
For a fixed task and target hardware, the score s(x,x′)s(x,x^{\prime}) is the geometric mean speedup over the task’s optimized reference across nn hidden workloads, which specify input configurations such as matrix dimensions. That is, let tireft_{i}^{\mathrm{ref}} and ti′t_{i}^{\prime} denote the runtimes of the optimized reference and the agent implementation on workload ii. The score is:
s=(∏i=1ntirefti′)1/n,s=\left(\prod_{i=1}^{n}\frac{t_{i}^{\mathrm{ref}}}{t_{i}^{\prime}}\right)^{1/n}, (2)
with s=0s=0 if the agent implementation fails any correctness check (Appendix B.3).
Evolving hardware.
Rather than sampling hardware configurations to approximate Equation 1, we are interested in sequences of hardware configurations that introduce new functionality to a common base architecture,
h1⟶h2⟶⋯⟶hT.h_{1}\longrightarrow h_{2}\longrightarrow\cdots\longrightarrow h_{T}. (3)
The kernel’s desired functionality remains fixed across the sequence, while the implementations that realize the functionality efficiently may change substantially.
Specifically, we primarily focus on changes to the available instruction set II through new extensions, since new extensions can introduce different ways to optimize computations and hence cause large shifts in the space of performant programs. For example, as illustrated in Figure 1, Arm’s Neon extension exposes fixed-width vector operations, while the later scalable vector extensions (SVE, SVE2) support code that adapts to different vector widths and provide additional vector operations. The more recent scalable matrix extension (SME) introduces dedicated matrix storage and instructions for accumulating vector outer products into matrix tiles, enabling new ways to implement matrix multiplication.
Motivated by these architectural shifts, we evaluate agents’ kernel optimization performance across such evolving extensions. In particular, we investigate whether the choice of extension impacts agent performance, and whether agents can effectively leverage newer intrinsics that are underrepresented in their training data. Therefore, we construct an automated benchmark framework that seamlessly accommodates new extensions as they arise. The benchmark design and automated generation techniques are detailed next.
2.1 Agent-Assisted Task Construction
Our construction framework turns performance-critical kernels from open-source projects into benchmark tasks. For each kernel, it constructs a portable C++ starting implementation xx, the context cc exposed to the agent, hidden workloads, and, when available, an optimized reference. Tasks are constructed by coding agents following fixed procedures backed by deterministic generation and validation scripts. Human input is limited to a few decisions: selecting kernels, approving workloads where no model execution can be traced, and reviewing the resulting expert references. Appendix B documents the complete construction process.
Kernel and reference construction.
For each source repository, a construction agent follows a fixed procedure (Appendix B.1) to identify candidate kernel computations and extract their fixed configuration parameters and variable workload dimensions. It then constructs a portable C++ starting implementation using simple loop-based code. When the repository contains an optimized implementation of the same kernel, the agent also extracts it as the optimized reference.
Workload construction.
To capture realistic workloads, we derive input configurations from real model executions whenever possible. For model-derived kernels, the construction agent first identifies the source model in which the kernel appears. Fixed configuration parameters then come from this model, while dimensions are collected from execution traces. For example, ncnn workloads come from vision-model executions, while llama.cpp workloads are collected during LLM inference on ShareGPT prompts (ShareGPT, 2023). We keep the observed tensor shapes rather than the original activation values, under the assumption that kernel performance is driven primarily by tensor dimensions and operator configuration rather than the specific numerical values of the activations. We then deduplicate and subsample the collected shapes to form the hidden evaluation workloads. For kernels without a clearly identifiable source model, we instead synthesize workloads in two groups: correctness-oriented cases that cover corner cases, and performance-oriented cases that probe efficiency over representative problem sizes. More details appear in Appendix B.2.
Finalizing benchmark tasks.
Finally, we package the starting implementation, agent-visible context, evaluation workloads, and the optimized reference from the source library, when available, into a self-contained benchmark task. Each task is validated by compiling and running the starting implementation on the target hardware before it is included in KernelShift.
2.2 Benchmark Composition and Coverage
We apply the construction framework from Section 2.1 to several widely used, performance-critical open-source repositories.
Composition.
KernelShift currently contains kernel tasks derived from four sources (Table 1): ncnn (Tencent, 2017), llama.cpp (Gerganov and ggml-org contributors, 2023), Arm SIMD Loops (Arm, 2025), and KleidiAI (Arm, 2024). Together, they cover computer-vision and LLM inference kernels, general SIMD workloads, and vendor-optimized microkernels across a range of data types and optimization patterns. The ncnn and llama.cpp tasks are derived from 11 source models, providing kernel configurations representative of real model architectures. Appendices A and A.2 provide the full composition and per-generation coverage.
Table 1: Composition of KernelShift. We apply our kernel collection pipeline to common or vendor-provided repositories, resulting in a wide range of kernels.
Source Op types Precisions Expert reference #Kernels
ncnn conv, dwconv, pool FP32, INT8 (w8a8ch) ncnn Neon 23
llama.cpp gemm, moe, attn, rmsnorm FP32, BF16, q8_0, q4_K_M ggml 26
SIMD Loops loops (reduction, string, search, …) fp/int/uint Arm SVE 24
KleidiAI gemm, conv, dwconv (NHWC) FP32, FP16, BF16, INT8, INT4, INT2 KleidiAI 26 (6 SVE, 20 SME2)
Total 99
Workloads.
KernelShift contains approximately 1.6K workloads across the 99 kernel specifications, constructed as described in Section 2.1 and spanning a broad range of tensor dimensions and sequence lengths.
Hardware and reference coverage.
The 99 kernels form the union across targets: every task can be instantiated on each target, but an optimized reference is not available for every source on every generation, so each generation uses the tasks that have one. For each task, the reference is a strong production or expert implementation available on the target (Appendix A.2).
2.3 Evaluation Environment
KernelShift uses a centralized control plane to run agent harnesses and coordinate evaluation across distributed target machines (Figure 2).
Hardware-in-the-loop evaluation.
Each target platform is backed by an evaluator running directly on its hardware. When an agent calls a tool, the request is routed to this evaluator, which compiles and executes the candidate on the target machine and returns the feedback, so that correctness and performance measurements reflect the hardware being evaluated. This design decouples the agent harness from target-specific execution, allowing the same agent setup to be used across hardware platforms. Appendix C gives the deployment configurations.

Figure 2: Evaluation architecture of KernelShift. A unified server exposes the same tools and skills to all agent harnesses and routes their requests to evaluators running on the target hardware.
Unified agent interface.
To compare different agent systems under the same environment, KernelShift exposes a harness-agnostic interface through which all agents access the benchmark. The interface provides the same three benchmark tools to every harness: compile, evaluate, and disassemble. These tools allow agents to iteratively refine their solutions with correctness, performance, and low-level instruction feedback from the target hardware. Appendix C.3 provides the complete prompts, skills, and tool schemas.
Measurement and integrity.
Correctness is checked before performance is measured, and both agent implementations and comparison baselines are tested on the same target machine under the same timing protocol. We use wall-clock execution time as the common performance measure across platforms, since hardware cycle counters are not consistently available on all target systems. Performance is reported as the speedup of a kernel over its expert reference on the same machine. Measurements use repeated runs on a single core, and each evaluation runs in an isolated process to prevent interference between evaluations. We also reject implementations that violate the benchmark constraints, such as using multithreading. Full timing, isolation, and integrity details are provided in Appendix C.4.
Table 2: Results on SVE (Graviton3). Each cell reports the geometric mean over kernels of Speedup@40 against the source’s expert reference and, in parentheses, the fraction of kernels that beat references (>1>\!1). The best speedup in each column is in bold. Each row is an end-to-end system (harness and model) run under the same limits, so rows compare systems rather than models alone.
Harness Model Geomean Speedup@40 (beat-ref %) vs. expert reference
ncnn (23) llama.cpp (26) SIMD Loops (24) KleidiAI (6)
Claude Code Claude Opus 4.8 2.574 (96%) 1.779 (73%) 1.555 (96%) 0.701 (33%)
Claude Code Claude Sonnet 4.6 1.934 (83%) 1.243 (46%) 1.516 (100%) 0.386 (33%)
Codex GPT-5.6-sol 1.815 (78%) 1.297 (62%) 1.487 (96%) 0.431 (17%)
Codex GPT-5.6-luna 0.674 (35%) 0.627 (27%) 1.127 (79%) 0.147 (0%)
nanobot Claude Opus 4.8 2.597 (91%) 1.708 (73%) 1.521 (96%) 0.453 (17%)
nanobot Claude Sonnet 4.6 2.046 (87%) 1.449 (62%) 1.503 (96%) 0.231 (0%)
nanobot GPT-5.6-sol 2.156 (87%) 1.334 (58%) 1.543 (100%) 0.319 (0%)
nanobot GPT-5.6-luna 1.110 (57%) 0.878 (31%) 1.182 (79%) 0.161 (0%)
nanobot DeepSeek-V4-Pro 1.091 (57%) 0.850 (46%) 1.458 (88%) 0.231 (17%)
nanobot GLM-5.3 2.743 (91%) 1.954 (85%) 1.545 (96%) 0.499 (17%)
tool-call loop Claude Opus 4.8 2.308 (83%) 1.828 (73%) 1.480 (92%) 0.496 (33%)
tool-call loop Claude Sonnet 4.6 2.043 (87%) 1.915 (81%) 1.521 (100%) 0.297 (17%)
tool-call loop GPT-5.6-sol 1.999 (91%) 1.671 (81%) 1.513 (96%) 0.307 (33%)
tool-call loop GPT-5.6-luna 0.955 (48%) 0.854 (31%) 1.245 (75%) 0.164 (17%)
single-shot, no tools (Claude Opus 4.8)† 0.577 (35%) 0.324 (8%) 0.852 (42%) 0.152 (0%)
†For correctness failures, we substitute the starter-kernel score.
Reference tiers
scalar + -O2 (no vectorization) 0.190 (0%) 0.090 (8%) 0.248 (0%) 0.025 (0%)
scalar + -O2 (Neon auto-vectorized) 0.191 (0%) 0.117 (12%) 0.398 (17%) 0.031 (0%)
scalar + -O3, SVE enabled 0.229 (9%) 0.126 (15%) 0.468 (25%) 0.035 (0%)
3 Experimental Setup
Models and harnesses.
We evaluate six frontier language models: Claude Opus 4.8 (Anthropic, 2026b) and Claude Sonnet 4.6 (Anthropic, 2026c), GPT-5.6-sol and GPT-5.6-luna (Ferrari et al., 2026), DeepSeek-V4-Pro (DeepSeek-AI, 2026), and GLM-5.3 (Zhipu AI, 2026). We pair these models with four harnesses: Claude Code (Anthropic, 2025), Codex (OpenAI, 2025), nanobot (HKUDS, 2025), and a minimal tool-call loop. We evaluate Claude Code and Codex with their own models, while nanobot provides a common harness across all six models to disentangle model and harness effects. The end-to-end study (Section 4.5) additionally uses Claude Fable 5.1 (Anthropic, 2026a) with Claude Code. Appendix C.3 contains full model and harness configurations.
Task sets.
Our experiments draw from the 99-kernel benchmark, with generation-specific coverage: The SVE comparison contains 79 kernels (23 ncnn, 26 llama.cpp, 24 SIMD Loops, and 6 KleidiAI). We use a 32-kernel subset for ablations and controlled studies.
Hardware and budgets.
We evaluate SVE on Graviton3 (AWS c7g), SVE2 on Graviton4 (AWS c8g), and SME2 on Apple M4. Each run receives a budget of T=40T=40 tool calls, with compile, evaluate, and disassemble calls all counting toward the budget. For test-time scaling experiments, we extend the budget to 100 tool calls.
Metrics.
Our primary metric, Speedup@40, is the score ss (Section 2) of the best correct implementation within 40 calls, averaged geometrically over kernels. We also report the fraction of kernels that beat the reference and compiler baselines, and performance versus budget.
4 Results
4.1 Agents find substantial speedups
Strong coding agents can exploit substantial optimization headroom in production kernels. On SVE, the best systems reach 2.74×\times the ncnn reference, 1.95×\times the llama.cpp reference, and 1.56×\times the SIMD Loops reference (Table 2). In contrast, compiler-based automatic optimization remains far behind expert references, with even -O3 and SVE reaching at most 0.47×\times. The -O3, SVE-enabled build is also the code that each agent starts from. Every system is faster than this -O3 reference across all four repositories (2.42.4–19.8×19.8\times; Appendix D).
Highly tuned vendor kernels remain substantially more competitive. On the six KleidiAI kernels with SVE expert references, no evaluated system matches the vendor implementations in geometric mean; the best, Claude Code with Claude Opus 4.8, reaches 0.70×\times, beating the reference on two kernels but falling behind on the other four. Agents exploit headroom in general-purpose production libraries, but matching specialized vendor kernels is harder.
Table 3: Instruction-set ladders on fixed hardware. Holding the machine and task set fixed, we progressively expose newer instructions; every arm is scored against the same reference. Speedup@40 of nanobot+GPT-5.6-luna, mean ±\pm s.d. of 3 seeds. Per-arm compile flags are in Appendix C.2; failure analysis is in Appendix G.
Arm Instructions available Speedup@40
Graviton4, 32-kernel subset
L1 Neon only 1.105 ±\pm.07
L2 ++ SVE 0.953 ±\pm.06
L3 ++ SVE2 1.101 ±\pm.01
Apple M4, KleidiAI SME2 set (20 kernels)
L4 Neon only 0.141 ±\pm.01
L5 ++ streaming SVE (no ZA) 0.059 ±\pm.004
L6 ++ ZA / FMOPA 0.085 ±\pm.006
Table 4: Cross-generation adaptation. Speedup@40 against the expert implementation of the older (Before) and newer (After) generation; Ratio = After / Before. Mean ±\pm s.d. of 3 seeds.
Model Before After Ratio
KleidiAI: SVE (6) →\to SME2 (6)
Claude Opus 4.8 0.436 ±\pm.02 0.562 ±\pm.20 1.29
Claude Sonnet 4.6 0.258 ±\pm.02 0.266 ±\pm.02 1.03
DeepSeek-V4-Pro 0.213 ±\pm.03 0.091 ±\pm.01 0.42
GLM-5.3 0.464 ±\pm.05 0.213 ±\pm.19 0.46
GPT-5.6-luna 0.178 ±\pm.04 0.073 ±\pm.01 0.41
SIMD Loops: SVE (8) →\to SVE2 (8)
Claude Opus 4.8 1.859 ±\pm.21 1.957 ±\pm.02 1.05
Claude Sonnet 4.6 1.750 ±\pm.18 1.752 ±\pm.12 1.00
DeepSeek-V4-Pro 1.587 ±\pm.18 1.504 ±\pm.16 0.95
GLM-5.3 1.929 ±\pm.07 1.810 ±\pm.19 0.94
4.2 Adapting to Evolving Hardware
Agents struggle more with the programming-model shift to SME2.
The biggest drop appears on SME2, which introduces streaming mode and ZA matrix tiles instead of just adding more vector instructions. On the same KleidiAI kernels, performance relative to the expert reference falls from SVE to SME2 for three of the five models: the SME2-to-SVE ratios are 0.420.42, 0.460.46, and 0.410.41 for DeepSeek-V4-Pro, GLM-5.3, and GPT-5.6-luna, while the performance of the Claude models remains similar (Table 4). GLM-5.3, the strongest of the five models on SVE, falls to less than half, so doing well on SVE does not carry over when a new extension requires a different programming style.
We also run the fixed-machine ladder on Apple M4, with GPT-5.6-luna as the base model and nanobot as harness. Over three seeds, exposing streaming SVE lowers Speedup@40 from 0.1410.141 (Neon only) to 0.0590.059, and exposing full SME2 recovers part of the loss, to 0.0850.085 (Table 4). Neon > SME2 > streaming SVE holds in every seed. The performance gap mostly comes from the different optimization paths that the agent applied. With streaming SVE available, the agent almost abandons Neon and settles on streaming SVE or falls back to plain C if compilation or correctness errors repeatedly happen. With full SME2 available, the recovery over streaming SVE does not come from ZA outer products: the agent simply keeps a Neon kernel more often than with streaming SVE only (Appendix G). None of the final SME2-tier kernels use ZA outer products, and across all SME2 runs the agent writes ZA code only twice, with neither version passing. Streaming and ZA code also fail to compile more often: in the first seed, 13% of compiles fail on the Neon tier, 20% with streaming SVE and 24% with full SME2 (Appendix G).
SME2 Case Study.
On gemm_bf16_n512_k512, Claude Opus 4.8 switches to streaming mode and uses MOPA/ZA accumulation, reaching 0.94×0.94\times the expert implementation. Claude Sonnet 4.6 and DeepSeek-V4-Pro, in contrast, stay with older vector-style implementations and reach only 0.06×0.06\times and 0.05×0.05\times. The same holds across kernels: nearly all final SVE solutions use SVE intrinsics, but of the 18 final SME2 solutions on the six KleidiAI kernels of Table 4 (three seeds), only 15 (Opus), 5 (Sonnet), 5 (GLM-5.3), and 1 (DeepSeek-V4-Pro) use the ZA tiles (Appendix F). Appendix E.2 traces in detail a representative SME2 optimization trajectory.
Agents adapt more readily to incremental ISA extensions.
By contrast, the move from SVE to SVE2 costs much less. On the eight SIMD Loops kernels whose expert SVE2 implementation needs SVE2-only instructions, the SVE2-to-SVE ratios are between 0.940.94 and 1.051.05 for every model (Table 4), and most final SVE2 solutions of the Claude models use the expert’s SVE2-only instructions (Appendix F). The fixed-machine instruction ladder on Graviton4 shows the same pattern: Neon and SVE2 reach 1.105×1.105\times and 1.101×1.101\times (Table 4). The main gap comes from how agents implement kernels on Graviton4’s 128-bit SVE vectors: about half of the gap comes from runs where the agent never got SVE code past the correctness check and fell back to scalar code. The other half comes from SVE code that is correct but slower, where the agent did not use the right SVE instructions (Appendix C.2). This is a milder form of the SME2 failures above: when agents do not use a newer programming interface well, their kernels end up slower than plain Neon code.
4.3 Agent Gains Depend on Expert Headroom
Figure 3: Agents gain more when expert kernels are less optimized. One point per kernel. xx: expert speedup over the scalar reference; yy: median Speedup@40 across harness–model cells. Dashed lines show constant agent speedup over scalar (3×\times, 10×\times, 30×\times).
Figure 4: Test-time scaling of agents. Best-so-far Speedup@tt against the expert reference as a function of the tool-call budget tt. Most agent progress is within 40 steps.
Across the 79 SVE kernels, median agent Speedup@40 decreases as the expert reference becomes stronger relative to unvectorized scalar code (Spearman ρ=−0.69\rho=-0.69; ρ=−0.75\rho=-0.75 within llama.cpp; Figure 4). Thus, large Speedup@40 values often reflect under-optimized reference paths rather than unusually strong agent performance. This is clear in llama.cpp RMSNorm: the reference is only 1.3×1.3\times faster than scalar, while agents beat it by a median 6.0×6.0\times. Conversely, for q4_K_M GEMM and MoE, the expert implementations are already 2525–29×29\times faster than scalar, and agents reach only 0.570.57–0.69×0.69\times of the expert.
4.4 What Improves Agent Optimization?
Table 5: Ablations (nanobot + GPT-5.6-luna): SVE on the 32-kernel subset, SME2 on the 20 KleidiAI SME2 kernels.
Setting Speedup@40
SVE
Control 1.074
++ Arm docs 0.997
++ cross-kernel notepad 0.974
−- disassemble tool 0.999
No intrinsics 0.300
SME2, 20 KleidiAI kernels
Control 0.083
++ Arm docs 0.130
++ SME2 pitfalls in prompt 0.167
As shown in Figure 4, most of the improvement is realized within the first 40 tool calls, but budget beyond 40 still pays off: Claude Sonnet 4.6 is 23–25%23\text{--}25\% higher at 100 calls than at 40. This additional gain, however, comes mainly from a few kernels undergoing structural rewrites between roughly 40 and 60 calls, and past 60 calls the curves are largely converged.
Arm documentation does not improve performance on SVE. On SME2 it raises Speedup@40 (0.1300.130 vs. 0.0830.083), but not through better SME2 code: with the documentation, no best version uses streaming SVE (vs. 66 without it), 1414 of the 2020 use Neon (vs. 77), and compile errors drop from 102102 to 5454. Putting common SME2 pitfalls in the prompt, with failure examples, doubles Speedup@40 on the 20 KleidiAI SME2 kernels (0.0830.083 to 0.1670.167), but 55 of the 2020 kernels get worse.
Some tools contribute little in practice. The cross-kernel notepad does not improve performance, while removing the disassembly tool does not lower performance. Inspection of agent trajectories shows that agents rarely use disassembly, while human experts frequently use it while designing advanced kernels. In contrast, forbidding SIMD intrinsics, so that agents must rely on compiler auto-vectorization, lowers performance from 1.0741.074 to 0.3000.300: most of the agents’ gains come from correctly using the provided intrinsics.
4.5 From Kernel Optimization to End-to-End Potential
Table 6: End-to-end speedup from agent-optimized kernels. Qwen3.5-4B and Llama-3.1-8B-Instruct (Q4_K_M) on Graviton4, relative to original llama.cpp.
Qwen3.5-4B Llama-3.1-8B-Instruct
Threads Prefill Decode Prefill Decode
1 1.395 1.045 1.568 1.099
4 1.348 1.059 1.454 1.069
16 1.298 1.048 1.391 1.102
To test whether kernel-level gains can translate into application-level improvements, we use Claude Code with Fable 5.1 to optimize 11 quantized matrix-multiplication kernels for Qwen3.5-4B and 7 kernels for Llama-3.1-8B-Instruct (both Q4_K_M), served with llama.cpp on Graviton4, and substitute the resulting shape-specialized implementations into the inference stack.
Compared with the original llama.cpp using its repacked i8mm fast path, the agent kernels speed up prefill by 1.301.30–1.57×1.57\times and decode by 1.041.04–1.10×1.10\times across 1–16 threads for both models (Table 6). Perplexity is unchanged on both models.
Gains come from adaptation to hardware.
All 18 kernels use Graviton4’s i8mm instructions together with shape-specific tiling, layout, and prefetching. Individual kernels average 1.5×\times faster than llama.cpp’s own repacked kernels if measured in isolation. Unlike llama.cpp’s general kernels, the agent-generated kernels are specialized to the target models’ shapes, so this shows the potential of automatic deployment-time specialization over expert libraries. Appendix E.1 provides complete setup and detailed results.
5 Related Work
Kernel optimization across hardware.
Recent work evaluates whether language models and coding agents can generate efficient kernels for a given hardware target or programming interface. KernelBench and TritonBench study GPU kernel generation (Ouyang et al., 2025; Li et al., 2025), while MobileKernelBench and SimdBench extend to mobile CPUs and SIMD intrinsics (Zou et al., 2026; He et al., 2025). Other benchmarks extend kernel evaluation across architectures and devices (Li et al., 2026; Wen et al., 2025; Zang et al., 2026; Chen et al., 2025). These works primarily evaluate performance on a fixed target or a set of hardware targets. In contrast, KernelShift organizes hardware as a sequence of successive architectural extensions and evaluates matched kernel tasks across generations where coverage permits. This lets us study adaptation to new instructions and programming abstractions.
Coding agents for performance optimization.
Recent coding agents improve programs through iterative execution and feedback (Yang et al., 2024; Wang et al., 2025). For kernel optimization, GPU Kernel Scientist and CudaForge use iterative search and hardware feedback, while AdaExplore combines execution-driven adaptation with diversity-preserving search (Andrews and Witteveen, 2025; Zhang et al., 2025; Du et al., 2026). More recent systems train kernel-optimization agents with reinforcement learning (Dai et al., 2026; Fu et al., 2026). These works show rapid progress in agentic kernel optimization. KernelShift provides both a controlled benchmark and a hardware-in-the-loop environment for testing whether such agents can adapt their optimization strategies as hardware evolves.
Automated program optimization.
A broader line of work studies program optimization using learned cost models, reinforcement learning, and search (Chen et al., 2018; Zheng et al., 2020; Trofin et al., 2021; Cummins et al., 2022; Wei et al., 2025; Mankowitz et al., 2023; Fawzi et al., 2022; Novikov et al., 2025). However, automated optimizers can still fall short of expert implementations when performance depends on hardware-specific transformations (Mendis et al., 2019; Tschand et al., 2026). This gap motivates coding agents that can optimize kernels through interaction with real hardware.
6 Conclusion
We introduced KernelShift, a benchmarking pipeline and set of environments to study how well coding agents optimize kernels as hardware evolves. Our results show that stronger agents can match or beat production kernels on established vector ISAs, but they struggle with programming-model shifts such as SME2. At the same time, the end-to-end speedups that agent-written kernels deliver on two LLMs highlight the potential of agent-driven kernel optimization in real deployments.
Limitations.
Newer hardware is harder to evaluate because strong expert implementations are often not available, which limits how many kernels we can compare across generations; in particular, our SME2 evidence rests on the 20 KleidiAI kernels that have an SME2 expert reference. Our experiments also focus on Arm CPUs, so it remains to be seen whether the same trends hold for other architectures such as x86 or GPUs. Finally, our kernel-level evaluation is single-core and does not cover all effects that may appear in multi-core deployment.
AI Use Statement
AI agents are the primary subject of this study. We also used AI tools to assist with research code generation, benchmark data collection and synthesis, and wording refinement. All AI-generated code, benchmark instances, and paper refinements were reviewed and verified by the authors. The authors were responsible for the code, experiments, and manuscript.
Ethics Statement
KernelShift is constructed from open-source software, and all redistributed code follows the licenses of the original repositories: ncnn (BSD-3-Clause), llama.cpp (MIT), Arm SIMD Loops (BSD-3-Clause), and KleidiAI (Apache-2.0). The study does not involve human subjects.
Reproducibility Statement
The code for the benchmark, including the scripts for evaluating the coding agents, is available at https://github.com/cmu-l3/kernel-shift, and the dataset at https://huggingface.co/datasets/l3lab/KernelShift.
Acknowledgments
This work was supported in part by SoftBank Group Corp. and Arm. This program was made possible (in part) due to the generosity of SoftBank Group Corp. We thank our collaborators at Arm for their support and collaboration.
References
Andrews and Witteveen (2025) M. Andrews and S. Witteveen GPU kernel scientist: an LLM-driven framework for iterative kernel optimization. In ES-FoMo Workshop at ICML, Cited by: §5.
Anthropic (2025) Anthropic Claude Code. Note: https://github.com/anthropics/claude-codeAccessed 2026-09-14 Cited by: §3.
Anthropic (2026a) Anthropic Introducing Claude Fable 5.1 and Claude Mythos 5.1. Note: https://www.anthropic.com/claude-fable-and-mythos-5-1Accessed 2026-09-25 Cited by: §3.
Anthropic (2026b) Anthropic Introducing Claude Opus 4.8. Note: https://www.anthropic.com/news/claude-opus-4-8Accessed 2026-09-21 Cited by: §3.
Anthropic (2026c) Anthropic Introducing Claude Sonnet 4.6. Note: https://www.anthropic.com/news/claude-sonnet-4-6Accessed 2026-09-21 Cited by: §3.
Arm (2024) Arm KleidiAI. Note: https://gitlab.arm.com/kleidi/kleidiaiApache-2.0. Accessed 2026-09-25 Cited by: §A.1, §2.2.
Arm (2025) Arm SIMD Loops. Note: https://gitlab.arm.com/architecture/simd-loopsBSD-3-Clause. Accessed 2026-09-14 Cited by: §A.1, §2.2.
Arm (2026) Arm Arm C Language Extensions. Note: https://github.com/ARM-software/acle/releases/tag/r2026Q1ACLE 2026 Q1 Cited by: §1, §1.
Chen et al. (2025) S. Chen, Z. Lu, and Q. Zhang Evolution of kernels: automated RISC-V kernel optimization with large language models. arXiv preprint arXiv:2509.14265. Cited by: §5.
Chen et al. (2018) T. Chen, T. Moreau, Z. Jiang, L. Zheng, E. Yan, M. Cowan, H. Shen, L. Wang, Y. Hu, L. Ceze, C. Guestrin, and A. Krishnamurthy TVM: an automated end-to-end optimizing compiler for deep learning. In 13th USENIX Symposium on Operating Systems Design and Implementation (OSDI), Cited by: §5.
Cummins et al. (2022) C. Cummins, B. Wasti, J. Guo, B. Cui, J. Ansel, S. Gomez, S. Jain, J. Liu, O. Teytaud, B. Steiner, Y. Tian, and H. Leather CompilerGym: robust, performant compiler optimization environments for AI research. In IEEE/ACM International Symposium on Code Generation and Optimization (CGO), pp. 92–105. Cited by: §5.
Dai et al. (2026) W. Dai, H. Wu, Q. Yu, H. Gao, J. Li, C. Jiang, W. Lou, Y. Song, H. Yu, J. Chen, W. Ma, Y. Zhang, J. Liu, M. Wang, X. Liu, and H. Zhou CUDA agent: large-scale agentic RL for high-performance CUDA kernel generation. arXiv preprint arXiv:2602.24286. Cited by: §5.
DeepSeek-AI (2026) DeepSeek-AI DeepSeek-V4 model card. Note: https://fe-static.deepseek.com/chat/transparency/deepseek-V4-model-card-EN.pdfAccessed 2026-09-21 Cited by: §3.
Du et al. (2026) W. Du, J. Zhuo, Y. Dong, A. W. He, W. Sun, Z. Zheng, M. Karunaratne, I. Fox, T. Dettmers, T. Chen, Y. Yang, and S. Welleck AdaExplore: failure-driven adaptation and diversity-preserving search for efficient kernel generation. arXiv preprint arXiv:2604.16625. Cited by: §5.
Fawzi et al. (2022) A. Fawzi, M. Balog, A. Huang, T. Hubert, B. Romera-Paredes, M. Barekatain, A. Novikov, F. J. R. Ruiz, J. Schrittwieser, G. Swirszcz, D. Silver, D. Hassabis, and P. Kohli Discovering faster matrix multiplication algorithms with reinforcement learning. Nature 610 (7930), pp. 47–53. Cited by: §5.
Ferrari et al. (2026) M. Ferrari, P. Tillet, A. Ibrahim, J. Gershenson, and S. Coffey How GPT-5.6 fuses frontier intelligence with frontier efficiency. Note: OpenAI, https://openai.com/index/gpt-5-6-frontier-intelligence-efficiency/ Cited by: §1, §3.
Fu et al. (2026) D. Fu, M. Jiang, T. Wang, D. Yang, J. Hu, L. Liu, J. Hou, and P. Liu daVinci-kernel: co-evolving skill selection, summarization, and utilization via RL for GPU kernel optimization. arXiv preprint arXiv:2606.16497. Cited by: §5.
Gerganov and ggml-org contributors (2023) G. Gerganov and ggml-org contributors Llama.cpp: LL