Manuscript Offprint

arXiv:2608.25570

Beyond Scaling: Self-Evolving LLM Agents for Hardware Kernel Optimization via an Experience-Driven Workflow and Experience Graph Memory

Siyuan Chen, Runlin Hou, Shenxiu Wu, Yansong Sun, Junming Cao, Yiyu Zhang, Shudi Shao, Junhao Qiu, Zhichao Lu, Qingfu Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Hardware kernel optimization requires repeated compilation, correctness testing, profiling, and revision. LLM agents can automate parts of this process, and stronger foundation models, longer context windows, and longer execution horizons have improved optimization within individual tasks. These advances alone do not enable an agent to learn from completed optimization runs. Existing kernel-optimization agents seldom preserve a decision, its observed execution feedback, and the later decisions that use that evidence. Retaining every prior trajectory is also impractical because an expanding history competes with the current task for context. We present KOPE, an experience-driven framework for hardware kernel optimization. KOPE records optimization trajectories with correctness and performance feedback in Experience Graph Memory, then uses Active Context Management and Injection to retrieve relevant experience under a fixed token budget. The graph retains decision order, observed outcomes, and alternative branches, allowing evidence collected on the target hardware to inform later optimization steps and tasks. Under the same GLM-5.2 setting, the geometric mean of KOPE's per-operator speedups is 1.54×1.54\times that of CANNBot, the strongest competing baseline. In a complete 53-operator ablation, Active Context Management and Injection raises pass rate from 60.0% to 84.6%, increases the evaluator-reported positive-field geometric mean from 0.0382 to 0.0661, and reduces optimization token consumption from 15.9B to 1.113B tokens relative to passive agent-led context construction. Enabling Experience Graph Memory raises full-suite pass rate from 55.2% to 84.6% and yields a 1.43×1.43\times geometric-mean speedup on valid timing comparisons. These results support continual optimization through external experience while the foundation model remains fixed.

Introduction

Hardware kernel optimization remains an expertise-intensive process. Performance depends on the memory hierarchy, data movement, parallel execution, and constraints specific to the target device. A candidate implementation must be compiled, tested for correctness, benchmarked, and often revised several times. Recent LLM agents automate parts of this process through stronger foundation models, domain adaptation, retrieval, larger context windows, and longer execution trajectories (Ouyang et al. 2025; Wei et al. 2025; Cao et al. 2026a).

Their effectiveness still depends heavily on hardware knowledge encoded in the underlying model. That dependence is particularly restrictive for newly introduced hardware with few public implementations or optimization traces. Automated optimization is useful precisely during this early stage, before the software ecosystem has accumulated a substantial public corpus. The gains reported for chip-domain and hardware-specific adaptation show that target-specific knowledge matters (Liu et al. 2023; Cao et al. 2026a).

Recent systems use domain adaptation, agentic reinforcement learning, multi-agent planning, and execution-guided iteration to strengthen model capability or refine a kernel within a task (Wei et al. 2025; Tehrani et al. 2026; Cao et al. 2026a; Dai et al. 2026). Their execution feedback mainly guides the current run and is rarely organized as reusable evidence for later decisions or tasks. The agent therefore remains dependent on knowledge already present in the model. Retaining every trajectory does not solve this problem: an expanding history consumes context and may obscure evidence relevant to the current task (Liu et al. 2024; Hsieh et al. 2024). This leads to the following research question:

How can an LLM agent turn execution feedback from exploration into reusable knowledge and apply it across optimization steps and tasks on hardware with scarce public training data?

KOPE addresses this question through an agent workflow that learns during exploration. It converts compiler diagnostics, correctness outcomes, profiling observations, and measured performance changes into external knowledge while keeping the foundation model fixed. Experience Graph Memory preserves decision-to-outcome histories and alternative branches. Active Context Management and Injection selects the experience relevant to the current optimization state under a bounded token budget. Knowledge collected on the target hardware then informs later decisions and optimization runs. Our contributions comprise one system-level workflow and two supporting mechanisms:

• Experience-Driven Optimization Workflow. We develop a closed-loop agent workflow that validates each candidate for correctness and performance. The workflow

∗^{*}These authors contributed equally.

†^{\dagger}Corresponding authors.

records the resulting trajectory and reuses that evidence in later decisions and runs.

• Experience Graph Memory. We introduce KOPE-Mem, which organizes optimization decisions and measured outcomes as a directed experience graph. Provenance links preserve execution order and alternative branches, so retrieval can consider downstream outcomes as well as textual relevance.

• Active Context Management and Injection. We select and inject task-relevant knowledge under the available token budget. The assembled prompt retains the required task state and useful prior experience without carrying the full history.

We evaluate workflow-level learning on Huawei Ascend NPUs using AscendC kernels (Liao et al. 2021). Public AscendC implementations and optimization traces are limited, while CANN Bench supplies a complete environment for compilation, functional testing, and performance measurement (Gao et al. 2026). This combination lets us study whether an agent can improve from evidence generated on the target hardware.

With GLM-5.2, KOPE attains a per-operator speedup geometric mean that is 1.54×1.54\times that of CANNBot. In the complete 53-operator context-policy ablation, Active Context Management and Injection raises pass rate from 60.0% to 84.6%, increases the positive-field geometric mean by 1.73×1.73\times, and reduces optimization token consumption from 15.9B to 1.113B tokens relative to passive agent-led context construction. The Experience Graph Memory ablation yields a 1.43×1.43\times geometric-mean speedup on 412 paired valid timing cases. CUDA-Agent, a strong NVIDIA-GPU optimization workflow, passes 14.7% and 9.1% of the full Ascend suite with GLM-5.2 and Deepseek-V4-Pro, respectively, but neither configuration solves a complete operator. These results suggest that model capability and within-task refinement are insufficient when target-specific public corpora are sparse. Effective workflows in this setting should also retain and reuse knowledge obtained during exploration. 1^{1}

The remainder of the paper reviews related work, describes KOPE, presents the experimental evaluation, and discusses the scope and limitations of the evidence.

References (24)