Technical report · GPU kernel engineering · November 2026

Muse Spark Kernel Challenge: Agent-Directed GPU Kernel Engineering for MoE Decoding on the H200

Srijan Bhushan
Independent · Muse Spark Open Kernel Challenge, October–November 2026

Abstract

Serving a large language model spends most of its time in the decode loop, where each step streams weights and cached keys and values through the GPU to produce only a few new tokens. This report describes a two-week effort, in the Muse Spark Open Kernel Challenge, to make one H200 GPU's share of a mixture-of-experts decoder layer faster than the kernels shipped by SGLang. The implementation was carried out through Claude Code agents under my direction: a single agent for ten days, then a coordinated team of agents with research, build and measurement roles. Every change passed exact-output checks and was timed against an untouched copy of the incumbent under the judge's CUDA-graph, cold-cache protocol. Final speedups over SGLang were 2.10× for attention decode, 1.98× for 4-bit routed experts, 1.85× for the whole decoder layer and 1.48× for 16-bit projections, ranking 618th of 2,014 entrants overall (top 31%). The gains came in three phases: original kernels, attributed ports of stronger open-source entries, and instruction-ordering and routing refinements. I report a 70-entry change log, the full cost (about $70 in AI costs), and six lessons on measuring small effects under noise.

Keywords: GPU kernels · LLM inference · mixture of experts · attention decoding · low-precision weights · AI coding agents

Summary of final results. Speedup is SGLang's time divided by mine, as a geometric mean over each board's scored shapes.

Attention
2.10×
faster than SGLang (started at 1.00×)
Top 42% of 1,379 entries
Routed experts
1.98×
faster than SGLang (started at 1.00×)
Top 47% of 1,425 entries
Whole layer
1.85×
faster than SGLang (started at 1.00×)
Top 47% of 1,299 entries
Projections
1.48×
faster than SGLang (started at 1.00×)
Top 25% of 1,746 entries
Overall board
#618
all four problems combined
Top 31% of 2,014 entrants

1  Introduction

Serving a large language model is a loop. Each decode step reads the model's weights and the cache of past tokens, does a small amount of arithmetic for a handful of new tokens, and emits one token per request. At the batch sizes production servers run, that step is limited by memory traffic and by the latency of launching and chaining GPU kernels, not by arithmetic throughput [3, 4].

The Muse Spark Open Kernel Challenge asked entrants to replace the kernels for one GPU's share of such a step in a mixture-of-experts (MoE) model [6], and scored them against the kernels shipped by SGLang [1], a widely used open-source inference server. Results had to stay numerically correct at the given precisions, with no caching or replaying of outputs, and the organisers rerun the top entries on held-out shapes after the close, so only real speedups count.

All implementation was carried out by Claude Code agents [13] under my direction. I set the goals, the rules and the pass bars, and held every change to the same standard: careful measurement, small experiments, and a clear separation of real results from noise.

Contributions.

  • Kernels for all four scored problems reaching 2.10× (attention decode), 1.98× (routed experts), 1.85× (whole decoder layer) and 1.48× (projections) over SGLang, ranking 618th of 2,014 entrants overall (Section 5).
  • A measurement protocol for effects smaller than the judge's ±1–3% noise: separately compiled experiment modules, exact-output gates, and in-process A/B/B/A timing against an untouched copy of the incumbent, with pass bars set before results are read (Section 4.2).
  • An account of the team-of-agents workflow that ran this programme, and what it cost (Sections 4.1 and 6).
  • A complete change log of every step from baseline to final (Appendix A).

2  Background

2.1  Decode, verify, and why the step is hard to beat

In plain decode each request adds one token per step. With speculative decoding [5], a cheap draft model proposes 8 tokens and the main model checks all 8 in one "verify" step, so each attention call has 8 query rows per request against the same 80K-token cache.

At batch 1 the whole step only has to move about 40 µs worth of data at full memory speed, and SGLang's kernels are already well tuned. The time left to win is spent waiting: on memory, on gaps between kernel launches, on stalls inside a kernel, and on the order the compiler chose for instructions. Raw arithmetic is not the bottleneck.

