Manuscript Offprint
arXiv:2610.07780APEX: Speculate smarter, not deeper
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Manvi Jha
University of Illinois Urbana-Champaign
AWS AI
Zach Zhang
AWS AI
Zhichao Xu
AWS AI
Linbo Liu
AWS AI
Sai Muralidhar Jayanthi
AWS AI
Vinayak Arannil
AWS AI
ABSTRACT
Speculative decoding reduces large language model inference latency by drafting multiple tokens before target-model verification, but its effectiveness depends on both the proposal mechanism and draft depth. Fixed configurations cannot respond to changes in predictability, repetition, and acceptance during generation, so deeper drafting can increase wasted computation without proportional speedup. We introduce APEX, a learned controller that balances decoding speed and draft-token waste through request-level expert selection and block-level depth adaptation. APEX-Router selects among EAGLE-3, n-gram, and draft-model speculation for each request, while APEX-Depth adjusts draft length at each verification block using causal decoding signals and recent verifier feedback. APEX models accepted draft length as censored survival feedback, learning position-wise rejection hazards, block execution costs, and an action utility that balances throughput, accepted progress, and wasted tokens. This allows the controller to adapt speculation while retaining the target model's verification procedure. We integrate APEX into vLLM and evaluate it with Qwen3-8B across six workloads, achieving up to speedup over autoregressive decoding. Across the aggregate evaluation, APEX-S achieves speedup, while APEX-B achieves speedup with a 41.0% relative reduction in wasted-token percentage compared with fixed n-gram speculation at , providing distinct operating points for balancing acceleration and draft-token utilization.
1 INTRODUCTION
Large language models (LLMs) increasingly serve interactive and long-form workloads such as code generation, mathematical reasoning, and conversational assistance. In these settings, inference latency is not merely a backend cost, it directly affects user-perceived responsiveness and the feasibility of deploying capable models at scale Kwon et al. (2023b); Agrawal et al. (2024). Yet acceleration must preserve the behavior of the target model. The systems challenge is therefore not simply to generate more tokens per second, but to convert additional computation into verified output progress without changing the target model's generation semantics.
Autoregressive decoding Schuurmans et al. (2024) produces each token conditioned on the preceding prefix. Speculative decoding (SD) Xia et al. (2023) reduces the number of sequential target-model invocations by using a cheaper mechanism to propose multiple tokens, which the target model then verifies. Accepting a long draft prefix allows generation to advance several positions in one verification step. However, an early rejection leaves much of the proposed draft unused. Increasing draft depth consequently offers more potential progress while also increasing the amount of speculative work exposed to rejection. High speedup can coexist with substantial draft-token waste, and low waste can coexist with slow execution. Both wall-clock latency and draft-token utilization are therefore needed to assess the resulting trade-off.
Work was done during an internship at AWS AI.
The proposal mechanism also shapes this trade-off. Learned speculators such as EAGLE-3 Li et al. (2025a) can provide useful drafts when upcoming tokens are predictable. Retrieval-based approaches like n-gram reuse available text He et al. (2024), making inexpensive matching methods attractive when repeated structure is present. A separate draft model can produce plausible continuations across varied inputs, but its execution cost may offset the benefit of accepting additional tokens. These mechanisms therefore differ in both the drafts they produce and the cost of producing them. The same acceptance rate or wasted-token percentage can have different latency consequences across mechanisms.
The value of speculation depends jointly on the proposal mechanism, draft depth, and decoding state. A mechanism that proposes tokens cheaply may still discard a large fraction of its drafts, while a more accurate mechanism may incur enough proposal latency to offset its acceptance gains. Selecting an appropriate mechanism and depth requires accounting for the progress and cost of verification. This motivates our central research question:
The central modeling idea is to treat accepted draft length as censored survival feedback. When a draft is rejected at a particular position, the observation identifies how far it survived verification. When every proposed token is accepted, the observation establishes survival only through the chosen depth; it does not reveal where a longer draft would first be rejected. captures this structure through position-wise rejection hazards, from which it derives survival probabilities and expected accepted length. Runtime prediction complements this model because accepting more tokens does not necessarily produce greater speedup when drafting or verification costs also increase.
1.1 CONTRIBUTIONS
Our work makes the following contributions:
-
Empirical characterization of speculative speed and waste. We examine how proposal mechanisms and draft depths behave across workloads, entropy, repetition, and execution costs. The analysis identifies conditions in which deeper speculation increases waste without proportional acceleration and motivates control using decoding-state information.
-
Hierarchical control of heterogeneous speculators. We introduce , which coordinates request-level selection among EAGLE-3, n-gram, and draft-model speculation with block-level depth adaptation. This structure combines mechanism selection with finer-grained responses to changing verifier feedback.
-
A survival-based model of draft acceptance. We formulate accepted draft length using position-wise rejection hazards and a likelihood that handles both early rejection and fully accepted, right-censored blocks. Joint prediction of acceptance behavior and runtime provides supervision for learning the value of different depths.
-
Trace-supervised learning of action utility. We construct utility targets from observed throughput, accepted progress, draft-token waste, and regret relative to observed alternatives. Multi-task prediction and candidate-ranking losses train the controller to select depths using features available at inference time.
-
System integration and detailed evaluation. We integrate into vLLM and evaluate it with Qwen3-8B across six workloads, including component ablations and candidate-depth sensitivity analysis. -S achieves up to wall-clock speedup over autoregressive decoding and an aggregate speedup of . -B achieves an aggre-gate speedup of while reducing the mean wasted-token percentage from 79.90% to 47.17% relative to fixed n-gram speculation at , a relative reduction of 41.0%.
2 BACKGROUND AND RELATED WORK
2.1 AUTOREGRESSIVE DECODING
Let denote the target language model. Given a prompt or prefix , autoregressive decoding Schuurmans et al. (2024) generates one token at a time according to . The newly generated token is appended to the prefix and the process repeats until a stopping condition is reached. This decoding procedure preserves the target model's generation semantics, but it introduces a strict sequential dependency: producing output tokens requires target-model decoding steps. For large models, each step requires loading and applying the target network to the current prefix, making decoding latency scale directly with output length.
This sequential structure is especially costly for long-form generation settings such as code synthesis, multi-step reasoning, long-context completion, and software engineering tasks. The goal of inference acceleration is therefore not merely to reduce computation, but to reduce the number or cost of sequential target-model invocations while preserving the output distribution or verification semantics of the target model.
SD accelerates autoregressive generation by separating token proposal from target-model verification Xia et al. (2023); Leviathan et al. (2023); Chen et al. (2023). A cheaper proposal mechanism q first drafts a block of k candidate tokens, , and the target model verifies the proposed block in parallel. If multiple draft tokens are accepted, generation advances by more than one token using a single target-model verification step.
The efficiency of this procedure depends on how many proposed tokens survive verification. Let denote the accepted draft length at block , and let denote the first rejection position, with the event corresponding to full acceptance of the draft block. If rejection occurs early, all remaining draft tokens after the first rejected token are discarded. Thus, the useful progress of a speculative block is not the proposed depth , but the accepted length .
This observation makes SD a cost-sensitive procedure. A larger increases the maximum possible progress per verifier call, but it also increases the amount of draft work that can be wasted after early rejection. The relevant quantity for efficient serving is therefore accepted progress per unit cost:
where m denotes the speculative mechanism and denotes the block-level proposal and verification cost. A speculative configuration is profitable only when the accepted progress outweighs the extra drafting and verification overhead.
2.2 SPECULATIVE MECHANISMS
Early SD methods use an auxiliary draft model to propose tokens for target-model verification (Xia et al., 2023; Leviathan et al., 2023). Followup works improve drafting through knowledge distillation, specialized architectures, or objectives aligned with target-model acceptance (Bhansali & Heck, 2025; Zou et al., 2026). Improving an individual proposal mechanism does not by itself determine when that mechanism is preferable to alternatives with different proposal costs and acceptance behavior. A fixed choice can therefore retain a costly or poorly matched speculative path even when another mechanism offers a more favorable speed–waste trade-off.
A second line of work reduces reliance on separate draft models. Medusa adds decoding heads to the target model for parallel verification of tree-structured continuations (Cai et al., 2024), while SpecInfer constructs token trees for parallel candidate verification (Miao et al., 2024). EAGLE-style methods instead use target-model hidden states to build lightweight neural speculators (Li et al., 2025b;a). Their gains, however, still depend on proposal survival and cost.
A third class uses retrieval or surface repetition instead of neural drafting. N-gram and suffix-based methods copy continuations from the prompt, generated prefix, or external text, making them cheap
| N-gram | Draft model | EAGLE-3 | |
|---|---|---|---|
| Code generation | |||
| Conversational | |||
| Long-chain reasoning | |||
| Long-context completion | |||
| SWE | |||
| Mathematical reasoning |
Speedup vs. autoregressive decoding
Figure 1: Speedup over autoregressive decoding across six workloads and three speculative mechanisms. Each cell reports highest speedup and its depth ; boxes mark the best method per workload.
and effective in repetitive regimes but brittle on novel continuations (Hu et al., 2024). This creates a complementary tradeoff: neural speculators can better model semantic continuation, while retrieval-based speculators can be faster when repeated structure is available.
APEX is orthogonal to these mechanisms; it treats mechanisms like EAGLE-3, n-gram, and draft-model speculation as candidate experts and learns which of them to use and how deeply to speculate in each decoding state. APEX can thus choose among mechanisms with different proposal costs and acceptance behavior while retaining their existing proposal and verification algorithms.
2.3 ADAPTIVE SPECULATIVE DECODING
Dynamic Speculation Lookahead shows that using the same speculation lookahead for all decoding iterations is suboptimal and proposes dynamically selecting the number of draft tokens during generation (Mamou et al., 2024). AdaEAGLE (Zhang et al., 2024) explicitly models adaptive draft structures and uses a lightweight draft length predictor to choose the number of draft tokens for EAGLE-style speculation. BanditSpec (Hou et al., 2025) formulates speculative hyperparameter selection as a multi-armed bandit problem and adapts the configuration online without training a controller. DSDE (Yang et al., 2025) studies dynamic speculation length in serving settings using KLD-based stability signals and adaptive caps. Production systems such as vLLM also support dynamic SD through manually specified schedules that map concurrency or batch-size ranges to a chosen number of speculative tokens (Kwon et al., 2023a).
These studies show that a single fixed depth can limit inference acceleration as acceptance behavior and serving conditions change. They motivate a broader control problem: selecting a proposal mechanism together with depths that balance verified progress, runtime, and draft-token waste. APEX addresses this problem through request-level expert selection and block-level depth adaptation, using learned rejection hazards and runtime signals to score candidate depths.
2.4 SPECULATIVE DECODING
3 EMPIRICAL MOTIVATION: FIXED SPECULATION IS NOT ENOUGH
We examine how the proposal mechanism and draft depth affect acceleration and draft-token waste. Using Qwen3-8B in vLLM, we compare autoregressive decoding with EAGLE-3, n-gram, and draft-model speculation across code generation, mathematical reasoning, long-context completion, long-chain reasoning, conversational generation, and SWE-style tasks. Workload details and full evaluation results appear in Section 5.
Speculative performance depends on the workload and mechanism. Figure 1 summarizes the highest observed speedups in the characterization set, illustrating workload-dependent differences

