Skip to content
AI.info

Papers

AscendGYM: A Cost-Aware Kernel Optimization Benchmark for Real-World Workloads on Ascend NPUs

Optimizing low-level kernels is essential for efficient LLM training and inference on Ascend NPUs, but existing Ascend benchmarks mostly test whether a model can generate a kernel from a…

The paper’s first page · arXiv:2611.17621
arXiv
2611.17621 · Preprint · not peer-reviewed
Published
2026-11-13
Authors
AI Training Platform Team, Bingwei Zhang, Jing Li, Amir Abdullin, Sihang Chen, Xin Chen, Liangjun Feng, Yingmeng Gao, Tao Guo, Junjie Huang, Dongfang Li, Zhanglian Lin, Jiajun Liu, Zekun Liu, Zhengxuan Lu, Xiaodong Luo, Jian Meng, Ivan Nosov, Linyuan Qiu, Weijian Sun, Wanrui Yan, Binfan Zheng, Zhicheng Zhou, Baotian Hu, Min Zhang, Haizhou Li, Zhiquan Luo

In plain words

Optimizing low-level kernels is essential for efficient LLM training and inference on Ascend NPUs, but existing Ascend benchmarks mostly test whether a model can generate a kernel from a specification, not whether an agent can take an already-correct kernel and make it faster for the specific input shapes that real workloads actually use.

AI summary

Overview

Research area: AI systems / LLM-agent evaluation for low-level kernel optimization on Huawei Ascend NPUs (AI accelerators).

Technical level: Intermediate to Advanced. Readers should know roughly what a GPU/NPU kernel is and be comfortable with speedup metrics, but the paper's framing (why optimization cost matters, not just final speedup) is explained plainly enough for a motivated newcomer.

Scope (one sentence): The paper introduces AscendGYM, a 48-kernel benchmark built from real LLM training and inference workloads on Ascend NPUs, together with a sandbox (AscendForge) and a cost-aware metric (STS) for measuring how well coding models and agents can improve existing kernel implementations within a token budget.

What This Paper Is About

Optimizing low-level kernels is essential for efficient LLM training and inference on Ascend NPUs, but existing Ascend benchmarks mostly test whether a model can generate a kernel from a specification, not whether an agent can take an already-correct kernel and make it faster for the specific input shapes that real workloads actually use. The paper asks a narrower, more practical question: given a correct implementation, can a model-plus-agent system improve its performance for a target workload within an acceptable budget while preserving correctness? To answer it, the authors build a benchmark whose tasks come from real training and inference traces, plus a metric that scores both the speedup achieved and the token cost of achieving it.

Key Contributions

  1. AscendGYM benchmark: An Ascend-NPU kernel optimization benchmark whose initial suite comprises 48 kernels across three difficulty levels, where each kernel is paired with test cases whose data types and tensor shapes are collected from real-world training and inference tasks. Because each task ships a complete, runnable initial Ascend C implementation plus a measured baseline latency, performance gains map directly to the corresponding workloads.

  2. Speedup–Token Score (STS): A new metric that combines the final validated speedup with a penalty for delayed improvements, computed from cumulative token consumption at each improvement. The scoring formula is 100·log₂(Sₙ) minus 50·Σ (Bₖ/B_max)·Δgₖ, so that for the same final speedup, earlier improvements score higher.

  3. AscendForge execution sandbox: A four-layer Ascend-native environment (execution and build, resource orchestration, development feedback, deployment and operations) that unifies candidate compilation, correctness checking, performance measurement, and feedback. It builds on SandboxFusion and adds adapters for host-side registration, device-side kernels, the target SoC, and custom kernel packages.

  4. Two evaluation modes plus a systematic evaluation: Support for both model–harness evaluation (Claude Code, Codex CLI, OpenCode, or a custom harness) and model evaluation (a fixed default harness called AuraKernel, referred to as Default), with an empirical study of leading models on the 17 tasks in Batch 1.