2.2  Related work

SGLang [1] is the baseline. Its attention path uses FlashAttention-3 [2], which exploits asynchrony and low precision on Hopper GPUs. Splitting a long cache into chunks that SMs scan in parallel follows Flash-Decoding [3], and the cache is paged as in PagedAttention [4]. For 4-bit weights, Marlin [7] is the established mixed-precision kernel, and Stream-K [8] balances matrix-multiply work evenly across all SMs. Kernels here were written in CUDA, PTX [10] and Triton [9]. Several of the strongest designs in this report come from public Apache-2.0 entries by other competitors, zhebrak [11] and vjeux [12], and are credited wherever used.

3  Problem Setting

3.1  Benchmark

The challenge ran on NVIDIA H200 SXM GPUs. Each problem is one slice of the model's decoder layer, with SGLang's kernel as the opponent (Table 1, Figure 1).

Table 1. The four scored problems.

ProblemWhat it computesShapes scored
Attention decodeAttention over an 80K-token cache of past keys and values, stored in 8-bit (FP8); 16 query heads share 2 key/value heads; sliding-window and full-cache layers12: batch 1/16/32, decode and 8-token verify
Routed expertsEach token is sent to 8 of 256 "expert" sub-networks whose weights are 4-bit (NVFP4); this GPU holds 32 of them6: batch 1, 8, 16, 32, 128, 256
Dense projectionsA few token vectors times large 16-bit (BF16) weight matrices: the five linear layers around attention and routing30: 1 to 256 tokens
Whole decoder layerAll of the above in one graph, plus every norm and residual12
Attention decode
queriesKV cache, split across SMsSM 1SM 2SM 3SM 4combine
Each request's new tokens read every past token's keys and values. The cache is split into chunks that SMs scan in parallel, then the partial results are combined.
Routed experts
tokens32 local expertsfilled: hot experts4-bit weights
Each token picks 8 of 256 experts, and this GPU holds 32. Routing is skewed, so the work is streaming a few hot experts' 4-bit weights fast enough.
Dense projections
few tokens × large weightsxWyeach row read once
With 1 to 256 tokens, a projection is close to a matrix-vector product. Nearly all of its time goes to reading the weight matrix once.
Whole decoder layer
one CUDA graph per stepqkvattnonormrouteMoEoutgaps between kernelsare inside the timed call
All of it in one timed graph. Gaps between kernels and the handoff from one stage to the next count as much as any single kernel.
Figure 1. What each scored problem computes, and where its time goes.

3.2  Decoder-layer dataflow

The model shards each layer across eight GPUs. One GPU holds 1/8 of the attention heads and 32 of the 256 experts, and the cross-GPU reductions are left out of the timing. For every new token the layer runs the chain in Figure 2, top row then bottom row.

Projections problem Attention problem Experts problem Norms and glue (layer problem only)
Figure 2. Decoder-layer dataflow on one GPU. The whole-layer problem times every box together. Weights stay in the formats given: 16-bit projections, 4-bit experts and an 8-bit cache.

3.3  Evaluation protocol

The judge records each kernel as a CUDA graph (a pre-recorded batch of GPU work, so launch overhead is tiny) and replays it with the GPU's cache cleared, as a busy server would see it. It divides SGLang's time by mine on each shape and averages those ratios as a geometric mean. The overall board combines the four problems.

Each problem allowed a daily quota of free check runs, which are timed but kept off the board, plus a smaller quota of scored runs; the best scored run became the board row. Machine-to-machine noise was ±1–3% per shape, so a single scored run often could not tell a 0.5% improvement from luck.

3.4  Objectives

  • Move up the combined board, aiming for the top 50, the band that earns queue priority in the follow-on serving track.
  • Ship only changes that a reviewer can read and that hold on held-out shapes: no output caching, no lower precision than the rules allow, no harness tricks.
  • Treat every claim as a measurement problem: a change ships only when its gain is clearly above the noise.

4  Method

4.1  Organisation: from one agent to a team of agents