(a) Acceptance and speedup
(b) Entropy–repetition vs speedup
Figure 2: Online signals associated with SD performance (a) Median speedup over autoregressive decoding versus acceptance rate, with shaded variability. (b) Median speedup versus token entropy and repetition density; the gray plane marks autoregressive performance.
between mechanisms. These peak results are distinct from the aggregate averages reported on a separate evaluation set in Table 1. Figure 2a further shows that acceptance alone does not determine acceleration: draft-model speculation remains near or below autoregressive performance in the plotted median results, even at relatively high acceptance rates, while the other mechanisms achieve substantial speedup. This motivates considering execution cost alongside acceptance when selecting a speculative mechanism.
Greater depth does not guarantee a better speed–waste trade-off. The aggregate sweep in Table 1 shows contrasting responses to deeper speculation. Increasing n-gram depth from to raises mean speedup from to , while mean waste increases from 63.56% to 79.90%. For EAGLE-3, increasing depth from to reduces mean speedup from to and raises mean waste from 66.25% to 97.67%. Deeper drafting therefore offers a modest speed gain at substantially higher waste in one case and worsens both metrics in the other. These responses motivate depth selection that accounts for the active mechanism and expected verification outcome.
Observable decoding signals can inform control. Figure 2b relates median speedup to token entropy and repetition density. Performance varies across these conditions, and the patterns differ between mechanisms. These associations motivate using entropy and repetition as controller inputs alongside recent verifier feedback. Prefix statistics describe the context in which a draft is proposed, while verifier history records how well recent drafts have performed. Both can be obtained from information available during decoding, allowing adaptation without requiring workload labels at inference time.
Verifier feedback reveals where drafts fail. For a draft of length k, first rejection at position r leaves r - 1 accepted draft tokens and discarded draft tokens. Full acceptance provides a different observation: the draft survives through depth k, but the outcome of extending it further remains unknown. Verifier feedback thus contains both observed rejection events and right-censored full-acceptance events. This structure motivates modeling position-wise rejection hazards, which describe how acceptance can change with depth and provide supervision for adaptive speculative control.
4 APEX: BREATHING ADAPTIVITY INTO STATIC SPECULATION
We propose APEX, a learned online controller that selects a proposal mechanism and initial depth at request granularity and adjusts speculation depth at block granularity. Its learned utility balances throughput and accepted progress against discarded draft tokens. APEX operates at two coupled timescales. APEX-Router selects a speculative expert (EAGLE-3, n-gram, or draft-model speculation) and its initial depth for each request, while APEX-Depth adapts depth k at the block level. This sepa-
APEX: Adaptive Planning and Execution for Speculative Decoding

