arXiv:2610.34440cs.LGOct 2026

Manuscript Offprint

arXiv:2610.34440

Speculative Decoding for Mixture-of-Experts Models: Expert Bytes, Kernel Bandwidth and the Best Draft Length

Yuzheng Lan

Abstract

Speculative decoding checks several drafted tokens in one verification pass. On a mixture-of-experts (MoE) model, consecutive tokens often select the same experts. A deduplicating engine reads each selected expert once per pass, so it requests fewer bytes than a per-slot engine, which reads it once per token. We write a step's time as the bytes each kernel requests over its effective bandwidth, plus fixed time. Under geometric acceptance, we derive from this step time when speculation is faster than plain decoding. The best draft length is a monotone staircase in the acceptance rate. We bound how a bandwidth error moves each result, and we check the main steps in Lean. Deduplication is faster exactly where its share uˉ(n)\bar{u}(n) of the per-slot bytes is below its ratio r(n)r(n) of the per-slot bandwidth. On llama.cpp Metal, MLX-LM and llama.cpp CUDA, which we modified to deduplicate, the per-slot kernel has the higher effective bandwidth ( r=0.32r = 0.32 to 0.75). Thus deduplication is faster only from 5 to 8 tokens per pass, or never. We fit the bandwidths on one layer's expert operation, run alone, in under an hour per model. Bytes from routing traces over these bandwidths predict the time that deduplication saves. The measured saving lies inside its error bound at every point on CUDA and MLX-LM and at 36 of 48 points on Metal. The crossover is the first pass size at which deduplication is faster. The prediction places it within one pass size in 10 of 12 configurations of engine, model and depth. We computed these predictions after the measurements. On DeepSeek-V2-Lite, operation times measured before its speculative runs give the best draft length on CUDA within one at all 22 acceptance values.

1 Introduction

A mixture-of-experts (MoE) layer replaces one feed-forward block by N experts and a router that sends each token to m of them (Fedus et al., 2022; Shazeer et al., 2017). At batch size one, memory reads limit decoding (Chordiya, 2026; Pope et al., 2023; Zhang, 2026). In speculative decoding (Chen et al., 2023; Leviathan et al., 2023), a small draft model proposes k tokens, and this number is the draft length. The target, the model being decoded, checks these tokens with the current token in one verification pass. The acceptance rate a is the probability that a drafted token survives. On an MoE model, the pass needs the experts of all k+1k+1 verified tokens. Published measurements disagree on whether speculation then speeds up decoding (Cao et al., 2026; Saxena et al., 2025). Consecutive tokens often choose the same experts (Suram, 2026; Zhang et al., 2026). An engine is the inference software that runs the model. A kernel is a GPU routine that the engine launches for one operation. The kernel that matters here runs the expert operation. This operation is the set of matrix products (gate, up and down projections) of each token of a verification pass with the weights of its selected experts. A slot is one of a token's m expert selections, so a pass of n tokens has nm slots. A per-slot kernel multiplies each token by each of its selected experts separately, with one expert read per slot. A deduplicating kernel groups the pass's tokens by expert and reads each distinct expert once. We call an engine per-slot or deduplicating by the kernel that it runs on verification passes. So reuse lowers the bytes of a pass only on a deduplicating engine.

Consider an affine step time 1+χk1 + \chi k, with χ\chi the cost of a drafted token relative to a target step. For this step time, Leviathan et al. (2023) show that some draft length is faster than plain decoding exactly when a>χa > \chi. They also give the first step point, the acceptance at which the best draft length first exceeds zero. Section 3 extends both results to any step time. It also gives every step point when each further draft adds at least as much time as the one before. The cost of an MoE verification pass is not affine in kk. Its bytes depend on how many distinct experts the verified tokens select. Its time depends on how fast each kernel moves those bytes.