For the first ten days, Oct 20 to Oct 29, one Claude Code agent did everything: reading, writing kernels and running checks. On Oct 30 I switched to a team of agents, because one agent could no longer keep four boards, their notes and their experiments in view at once. From then on I set the goals, the rules and every judgement call on what counted as fair, and a coordinating agent ran the loop.

A fifteen-role research team of agents studied one problem at a time. Its roles included lens researchers, a silicon designer, a numerics specialist, two statisticians and a challenger. The team argued from NVIDIA's instruction manual, the shipped code and the judge's logs to a blueprint of one or two experiments. Builder agents then turned each blueprint into code, and the coordinator ran it on the judge.

4.2  Experiment protocol

Every proposal went through the same loop (Figure 3), designed so that a loss was cheap and a win was real.

Figure 3. The experiment loop. Each experiment was its own separately compiled module, so the shipped kernel's code never changed, and every choice of which kernel runs on which shape sat in a fixed table with a fallback. Before a scored run was spent, a free check run timed the new version against an untouched copy of the current one in the same process, alternating them (A, B, B, A) with the cache cleared, so warm-up and ordering could not fake a win.

4.3  Techniques by problem

Each board improved in three phases. First came my own kernels. Then, where another competitor had published a stronger design under an open licence, I ported it with attribution and checked it line by line. Last came my own tuning on top. Table 2 summarises each phase; Appendix A lists every step.

Table 2. What moved each board, by phase. Figures are the board score reached at the end of each phase.

Attention · 1.00× → 2.10×
  • My kernels, to 1.48×. The whole decode step in one Triton kernel instead of SGLang's 7–8. Both key/value heads handled in one tile, so each cached token is read from memory once, not twice. The second matrix multiply done directly in 8-bit. Addresses fetched one step ahead. A single fused kernel for sliding-window verify.
  • Ported, to 2.02×. zhebrak's "head fold" trick (two heads presented to FlashAttention-3 as one), re-implemented. Then his kernels (Apache-2.0) in which some threads load data while others compute, and several SMs cooperate on one request, ported at exact precision.
  • My tuning, to 2.10×. Registers rebalanced between the loading threads and the computing threads, then five changes to instruction order that let the GPU overlap more work: −3.1%, then −6.1% and −7.1% on the heaviest shapes, and −1.9% to −2.8% on sliding-window shapes. Outputs are bit-identical.
Routed experts · 1.00× → 1.98×
  • My kernels, to 1.54×. Hand-written CUDA that unpacks 4-bit weights straight into the registers the tensor cores read. A small on-chip buffer that loads weights ahead of use. A second lane that runs the busiest experts on an existing kernel (Marlin) at the same time. Faster 4-bit unpacking. And a fix for a race condition I found in SGLang's own routing kernel.
  • Ported, to 1.81×. zhebrak's "stream-K" kernel (Apache-2.0), which divides all the expert weight tiles evenly across the GPU's 132 SMs so none sit idle.
  • My routing, to 1.90×. Extended that kernel down to batch 8 with a better estimate of how to split the work, and fixed every "which kernel for which batch size" choice in a table, chosen from repeated measurements.
  • Ported, to 1.98×. zhebrak's "cold pair" (Apache-2.0): two kernels where the second starts as soon as its inputs are ready, at batch 8, 16 and 32: +14%, +12% and +7%. A dedicated test proved its tiny run-to-run differences came from rows landing in a different order, not from a bug.
Whole layer · 1.00× → 1.85×
  • Composed, to 1.47×. My experts, attention and projection kernels inside SGLang's layer, plus a faster router, two expert lanes running at once, and each kernel allowed to start setting up before the previous one finishes (programmatic dependent launch).
  • Ported, to 1.74×. The same ported attention, experts and projection kernels as the single boards, wired into one graph.
  • Layer-only work, to 1.85×. The normalisation before the experts merged into the experts' first kernel, with identical output (+3.8%). Small batches moved onto stream-K. Projections allowed to start early. The attention board's tuned kernel brought in.