Figure 3: APEX overview. The router selects a speculative expert and initial depth from prompt features. After each verifier block, the depth controller uses the updated decoding state and prior verifier feedback to select the next depth. Observed acceptance and runtime update the controller state; network parameters remain fixed during inference.
ration reflects systems constraints: expert selection affects model placement, batching, and worker routing, whereas depth can change more frequently within the selected path.
Figure 3 summarizes the framework. We first define the decoding state and request-level routing decision, then formulate accepted draft length as censored survival feedback. This formulation provides the acceptance model used by APEX-Depth, which learns acceptance, runtime, and utility predictions from a shared representation.
4.1 PROBLEM FORMULATION AND STATE REPRESENTATION
Let denote the target language model and let denote a proposal mechanism, where
We index verifier blocks by and denote the prefix available before block by . Given this prefix, mechanism proposes a draft block of length according to , its induced proposal distribution. The target model then verifies the draft block. Let be the number of accepted draft tokens. If , the full block is accepted; if , the verifier rejects at position . We define the discarded draft-token count and waste fraction as
Here, includes the first rejected token and the discarded suffix, and is the fraction of drafted tokens that are not accepted. Since measures token utilization rather than wasted computation, we measure latency separately to assess the speed–waste trade-off.
Let denote block- wall-clock latency, including drafting and verification, and the executed action's throughput. uses these observations to learn a block-level utility balancing accepted progress, runtime, and speculative waste. In our experiments, , and candidate depths form a finite set .
Request-level state The request-level state contains the information available before generation begins:
Here, is a fixed-dimensional prompt embedding, is the prompt length, contains repetition and lexical-structure features, contains entropy or token-distribution features, and contains decoding configuration variables such as temperature and maximum generation length.
Block-level state The block-level state contains information available before verifier block t:
Here, denotes generation progress, summarizes verifier feedback from blocks , and contains statistics computed from the current prefix . We supply the active mechanism and candidate depth separately when constructing state-action features.
The history vector includes the number of observed verifier blocks, rolling mean and variance of accepted length, first-rejection position statistics, full-acceptance rate, rejection rate, mean rejected-token count, and short-window summaries over the most recent verifier blocks. The prefix vector includes entropy and repetition features. These features are causal: the current block outcome is never used to predict the current block.
4.2 APEX-ROUTER
APEX-Router jointly selects the speculative expert and initial depth expected to provide the best speed-cost trade-off for each request before generation. It scores initial actions , where is the speculative mechanism and is the initial depth. Let denote the admissible initial actions. Using the pre-generation state , it predicts
where combines the request features with the candidate method and initial depth, and is a neural scoring function. The selected action is
The router is trained from completed request-level traces rather than workload labels. Each observed request–method–initial-depth combination supplies a training example:
where is the initial state of request and is its empirical request-level utility label. The observed label provides offline supervision for the predicted score . The resulting acceptance, latency, and waste are execution outcomes; they are not inputs available when routing a new request.
At inference, the router scores each admissible method–initial-depth pair using only and the candidate action. The selected action determines the speculative decoding path and initializes its depth. The mechanism remains fixed for the request, the first block uses , and controls subsequent depths.
Once the expert is selected, the depth decision depends on how its drafts survive verification as generation evolves. We next formulate this acceptance feedback before describing the depth controller.
4.3 ACCEPTANCE AS CENSORED SURVIVAL FEEDBACK
The accepted length of a speculative block contains more information than an aggregate acceptance rate. A partially accepted block identifies the first rejected position, while a fully accepted block establishes only that rejection did not occur within the executed depth. models these two outcomes using a discrete survival formulation.
For a candidate depth , define as the first rejected draft position using one-indexed positions. Thus, means the first draft tokens were accepted and the -th draft token was rejected. If the entire block is accepted, then . The accepted length is
Position-wise rejection hazards. For each position , the model predicts a discrete hazard:
where denotes the parameters of the depth controller. This is the conditional probability of rejection at position j, given that all preceding draft tokens have been accepted.
The probability that the first j draft tokens survive is
The expected accepted length follows as
using the identity .
Accepted-length likelihood. If the observed accepted length is , the first rejected position is . The likelihood is therefore
The empty product equals one when . If , the entire block is accepted and the rejection position is right-censored beyond :
This observation contributes evidence of survival through position k without imposing a rejection at position .
The survival loss over N training blocks is
This objective trains the controller to capture the first-rejection structure of SD. Acceptance prediction is then combined with runtime and utility supervision, since accepted length alone does not determine the efficiency of a candidate depth.
4.4 APEX-DEPTH
APEX-Depth adapts speculation depth to balance accepted progress, latency, and draft-token waste. Its operation begins with the speculative method and initial depth selected by APEX-Router. Before each subsequent block, it observes the causal state , evaluates the candidate depths, and selects the depth with the highest predicted utility.
Shared representation For each candidate depth , the controller constructs
Here, standardizes numerical features, embeds categorical variables, and appends the prompt representation. The shared encoder therefore evaluates each depth in the context of the current generation state.
Four prediction heads receive . Each head is a task-specific output branch of the same network: the survival, cost, and throughput heads predict execution outcomes, while the utility head predicts the action score used for depth selection.
Survival head The survival head outputs a vector of conditional rejection probabilities:
Its -th entry is the hazard defined in Equation equation 9. The first entries determine the survival curve and expected accepted length through Equations equation 10–equation 11. This head is trained with the censored likelihood in Section 4.3, allowing fully accepted and partially rejected blocks to provide appropriate supervision.
Cost head The cost head predicts the wall-clock cost of executing the candidate block, including drafting and verification. Its scalar output is the predicted log latency:
This head provides runtime supervision because a candidate depth can accept many tokens but still be slow when proposal or verification overhead is high.
Throughput head The throughput head predicts the rate of output progress achieved by the candidate action. Its scalar output is
Where the cost head models elapsed time, the throughput head models the observed progress rate. Their targets are obtained from measured execution traces, and their regression losses are defined in Section 4.6.
Utility head The utility head predicts the final learned action value:
The hatted quantity is a network prediction made before the candidate block executes. During training, it is fitted to an observed scalar label computed from execution outcomes, as defined in Equation equation 25. The utility-regression loss in Equation equation 28 directly connects this prediction to its label, while the ranking loss supervises candidate ordering. The other three heads ground the shared representation in measurable outcomes.
Select, execute, and update The controller chooses the highest-scoring candidate:
The utility head supplies the deployed selection score; the other heads support it through shared training. The chosen speculative block is then executed, and its observed outcomes update the state for the next decision. This allows depth to respond to changes in acceptance behavior and execution cost throughout generation.
4.5 TRACE-DERIVED TRAINING TARGETS
We train from offline collected speculative decoding traces. Each depth-controller training example corresponds to an observed verifier block under a particular state-action pair:
The input contains only information available before executing the block, while the targets contain the outcomes observed after verification. Accepted length supervises the survival head, latency and throughput supervise the runtime heads, and the following utility target supervises the utility head. We use lowercase u for observed utility labels and hatted for their learned predictions.
Dataset-derived regret targets The trace dataset provides offline comparisons among speculative configurations. For a request , let denote the set of method-depth actions observed in the dataset, and let denote the recorded request-level throughput under action . We define the best observed global throughput as
(21) and the best observed throughput within a fixed mechanism as
For a training block belonging to request , the global and same-method regret terms are
where . These normalized penalties compare block throughput with the best observed request-level reference throughputs. The global term accounts for alternatives across mechanisms and depths, while the same-method term accounts for depth choices within the active mechanism. Both terms are used only to construct training targets and are not required during inference.
Block-level utility For each observed training block, the depth-utility label is
where keeps the accepted-length term finite when . This is the trace-derived label for the executed action ; is the network's prediction of that label.
The utility combines speed, accepted progress, waste, and offline regret. High accepted length is useful only if the resulting progress justifies its runtime, while low waste is useful only if the system still makes enough progress per verifier call. The coefficients allow different training preferences for this speed–waste trade-off.
4.6 TRAINING OBJECTIVE FOR APEX-DEPTH
The network is multi-task by design. The survival loss in Equation equation 14 supervises the rejection hazards. The cost and throughput losses supervise runtime predictions, while utility regression and candidate ranking train the score used for depth selection.
Cost and throughput losses Using the observed action for each training block, we train the cost head with
where is the SmoothL1 loss. The throughput head is trained with
Utility regression The utility head is trained by comparing its prediction for each observed state-action pair with the corresponding trace-derived label:
Thus, the same predicted score used to select depths at inference is directly supervised during training.
Candidate ranking Deployment depends on the ordering of candidate depths, as well as the accuracy of their predicted utilities. We therefore group observed candidate rows by prompt, speculative method, and block index. For a group , let denote the depths present, and let denote the observed utility label at depth . Writing for that row's pre-block state and for the group's method, its predicted score is
The preferred depth is
The ranking loss is
where G is the set of rank groups. This term encourages the depth with the highest observed training utility in each group to receive the highest predicted score.
Combined objective The depth controller is trained with
In our implementation, the default loss weights are
4.7 APEX VARIANTS
We train three APEX variants with identical architectures, features, candidate-depth interfaces, data, and deployment procedures; only the utility weights in Equation equation 25 differ, producing distinct speed–waste operating points.
APEX-S (Speed) uses and places greater relative emphasis on throughput competitiveness. The default APEX-B (Balanced) uses to balance throughput, accepted progress, and waste. APEX-E (Efficient) uses and assigns a larger penalty to waste. These weights specify training preferences; they do not guarantee that every profile is Pareto-efficient or that APEX-E always has the lowest waste. Additional ablations are reported in Section 5.3.
4.8 ONLINE DEPLOYMENT
At inference, the router selects the speculative expert and initial depth . After each verifier block, updates its causal state with observed outcomes, scores every candidate depth in , and selects the next block's depth. The controller adapts its actions using the evolving state; its network parameters remain fixed during generation.
Algorithm 1 summarizes this procedure. Here, SpeculateAndVerify drafts a block using the selected mechanism, applies target-model verification, and records the execution outcomes. It returns the emitted output and observations . The output extends the prefix, while the observations update the history used for the next decision.
5 RESULTS AND DISCUSSION
We evaluate whether APEX can maintain substantial inference acceleration while reducing discarded draft tokens relative to fixed speculative configurations. We first examine aggregate performance and workload-specific trade-offs, then study the contributions of individual controller components and the sensitivity to the candidate-depth set.
5.1 EXPERIMENTAL SETUP
Target model and serving system We implement APEX in vLLM with Qwen3-8B as the target verifier. All evaluated methods use the same target model, allowing us to compare the acceleration and draft-token utilization achieved by different proposal mechanisms, fixed depths, and adaptive controller profiles.
Algorithm 1 APEX Online Speculative Decoding
Require: Prompt , decoding configuration , target model , initial actions , depths
1:
2:
3:
4: for until generation completes do
5:
6:
7: if then
8:
9: else
10:
11: end if
12:
13:
14:
15: end for
16: return
Table 1: Overall decoding performance. APEX is compared against autoregressive decoding and fixed speculative baselines. Higher speedup is better; lower wasted-token percentage is better.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | 64.71% | 2.64 | ||
| 66.25% | 3.55 | |||
| 87.11% | 2.23 | |||
| 97.67% | 1.41 | |||
| n-gram SD | 54.56% | 3.23 | ||
| 54.14% | 5.16 | |||
| 63.56% | 5.64 | |||
| 79.90% | 5.28 | |||
| Draft-SD | 27.82% | 3.44 | ||
| 38.39% | 2.26 | |||
| 52.46% | 1.39 | |||
| 68.98% | 0.72 | |||
| APEX-S | adaptive | 55.30% | 7.73 | |
| APEX-B | adaptive | 47.17% | 6.93 | |
| APEX-E | adaptive | 63.69% | 2.87 |
Workloads and datasets We evaluate six workloads: code generation using MBPP (Austin et al., 2021) and HumanEval (Chen & et al., 2021); conversational generation using UltraChat-200k (Ding et al., 2023); long-chain reasoning using GPQA (Rein et al., 2023); long-context completion using The Stack Smol (Kocetkov et al., 2022); software engineering using SWE-bench Lite (Jimenez et al., 2024); and mathematical reasoning using GSM8K (Cobbe et al., 2021) and AIME-style data (Mathematical Association of America, 1983). We follow the dataset-provided splits for training and evaluation.
Baselines and operating profiles We compare APEX with autoregressive decoding and fixed-depth EAGLE-3, n-gram, and draft-model speculation (Draft-SD). The fixed-depth sweep considers . We evaluate all three APEX operating profiles: APEX-S, APEX-B, and APEX-E.