Prior systems decide whether to speculate either from measurement or from a model of the verification cost. Saxena et al. (2025) disables speculation when a utility measured online falls below one. Among cost models for MoE targets, MoESD (Huang et al., 2025) derived the expected number of distinct experts that n tokens select under uniform routing: N(1−qn)N(1-q^{n}) with q=1−m/Nq = 1-m/N. Li et al. (2026) assumes deduplication and no fixed cost. Its speedup condition is on the ratio of the distinct experts that the tokens of a verification pass select to those of one token. So it is a condition on how often consecutive tokens repeat experts. S2-MoE (Huang et al., 2026) charges a verification the newly introduced experts times a per-expert latency. SpecFit (Cao et al., 2026) predicts cycle time as an intercept plus a coefficient times the per-layer union of experts. Both charge every expert read the same time at every pass size, which is a single bandwidth for every kernel. Neither derives the staircase, the best draft length as a function of acceptance. Neither derives a speedup from reuse together with the bandwidth of each kernel.

Next-token expert reuse has been measured at 44 to 48% on Qwen3-30B-A3B (Zhang et al., 2026) and 0.444 in llama.cpp router traces (Suram, 2026). MonoMoE (Gong et al., 2026) finds that token-major kernels that group tokens by expert underuse memory bandwidth when few tokens reach each expert. It replaces them by a fused kernel that loops over expert weights and applies each to all of its tokens. Opportunistic Expert Activation (Oncescu et al., 2025) re-routes tokens to experts that a batch already loads. Neither models when a deduplicating kernel is faster than a per-slot one. Engine developers tune that switch by hand (pratiknarola-t, 2026). An MLX issue reports that the deduplicating product at one row runs near half its bandwidth at four rows (Haddad, 2026). Both are engineering reports without peer review.

This paper separates the two inputs of a step's time. A speedup is a ratio of step times. A step's time is the bytes that its kernels request over the rate at which they move them, plus fixed time. That rate is the effective bandwidth of each kernel. The bytes follow from routing alone. On CUDA, they match a hardware count of DRAM bytes. The bandwidths depend on the kernel: on every engine and model that we measured, the per-slot kernel has the higher effective bandwidth. On a pass of n tokens, deduplication requests a share uˉ(n)\bar{u}(n) of the per-slot bytes, and routing fixes this share. Deduplication moves these bytes at a ratio r(n)r(n) of the per-slot bandwidth, and the kernels fix this ratio. So deduplication is faster exactly where uˉ(n)<r(n)\bar{u}(n) < r(n). Its saving, the time it removes from a pass, is the per-slot expert time times 1−uˉ(n)/r(n)1 - \bar{u}(n)/r(n). Section 2 measures the bytes and the bandwidths. Section 3 works in that step time. It gives the condition under which a draft length is faster than plain decoding, and the staircase. On a deduplicating engine, it gives the reuse threshold, the least mean reuse at which a draft length is faster, and the speedup. It also gives bounds on how a bandwidth error moves each prediction. These results are proved in Lean 4 (de Moura and Ullrich, 2021) against Mathlib (The mathlib Community, 2020). Section 4 tests them on deduplicating versions of llama.cpp Metal, MLX-LM and llama.cpp CUDA. We measure the bandwidth on the expert operation, in under an hour per model. Bytes from routing over this bandwidth predict the saving within its stated error on CUDA and MLX-LM. They predict the crossover within one pass size in 10 of 12 configurations. A configuration is an engine, a model and a context depth. On DeepSeek-V2-Lite, we measured operation times before any of its speculative runs. These times predict the best draft length on CUDA within one at every acceptance value. In contrast, the prediction from fits run afterwards misses its CUDA crossover. On Metal, the verify time needs one calibration of the time outside the expert operation.

Routing, union and reuse. A decoder has LL MoE layers of NN experts. In layer ll, the router selects a set Sl,tS_{l,t} of mm experts, 1≤m<N1 \leq m < N, for the token at position tt. We call a law on the array (Sl,t)(S_{l,t}) a routing process. It is stationary when a window of nn tokens has the same law wherever it starts. A pass over nn consecutive tokens needs their Xl,t(n)=∣Sl,t∪⋯∪Sl,t+n−1∣X_{l,t}(n) = |S_{l,t} \cup \cdots \cup S_{l,t+n-1}| distinct experts, with mean Ul(n)U_l(n), Ul(0)=0U_l(0) = 0. We define the consecutive-token reuse