Projections · 1.00× → 1.48×
  • My kernels, to 1.31×. A lossless 12-bit format for the 16-bit weights, which cuts the bytes read by a quarter and decodes in a few integer operations. A tensor-core kernel that reads it. A router where many small programs add into one output. And a search through NVIDIA's cuBLASLt library that finds faster Hopper-specific kernels.
  • Ported, to 1.46×. vjeux's sk2 and gqx kernels (Apache-2.0), which stream the compact weights through the GPU's dedicated copy engine (TMA) and let SMs sum partial results with each other directly. Plus one library setting found by exhaustive search. All checked for exact output and fixed in a route table.
  • My tuning, to 1.48×. sk2 extended to the one-token shapes, a deterministic one-token router kernel, and one more searched library setting for a 256-token shape.

5  Results

5.1  Final standings

Every board began at SGLang's own speed, 1.00×, on Oct 20. Table 3 compares the final row on each board with that board's median, top quarter and leader. Projections placed highest relative to the field (top 25%); the other three boards finished above their medians. The overall rank moved from about 767 of 1,725 on Oct 31 to 618 of 2,014 when submissions closed.

Table 3. Final standings. Scores are speedups over SGLang.

BoardMy rowRankPercentileMedianTop 25%Leader
Attention decode2.0993576 / 1379top 42%1.9072.6033.339
Routed experts1.9830666 / 1425top 47%1.9172.3652.844
Whole layer1.8452617 / 1299top 47%1.7862.2362.614
Projections1.4843428 / 1746top 25%1.2471.4791.728
Overall–618 / 2014top 31%

Standings when submissions closed, Nov 4, 23:59 PT. On Oct 31 the overall rank was about 767 of 1,725. Ranks are provisional until the organisers' review reruns.

5.2  Progress over time

Figure 4 traces each board from the baseline to its final row. The large steps coincide with ported designs; the long flat stretches between them are many small, individually measured refinements.

Figure 4. Speedup over SGLang for each scored run that became the board row, in order of submission. The first point is SGLang itself (1.00×) on Oct 20. Many check runs and refuted ideas sit between consecutive rows.

6  Cost

All of the engineering ran through Claude Code agents on a personal subscription. All GPU timing ran on the challenge's own judge, inside its free daily quotas.

Calendar time
15 days
Oct 20 – Nov 3, 2026
AI cost
≈ $70
prorated subscription plus extra usage credits
Agent sessions per day
8.4 h
average wall-clock, over 12 logged days
Agent-hours per day
16.4 h
summed across agents running in parallel
Session wall-clock hours Agent-hours, summed across parallel agents
Figure 5. Agent time per day, from the timestamps of 973 local agent transcripts. A pause under 30 minutes, such as a wait for a judge run, counts as working time; Oct 20–22 ran outside these logs. Until Oct 29 the two series match because one agent worked at a time; from Oct 30 they diverge as the team of agents ran in parallel. The Nov 2 spike is four 64-agent research rounds, one per problem. Totals: about 100 session hours and 197 agent-hours.

The ≈ $70 figure is about $63 of subscription, prorating each plan's monthly price over the days it covered ($100/mo for 11 days, then $200/mo for the last 4: 11 × $100/30 + 4 × $200/30), plus a few dollars of extra usage credits. Billed as whole months, the two plans cost $100 and $200.

7  Discussion

7.1  Lessons

  1. The compiler's instruction order is a lever. Telling the compiler that one tensor-core instruction only writes its result, instead of reading and writing it, let it start that instruction earlier and saved 3%. Four more ordering fixes saved 6–7%. None of them changed how much work the kernel does.
  2. A register budget is a cliff, not a slope. Each thread had 104 registers, the fastest storage on the chip. One value too many spilled into much slower memory and cost 10–100%. Changes had to remove work, not add bookkeeping.
  3. Read the scoring formula before choosing targets. On the layer board a sliding-window shape weighs 46 and a full-cache one 16, so a microsecond saved on sliding shapes was worth about 2.9 times more. That reordered the plan.
  4. Measure against a null, and write the rule first. The judge's noise was larger than many real gains. Timing each change side by side with an untouched copy of the current version, and writing the pass bar before reading the results, kept luck out of the shipped code.
  5. Never put an experiment inside the shipped kernel. One trial left a switched-off hook inside the production kernel and slowed every shape. After that, every experiment was a separate compiled module, and the shipped code was checked byte for byte.
  6. Most ideas lose, so make losing cheap. Well-reasoned proposals were refuted more often than confirmed. Because every experiment was its own module, checked for correctness and timed in a free check run, each loss cost one check and left a written record, not a wasted scored run.