Main Findings

  • Most combinations struggle to achieve meaningful speedups. Approximately 70% of the evaluated model–harness combinations achieve geometric mean speedups below 1.2×, with gains concentrated in modest improvements and limited task coverage at higher speedup thresholds.

  • Final speedup alone does not characterize optimization behavior. At 50M tokens, Claude Code/Opus 5 has a larger performance component than OpenCode/Opus 5 but also incurs a larger cost deduction; the deduction narrows the score gap without eliminating the advantage. Gain trajectories diverge across the tight (10M), moderate (20M), and generous (50M) budgets.

  • Lower attainment cost does not imply broader coverage. At a 50M-token budget with a 10% gain target, Opus 5 with OpenCode and with Claude Code has median CTG of 3.8M and 6.6M tokens over attained tasks respectively, but OpenCode reaches the target on only a subset of tasks while Claude Code covers all tasks. The attained task sets differ, so the lower conditional median does not establish greater efficiency on the same tasks.

  • Identical task coverage can hide very different improvement magnitudes. Claude Code/Opus 5 and Codex/GPT-5.6 both accelerate all tasks, but seven and three tasks respectively exceed 2× speedup.

  • High correctness pass rates do not imply high performance. GPT-5.6 passes all tasks with each of the three harnesses, yet its GM speedup differs substantially: approximately 1.69× with Codex versus 1.05× with Claude Code.

  • Different cost measures rank systems differently. Claude Code/Opus 5 consumes fewer tokens than Codex/GPT-5.6 but uses more interaction rounds, while OpenCode/Qwen-35B has relatively modest token and round counts yet takes approximately 11.1 hours per task.

  • The default harness configuration itself changes outcomes. Holding the model fixed at GPT-5.6 Luna, the warm configuration (initialized with 5 strategy lessons) achieves the highest STS at all three budgets and has a smaller cost deduction than cold at 10M tokens; as budget increases, cold's performance component grows and the gap narrows, but warm retains a higher score and larger performance component at 50M tokens. "Code only" outperforms "no lessons" at all three budgets but remains below the full cold configuration.

  • Task design is workload-grounded. The AddRMSNorm task, for example, captures residual addition followed by RMS normalization in a Qwen3-0.6B inference forward pass, using the prefill phase with no quantization, eager execution, a single NPU, TP 1, BF16, batch size 1, and input sequence length 32; profiling shows 56 invocations per forward pass, 8.77% of total computation time, and a top-5 rank by cumulative execution time.

Methodology in Plain English

The authors start from real systems — MindSpeed-LLM and vLLM-Ascend — collect profiling data, and pick the top-k bottleneck kernels. Each of those becomes a task: the agent gets the original source code, a specification, test inputs, reference outputs produced by a CPU implementation, and test scripts. Only the listed kernel source files may be modified; tests, golden references, and evaluation programs are frozen.

When an evaluation runs, the system first measures baseline latency for the initial implementation. Then it loops: analyze bottlenecks, edit code, submit the candidate to the AscendForge sandbox for compilation, Python interface binding, and correctness checks, then profile it if it passes. Compilation results and execution results are reported separately so the agent can tell build failures, numerical accuracy failures, and performance regressions apart. The loop stops when the budget or maximum iteration count is exhausted, and the best implementation is then revalidated.

Each model–harness run allows at most 80 candidate evaluations, with a soft target of 50 substantively different optimization proposals; failed submissions consume budget, baseline measurements do not. After the search ends, the final selected implementation undergoes five additional performance evaluations that provide no feedback and do not count toward the budget. Measurements follow a fixed protocol: eight rounds per evaluation, three of them warm-up, with the remaining rounds averaged using msprof timing. Correctness is judged by each task's predefined test scripts and numerical error criteria.