ρl(n)=1mE∣Sl,t+n−1∩(Sl,t∪⋯∪Sl,t+n−2)∣,ρl(1)=0,(1)\rho_{l}(n)=\frac{1}{m}\mathbb{E}\big|S_{l,t+n-1}\cap(S_{l,t}\cup\cdots\cup S_{l,t+n-2})\big|,\qquad\rho_{l}(1)=0, \tag{1}

the expected share of a token’s experts that one of the n−1n-1 tokens before it also selected. At n=2n=2 it is the next-token reuse measured by Zhang et al. (2026). Each token therefore adds m(1−ρl(n))m(1-\rho_l(n)) new experts on average. By linearity of expectation, for every stationary process,

Ul(n)=m∑j=1n(1−ρl(j)).(2)U_{l}(n)=m\sum_{j=1}^{n}\big(1-\rho_{l}(j)\big). \tag{2}

Under independent uniform routing 1−ρl(n)=qn−11 - \rho_l(n) = q^{n-1} with q=1−m/Nq = 1 - m/N (Huang et al., 2025).

Bytes. Let wlw_l be the bytes of one expert of layer ll, W=∑lwlW = \sum_l w_l, and DD the bytes read once per pass whatever the routing. A trace is the recorded expert sets of one token sequence. On every trace, a deduplicating kernel requests ∑lwlXl,t(n)\sum_l w_l X_{l,t}(n) expert bytes for a pass of nn tokens. A per-slot kernel requests mnWmnW, one request per slot. In expectation, the union bytes are Ededup(n)=∑lwlUl(n)E_{\text{dedup}}(n) = \sum_l w_l U_l(n), and Eslot(n)=mnWE_{\text{slot}}(n) = mnW. So a per-slot kernel requests

Eslot(n)−Ededup(n)=m∑lwl∑j=1nρl(j)≥0(3)E_{\mathrm{slot}}(n)-E_{\mathrm{dedup}}(n)=m\sum_{l}w_{l}\sum_{j=1}^{n}\rho_{l}(j)\geq0 \tag{3}

more bytes. These are the bytes that reuse would save. They are requested bytes, and on-chip caches can serve some requests.

Speculative decoding. A step drafts k∈{0,…,kmax⁡}k \in \{0, \ldots, k_{\max}\} tokens, with kmax⁡k_{\max} the largest draft length allowed. It verifies them with the current token in one pass of k+1k+1 tokens. The case k=0k=0 is plain decoding. With kernel p∈{slot,dedup}p \in \{slot, dedup\} the step requests D+Ep(k+1)+kv(k)D + E_p(k+1) + \text{kv}(k) bytes, with kv(k)≥0\text{kv}(k) \geq 0 the key-value cache bytes it reads (Pope et al., 2023). Under geometric acceptance at rate a∈[0,1)a \in [0,1) the drafts are accepted in order, each with probability aa, until the first rejection. A step then emits Ga(k)=1+a+⋯+akG_a(k) = 1 + a + \cdots + a^k tokens on average (Leviathan et al., 2023). We generalize the walltime analysis of Leviathan et al. (2023). The throughput is Ta(k)=Ga(k)/V(k)T_a(k) = G_a(k)/V(k) tokens per second. Here V(k)V(k) is the step time, the wall-clock time of one step that drafts kk tokens and verifies k+1k+1 (Section 3.1 gives its form). The best draft length k∗(a)k^*(a) is the smallest maximizer of TaT_a. So the staircase is a↦k∗(a)a \mapsto k^*(a). Speculation gives a speedup at aa when k∗(a)≥1k^*(a) \geq 1. The jj-th step point aja_j is the infimum of the acceptances a∈[0,1)a \in [0,1) at which k∗(a)≥jk^*(a) \geq j. It is taken as 1 when there is none. Finally, ci=V(i)−V(i−1)c_i = V(i) - V(i-1) is the time that the ii-th draft adds. Appendix A lists every symbol.

Figure

Figure 1: Consecutive-token reuse ρl(n)\rho_l(n), layer mean, on the WikiText-103 fit documents, against the number nn of consecutive tokens. Dotted: independent uniform routing, 1−qn−11 - q^{n-1} (Huang et al., 2025). In every figure, color marks the model: blue OLMoE, green Qwen3, orange gpt-oss and brown DeepSeek-V2-Lite.

References (57)