7.2  Limitations

  • Ranks are provisional until the organisers' review reruns the top entries, including on held-out shapes.
  • All timing is on one GPU model (H200) and one model's shapes. Kernel choices are fixed per batch size, and untested nearby sizes rely on fallbacks.
  • A substantial share of the final speedup comes from ported public designs [11, 12]. Table 2 separates original work from ports.
  • With ±1–3% noise per shape, gains below about 1% are reported from in-process A/B measurements rather than from the leaderboard alone.
  • Agent-time figures come from local transcript timestamps and omit Oct 20–22.

8  Conclusion

Working through a team of agents, I produced kernels 1.48–2.10× faster than a production inference stack on every problem of a public kernel challenge, for about $70 in AI costs. The decisive factor was less any single kernel than the discipline around them: exact-output gates, in-process comparisons against a null, and failures that were cheap and written down.

Acknowledgements

Several shipped kernels began as public, Apache-2.0-licensed entries by other competitors: zhebrak's stream-K experts kernel, cold-pair experts kernels and attention kernels [11], and vjeux's BF16 projection kernels, sk2 and gqx [12]. I ported them as attributed text, explained them in my notes, and changed them further. The FlashAttention-3 head fold re-implements a technique from zhebrak's entry. My detailed notes, judge logs and every experiment's numbers live in my project repository.

References

  1. L. Zheng, L. Yin, Z. Xie, et al. SGLang: Efficient Execution of Structured Language Model Programs. NeurIPS, 2024.
  2. J. Shah, G. Bikshandi, Y. Zhang, V. Thakkar, P. Ramani, T. Dao. FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision. NeurIPS, 2024.
  3. T. Dao, D. Haziza, F. Massa, G. Sizov. Flash-Decoding for Long-Context Inference. Technical blog, 2023.
  4. W. Kwon, Z. Li, S. Zhuang, et al. Efficient Memory Management for Large Language Model Serving with PagedAttention. SOSP, 2023.
  5. Y. Leviathan, M. Kalman, Y. Matias. Fast Inference from Transformers via Speculative Decoding. ICML, 2023.
  6. N. Shazeer, A. Mirhoseini, K. Maziarz, et al. Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. ICLR, 2017.
  7. E. Frantar, R. L. Castro, J. Chen, T. Hoefler, D. Alistarh. MARLIN: Mixed-Precision Auto-Regressive Parallel Inference on Large Language Models. PPoPP, 2025.
  8. M. Osama, D. Merrill, C. Cecka, M. Garland, J. D. Owens. Stream-K: Work-centric Parallel Decomposition for Dense Matrix-Matrix Multiplication on the GPU. PPoPP, 2023.
  9. P. Tillet, H. T. Kung, D. Cox. Triton: An Intermediate Language and Compiler for Tiled Neural Network Computations. MAPL, 2019.
  10. NVIDIA. CUDA C++ Programming Guide and Parallel Thread Execution (PTX) ISA. NVIDIA documentation.
  11. zhebrak. Public entries to the Muse Spark Open Kernel Challenge: attention, stream-K and cold-pair experts kernels. Apache-2.0, 2026.
  12. vjeux. Public entries to the Muse Spark Open Kernel Challenge: sk2 and gqx BF16 projection kernels. Apache-2.0, 2026.
  13. Anthropic. Claude Code. Software, 2025.

Appendix A  Complete change log

Each row is a version that became the board row, or a step whose technique is still in the final file. Scores are the judge's speedup over SGLang. Open a board to see its history.