Scoring combines four metric families: joint performance–budget metrics (STS and Cost-to-Gain, or CTG, at relative gain thresholds of 1%, 5%, and 10%), performance metrics (GM Speedup and fast_p, where fast_p is the fraction of tasks exceeding speedup p), budget metrics (cumulative and mean token consumption, interaction rounds, wall-clock time, all including failed attempts), and reliability metrics (Candidate Pass Rate and Task Pass Rate).

Why This Matters

Impact on research. The paper shifts the evaluation question from "can a model write a fast kernel from scratch" to "can an agent improve an existing kernel under a realistic budget." By tying tasks to input shapes and data types drawn from real workloads, it makes speedup numbers mean something for deployment. STS also gives the field a way to distinguish two systems that reach the same final speedup with very different search effort — a distinction the authors argue final speedup alone cannot capture.

Real-world applications:

  • LLM inference serving on Ascend hardware, where prefill and decode phases favor different computation organizations and kernel-level gains translate directly into serving throughput and latency.
  • LLM training pipelines, where profiled bottleneck kernels (identified via MindSpeed-LLM) determine step time.
  • Quantization and normalization stages, covered by Batch 2 tasks such as normalization and quantization kernels.
  • Attention and fused computation, including sparse attention, covered by Batch 3 tasks targeting complex attention mechanisms and fused computations.
  • Automated performance engineering tooling, where the AscendForge sandbox acts as an evaluation service for agent-driven optimization loops.

Industry relevance. Ascend NPUs are a major non-NVIDIA accelerator line, and kernel work on them requires specialized expertise and sustained engineering effort. A benchmark that measures budget-aware optimization — tokens, interaction rounds, and wall-clock hours — speaks directly to teams deciding which model-plus-agent stack to deploy for performance engineering, and to the cost calculus of running such agents at scale.

Future Directions

  • Evaluate the remaining tasks. Only the 17 tasks in Batch 1 are reported here; results for Batch 2 (17 kernels) and Batch 3 (14 kernels) are deferred to future updates, and the authors state that future work will extend evaluation to the remaining 31 tasks and broaden task and input coverage.
  • Separate model capability from harness configuration. The model-evaluation results show that Default configurations (cold, warm, no lessons, code only) change outcomes with the model held fixed; the authors note that comparisons between models using Default should keep settings and prior experience consistent to avoid attributing configuration differences to model capability. How to normalize this remains open.
  • Understand what limits current systems. With roughly 70% of combinations below 1.2× GM speedup, it is unresolved whether the bottleneck is bottleneck diagnosis, Ascend-specific programming knowledge, or search strategy — and whether experience accumulation (as in the warm configuration) is the most effective lever.
  • Reconcile cost measures. Token consumption, interaction rounds, and wall-clock time rank systems differently (for example, OpenCode/Qwen-35B at approximately 11.1 hours per task), raising the question of how budget-aware metrics should be defined when the relevant resource depends on the deployment constraint.

Target Audience

Researchers and engineers working on LLM-driven code and agent systems for performance engineering, particularly those targeting Ascend/NPU software stacks; benchmark designers interested in cost-aware or budget-constrained evaluation metrics; compiler and kernel engineers who want to know how far automated agents get on real Ascend C kernels; and infrastructure teams choosing among coding-agent harnesses (Claude Code, Codex CLI, OpenCode) for optimization workflows. Readers focused only on GPU kernel generation will find the Ascend-specific tooling less directly applicable, but the STS metric and the workload-grounded task design transfer conceptually.

Authors’ abstract

Kernel optimization is essential for efficient large language model (LLM) training and inference on Ascend NPUs. Existing Ascend kernel benchmarks primarily focus on kernel generation, with less emphasis on the ability of agents to optimize existing implementations under input configurations drawn from real workloads. To address this requirement, we introduce AscendGYM, a benchmark whose initial suite comprises 48 kernels across three difficulty levels. Each kernel is paired…

The full abstract on arXiv
Read the original paper

Related papers