Figure 4: Speedup vs Token Wastage. The plot shows the trend of Speedup (vs AR) vs Token Wastage across different depths and mechanisms. The horizontal axis reports non-wasted draft tokens (100 – Waste%), and the vertical axis reports speedup over autoregressive decoding.
Metrics We measure wall-clock latency speedup relative to autoregressive decoding as
Values above one indicate lower end-to-end latency. We also report wasted draft-token percentage,
which measures the fraction of proposed tokens discarded during speculation.
To summarize the speed–waste trade-off, we report Waste-Amortized Speedup (WAS):
Speedup and waste are averaged over the evaluated requests, and WAS is computed from the corresponding unrounded averages. Higher WAS is better, but we interpret it alongside latency speedup and waste to retain the distinction between these outcomes. A configuration is Pareto-efficient if no alternative is at least as fast and no more wasteful, with a strict improvement in at least one metric.
5.2 OVERALL RESULTS
Table 1 reports aggregate performance, and Figure 4 visualizes the same measurements as speedup versus the percentage of non-wasted draft tokens. APEX-S achieves the highest reported aggregate speedup of with 55.30% waste. The fastest fixed baseline, n-gram speculation at , reaches speedup with 79.90% waste. Thus, APEX-S slightly improves the reported speedup while reducing the wasted-token percentage by 30.8% relative to this baseline.
APEX-B provides a different operating point, achieving speedup with 47.17% waste. Relative to n-gram speculation at , this corresponds to a 41.0% reduction in the wasted-token percentage, at the cost of lower acceleration. APEX-S and APEX-B obtain the highest aggregate WAS values of 7.73 and 6.93, respectively, compared with the best fixed-baseline WAS of 5.64 from n-gram speculation at .
The fixed baselines illustrate why speed and waste must be considered jointly. Increasing n-gram depth from to raises speedup from to , but increases waste from 63.56% to 79.90%, reducing WAS from 5.64 to 5.28. EAGLE-3 reaches its highest aggregate speedup at ; increasing its depth to reduces speedup from to while raising waste
Table 2: Workload-level speed–waste comparison for code generation.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | 44.50% | 4.74 | ||
| 55.50% | 5.01 | |||
| 87.38% | 2.30 | |||
| 98.31% | 1.29 | |||
| n-gram SD | 46.00% | 4.52 | ||
| 67.25% | 3.43 | |||
| 69.13% | 5.02 | |||
| 79.69% | 5.33 | |||
| Draft-SD | 22.06% | 4.53 | ||
| 33.74% | 2.67 | |||
| 51.88% | 1.37 | |||
| 69.30% | 0.71 | |||
| APEX-S | adaptive | 76.00% | 3.68 | |
| APEX-B | adaptive | 56.83% | 3.50 | |
| APEX-E | adaptive | 75.50% | 1.31 |
Table 3: Workload-level speed–waste comparison for mathematical reasoning.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | 72.50% | 2.14 | ||
| 62.50% | 4.00 | |||
| 72.25% | 4.46 | |||
| 93.44% | 2.19 | |||
| n-gram SD | 55.50% | 3.41 | ||
| 53.75% | 5.30 | |||
| 60.62% | 6.84 | |||
| 82.88% | 4.51 | |||
| Draft-SD | 28.22% | 3.51 | ||
| 41.46% | 2.07 | |||
| 59.84% | 1.10 | |||
| 75.66% | 0.57 | |||
| APEX-S | adaptive | 47.00% | 11.15 | |
| APEX-B | adaptive | 44.00% | 11.72 | |
| APEX-E | adaptive | 72.90% | 3.33 |
from 66.25% to 97.67%. Conversely, Draft-SD at has only 27.82% waste but achieves 0.96× speedup. Efficient draft-token utilization alone therefore does not ensure lower end-to-end latency.
The three learned profiles also require separate evaluation. APEX-E achieves 1.83× speedup with 63.69% waste and is outperformed by both APEX-S and APEX-B on both metrics. Its efficiency-oriented objective does not produce the lowest aggregate waste, highlighting the importance of evaluating the realized behavior of each profile across workloads.
5.3 PERFORMANCE ACROSS WORKLOADS
The workload-level results reveal where adaptive control improves both speed and utilization, where it offers a trade-off, and where a fixed configuration remains preferable.
Mathematical reasoning. Table 3 shows the strongest acceleration achieved by APEX. APEX-S reaches 5.24× speedup with 47.00% waste, while APEX-B achieves 5.16× speedup with 44.00% waste. Both improve speed and reduce waste relative to the fastest fixed baseline, n-gram speculation
Table 4: Workload-level speed-waste comparison for long-context completion.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | ||||
| n-gram SD | ||||
| Draft-SD | ||||
| APEX-S | adaptive | |||
| APEX-B | adaptive | |||
| APEX-E | adaptive |
Table 5: Workload-level speed-waste comparison for long-chain reasoning.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | ||||
| n-gram SD | ||||
| Draft-SD | ||||
| APEX-S | adaptive | |||
| APEX-B | adaptive | |||
| APEX-E | adaptive |
at , which achieves speedup with waste. APEX-B obtains the highest WAS of 11.72, retaining nearly the acceleration of APEX-S while discarding fewer draft tokens.
Conversational generation. A similar improvement appears in Table 6. APEX-S achieves speedup with waste, compared with and for n-gram speculation at . APEX-B reduces waste further to while achieving speedup. Increasing the fixed n-gram depth to worsens both speed and waste, showing that deeper speculation is not uniformly beneficial even within a workload where n-gram proposals are effective.
Long-context completion. Table 4 presents a different trade-off. N-gram speculation at remains the fastest configuration at speedup with waste. APEX-S achieves speedup while reducing waste to , yielding a higher WAS of 10.18 versus 9.66. This benefit does not extend to every learned profile: n-gram speculation at is both faster and less wasteful than APEX-B and APEX-E.
Table 6: Workload-level speed–waste comparison for conversational generation.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | ||||
| n-gram SD | ||||
| Draft-SD | ||||
| APEX-S | adaptive | |||
| APEX-B | adaptive | |||
| APEX-E | adaptive |
Table 7: Workload-level speed–waste comparison for swe-style tasks.
| Method | Depth | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|
| EAGLE-3 | ||||
| n-gram SD | ||||
| Draft-SD | ||||
| APEX-S | adaptive | |||
| APEX-B | adaptive | |||
| APEX-E | adaptive |
Long-chain reasoning. In Table 5, n-gram speculation at achieves the highest speedup of but wastes of drafted tokens. APEX-B achieves speedup with waste, obtaining the highest WAS of 7.56. Here, adaptive control offers substantially better draft-token utilization while retaining acceleration over autoregressive decoding.
Software-engineering tasks. Table 7 shows that APEX-S achieves speedup with waste. N-gram speculation at is faster at , but its waste rises to . APEX-S consequently achieves the highest WAS of 6.55, compared with 5.17 for that baseline. It also achieves both higher speedup and lower waste than APEX-B and APEX-E on this workload.
Code generation. Code generation exposes a limitation of the learned controller (Table 2). N-gram speculation at achieves speedup and a WAS of 5.33, exceeding all three APEX profiles on these metrics. The limitation also appears in direct speed–waste comparisons: n-gram speculation at is both faster and less wasteful than APEX-S, while EAGLE-3 at is both
Table 8: Ablation study across operating profiles. Each variant removes one component from the corresponding full APEX controller. Speedup is measured relative to autoregressive decoding AR=1.00×
| Profile | Variant | Speedup | Waste % | WAS |
|---|---|---|---|---|
| APEX-S | Full APEX-S | |||
| w/o survival loss | ||||
| w/o cost/TPS objective | ||||
| w/o entropy features | ||||
| w/o repetition features | ||||
| w/o verifier-history features | ||||
| APEX-E | Full APEX-E | |||
| w/o survival loss | ||||
| w/o cost/TPS objective | ||||
| w/o entropy features | ||||
| w/o repetition features | ||||
| w/o verifier-history features | ||||
| APEX-B | Full APEX-B | |||
| w/o survival loss | ||||
| w/o cost/TPS objective | ||||
| w/o entropy features | ||||
| w/o repetition features | ||||
| w/o verifier-history features |
Table 9: APEX candidate- sweep under the quality-balanced operating profile. Higher speedup and WAS are better; lower wasted-token percentage is better.
| Method | Candidate set | Mean | Speedup vs. AR | Wasted Token % | WAS |
|---|---|---|---|---|---|
| APEX-S | |||||
| APEX-B | |||||
| APEX-E | |||||
faster and less wasteful than APEX-B. These results identify code generation as a setting where improved routing and utility calibration are needed.
5.4 ABLATION STUDY
We examine the contributions of survival supervision, cost and throughput supervision, and decoding-state features in Table 8. This study uses a smaller diagnostic subset containing twenty requests from each of the six workloads, for a total of 120 requests. All variants are evaluated on the same requests under the same serving configuration. Ablation effects are measured relative to the corresponding full controller on this subset; the absolute values therefore differ from the main evaluation.
Full-controller profiles. Among the full controllers, APEX-S achieves the highest speedup of with waste. APEX-B achieves speedup with waste, while APEX-E achieves speedup with waste and the highest WAS of 4.43. The profile ordering differs from the aggregate evaluation, further illustrating its dependence on the evaluated requests.
Survival supervision. Removing the survival loss produces the largest increase in waste among the examined ablations for all three profiles. Waste rises to 67.62%–69.38%, speedup falls to 1.53×–1.62×, and WAS decreases to 2.21–2.37. These results support the role of first-rejection survival supervision in selecting depths that convert drafted tokens into accepted progress.
Cost and throughput supervision. Removing the cost/TPS objective causes smaller speed reductions but consistently increases waste and lowers WAS. For APEX-B, waste increases from 54.62% to 57.83%, while WAS decreases from 4.39 to 4.03. The results support accounting for runtime cost alongside acceptance behavior when comparing candidate actions.
Entropy and repetition features. Removing either feature group increases waste and reduces WAS across all three profiles. The effect on raw speedup is smaller and is not uniformly negative. For example, removing entropy features from APEX-S increases speedup from to , but also increases waste from 59.22% to 62.41%, lowering WAS from 4.12 to 3.99. These features therefore contribute primarily to the observed speed–waste balance.
Verifier-history features. Removing recent verifier feedback produces the largest speed reductions, with speedup falling to and WAS to 2.03–2.32. For APEX-S, waste actually decreases from 59.22% to 54.74%, but speedup falls from to . This illustrates why lower waste alone is insufficient and supports using recent acceptance and rejection outcomes to guide block-level decisions.
5.5 SENSITIVITY TO CANDIDATE DEPTHS
Table 9 reports a separate comparison of three candidate-depth sets across all profiles: , , and . The dense set permits fine-grained choices, the deep set removes the two shallowest actions, and the sparse set reduces the number of available depths.
Removing shallow actions increases the mean selected depth and slightly improves speedup across all three profiles, but also increases waste and reduces WAS. For APEX-B, moving from the dense to the deep set raises speedup from to , while waste increases from 42.76% to 48.55% and WAS decreases from 7.60 to 6.89. Shallow actions therefore contribute to controlling waste even when excluding them produces a modest speed gain.
The sparse set provides an intermediate operating point. For APEX-S, it achieves speedup with 47.95% waste, compared with and 47.18% for the dense set. Their WAS values are nearly identical at 7.06 and 7.07. APEX-B and APEX-E also retain acceleration under the sparse set, although their WAS values remain below those obtained with the dense set. These results show that fine-grained depth choices are not equally important for every profile, while access to shallow actions consistently improves the measured speed–waste balance in this study.
5.6 Discussion
The results support adaptive speculative control while establishing its workload-dependent limits. APEX-S provides the highest aggregate speedup, and APEX-B offers lower aggregate waste at reduced acceleration. Mathematical reasoning and conversational generation show simultaneous improvements over the fastest fixed baselines, while other workloads expose trade-offs or favor fixed configurations. The ablations support combining survival supervision, runtime-cost supervision, and recent verifier feedback. Together, these findings motivate evaluating speculative controllers through both latency and draft-token utilization, with profile selection guided by the workload and the desired operating point.
6 CONCLUSION AND FUTURE WORK
APEX combines request-level speculator selection with block-level depth adaptation to balance decoding speed and draft-token waste. Its learned controller provides a modular way to coordinate heterogeneous proposal mechanisms while preserving target-model verification. The results demon-strate substantial acceleration with lower waste than aggressive fixed-depth configurations, with trade-offs that vary across workloads.
Future work will use traces collected during decoding to update the controller online as workloads and execution conditions change. We also plan to evaluate beyond single-turn prompts, including multi-turn conversations, reinforcement-learning rollouts, and tool-augmented generation. These settings would test how well the controller responds to changes in context and generation patterns over successive steps. To expand beyond the current three speculative methods, we plan to add a common interface for new speculators and their execution traces. The router and depth controller could then be retrained on these traces to incorporate the additional methods.
REFERENCES
Amey Agrawal et al. Taming throughput-latency tradeoff in llm inference with sarathi-serve. In 18th USENIX Symposium on Operating Systems Design and Implementation (OSDI), 2024.
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Jiang Ellen, Carrie J Cai, Michael Terry, Quoc V Le, and Charles Sutton. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
Shrenik Bhansali and Larry Heck. Draft, verify, and improve: Toward training-aware speculative decoding, 2025. URL https://arxiv.org/abs/2510.05421.
Tianle Cai, Yuhong Li, Zhengyang Geng, Hongwu Peng, Jason D. Lee, Deming Chen, and Tri Dao. Medusa: Simple llm inference acceleration framework with multiple decoding heads, 2024. URL https://arxiv.org/abs/2401.10774.
Charlie Chen, Sebastian Borgeaud, Geoffrey Irving, Jean-Baptiste Lespiau, Laurent Sifre, and John Jumper. Accelerating large language model decoding with speculative sampling, 2023. URL https://arxiv.org/abs/2302.01318.
Mark Chen and et al. Evaluating large language models trained on code, 2021.
Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems, 2021.
Ning Ding, Yulin Chen, Bokai Xu, Yujia Qin, Zhi Zheng, Shengding Hu, Zhiyuan Liu, Maosong Sun, and Bowen Zhou. Enhancing chat language models by scaling high-quality instructional conversations, 2023. URL https://arxiv.org/abs/2305.14233.
Zhenyu He, Zexuan Zhong, Tianle Cai, Jason D. Lee, and Di He. Rest: Retrieval-based speculative decoding, 2024. URL https://arxiv.org/abs/2311.08252.
Yunlong Hou, Fengzhuo Zhang, Cunxiao Du, Xuan Zhang, Jiachun Pan, Tianyu Pang, Chao Du, Vincent Y. F. Tan, and Zhuoran Yang. Banditspec: Adaptive speculative decoding via bandit algorithms, 2025. URL https://arxiv.org/abs/2505.15141.
Yuxuan Hu, Ke Wang, Xiaokang Zhang, Fanjin Zhang, Cuiping Li, Hong Chen, and Jing Zhang. Sam decoding: Speculative decoding via suffix automaton, 2024. URL https://arxiv.org/abs/2411.10666.
Carlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik R Narasimhan. SWE-bench: Can language models resolve real-world github issues? In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=VTF8yNQM66.
Denis Kocetkov, Raymond Li, Loubna Ben Allal, Jia Li, Chenghao Mou, Carlos Muñoz Ferrandis, Yacine Jernite, Margaret Mitchell, Sean Hughes, Thomas Wolf, Dzmitry Bahdanau, Leandro von Werra, and Harm de Vries. The stack: 3 tb of permissively licensed source code. ArXiv, abs/2211.15533, 2022. URL https://api.semanticscholar.org/CorpusID:254044610.
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with pagedattention, 2023a. URL https://arxiv.org/abs/2309.06180.
Woosuk Kwon, Zhuohan Li, Siyuan Zhuang, Ying Sheng, Lianmin Zheng, Cody Hao Yu, Joseph E. Gonzalez, Hao Zhang, and Ion Stoica. Efficient memory management for large language model serving with pagedattention. In Proceedings of the 29th Symposium on Operating Systems Principles (SOSP), pp. 611–626. ACM, 2023b.
Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast inference from transformers via speculative decoding, 2023. URL https://arxiv.org/abs/2211.17192.
Yuhui Li, Fangyun Wei, Chao Zhang, and Hongyang Zhang. Eagle-3: Scaling up inference acceleration of large language models via training-time test, 2025a. URL https://arxiv.org/abs/2503.01840.
Yuhui Li, Fangyun Wei, Chao Zhang, and Hongyang Zhang. Eagle: Speculative sampling requires rethinking feature uncertainty, 2025b. URL https://arxiv.org/abs/2401.15077.
Jonathan Mamou, Oren Pereg, Daniel Korat, Moshe Berchansky, Nadav Timor, Moshe Wasserblat, and Roy Schwartz. Dynamic speculation lookahead accelerates speculative decoding of large language models, 2024. URL https://arxiv.org/abs/2405.04304.
Mathematical Association of America. American invitational mathematics examination (aime), 1983. URL https://maa.org.
Xupeng Miao, Gabriele Oliaro, Zhihao Zhang, Xinhao Cheng, Zeyu Wang, Zhengxin Zhang, Rae Ying Yee Wong, Alan Zhu, Lijie Yang, Xiaoxiang Shi, Chunan Shi, Zhuoming Chen, Daiyaan Arfeen, Reyna Abhyankar, and Zhihao Jia. Specinfer: Accelerating large language model serving with tree-based speculative inference and verification. In Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 3, ASPLOS '24, pp. 932–949. ACM, April 2024. doi: 10.1145/3620666.3651335. URL http://dx.doi.org/10.1145/3620666.3651335.
David Rein, Betty Li Hou, Asa Cooper Stickland, Jackson Petty, Richard Yuanzhe Pang, Julien Dirani, Julian Michael, and Samuel R. Bowman. Gpqa: A graduate-level google-proof q&a benchmark, 2023. URL https://arxiv.org/abs/2311.12022.
Dale Schuurmans, Hanjun Dai, and Francesco Zanini. Autoregressive large language models are computationally universal, 2024. URL https://arxiv.org/abs/2410.03170.
Heming Xia, Tao Ge, Peiyi Wang, Si-Qing Chen, Furu Wei, and Zhifang Sui. Speculative decoding: Exploiting speculative execution for accelerating seq2seq generation. In Houda Bouamor, Juan Pino, and Kalika Bali (eds.), Findings of the Association for Computational Linguistics: EMNLP 2023, pp. 3909–3925, Singapore, December 2023. Association for Computational Linguistics. doi: 10.18653/v1/2023.findings-emnlp.257. URL https://aclanthology.org/2023.findings-emnlp.257/.
Mingyu Yang, Jae-Young Choi, Kihyo Moon, Minsung Jang, and Eunjoo Jeon. Dsde: Dynamic speculative decoding with kld stability for real-world serving, 2025. URL https://arxiv.org/abs/2509.01083.
Situo Zhang, Hankun Wang, Da Ma, Zichen Zhu, Lu Chen, Kunyao Lan, and Kai Yu. Adaeagle: Optimizing speculative decoding via explicit modeling of adaptive draft structures, 2024. URL https://arxiv.org/abs/2412.18910.
Xiandong Zou, Jianshu Li, Jing Huang, and Pan Zhou. Variational speculative decoding: Rethinking draft training from token likelihood to sequence acceptance, 2026. URL https://arxiv.org/abs/2602.05774.