Manuscript Offprint

arXiv:2610.05774

AdaSpark: Adaptive DSpark with Online Learning for Tree Verification and N-gram Fill

Liquan Liu, Yifan Zhang, Bowei Xu

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

Abstract

Block drafters such as DSpark propose ranked candidates for several positions in one forward pass, and a tree verifier checks them in one pass of the target. The number of rows to verify trades the tokens a wider tree is expected to accept against the time a wider verify takes. Most schedulers that choose this number take the verify time from a table or model measured before serving, corrected online by at most one scale factor, and take acceptance from the drafter's confidence estimates or from a map fitted offline.

AdaSpark learns both quantities while it serves, with no profile, calibration or sweep in advance. It learns which verify widths are worth offering and fits each one's verify time as a function of context. It fits each candidate's acceptance probability to the target's verify outcomes, with the drafter's confidence head as one input, and orders and sizes the tree by that fit instead of by the head. The same model prices n-gram continuations of the request's own text, so drafted and text-derived candidates compete for rows in one best-first order. The width is chosen by pricing time at the long-run decode rate.

On single- and multi-turn conversations from six public datasets, on three dense targets and one mixture-of-experts target, AdaSpark decodes 1.5–3.1× faster than llama.cpp's DSpark with the same drafters. Our imparo engine with AdaSpark is 1.17–1.52× faster than imparo running with a three-token chain (the default llama.cpp setting); this gain comes from the scheduler alone. Without a width sweep, AdaSpark is never more than 0.3% slower than the best pinned tree width on any dense target or context band. On the mixture-of-experts target it ties the best pinned width, and the other pinned widths from 4 to 16 rows are 5–14% slower.

Keywords: speculative decoding; tree verification; DSpark; online learning; verify cost; mixture of experts

Code and data: https://github.com/zeraix/imparo

1 Introduction

Speculative decoding [1, 2] drafts tokens cheaply and verifies them in one forward pass of the target model, keeping the longest prefix the target agrees with. Drafters that emit a tree of candidates rather than a chain raise the tokens accepted per pass [3–7]. Block drafters such as DSpark [8] produce a whole block of positions in one forward pass, each with a ranked list of alternatives, so a tree built from one block can be as wide as the scheduler allows [9, 10]. The scheduler must decide how many rows to verify.

That decision needs two quantities: the tokens a tree of n rows is expected to accept, and the time a verify of n rows takes. Many schedulers fix the budget by hand or by a sweep [10–12]. Others learn a chain length online from measured outcomes, with no model of the verify's cost in width or context [13–15], or measure a few lengths in short trial phases [16]. Those that price the verify read its time from a table, curve or model measured before serving: a profile taken at engine start [8, 17, 18], a table from an offline profiler [19], a latency ladder measured once per deployment [9], or a roofline model calibrated offline with at most one online correction factor [20]. The two open-source serving engines that implement DSpark's scheduler each measure their table at one context length or one short range of contexts (§6). Acceptance comes from the drafter's probabilities [18, 20], its trained confidence head [8, 21], or a map fitted offline to the target's outcomes [9, 22]. Most of these schedulers already choose the size anew for every verify; they differ in where the cost and the acceptance come from (Table 11).

We measure the verify time on four targets ( §3.2§3.2). It is a step function of n, as reported for GPU tile allocation [8, 20] and for llama.cpp's Metal backend [23], and the steps fall in different places for 8-bit and 4-bit weights. On a mixture-of-experts target it rises with every row, because each row is routed to its own experts [16, 18, 24]. It also grows with context, faster for a wide verify than for a narrow one. The best fixed width therefore differs between targets ( §3.4§3.4). For acceptance, a model fitted to the target's own outcomes predicts better than the drafter's confidence head, as TreeSpark [9] found for a map fitted offline ( §3.3§3.3).

AdaSpark is a scheduler for DSpark tree verification that learns both quantities while it serves. It learns which verify widths to offer and fits each one's verify time as a function of context, fits an acceptance model to the target's outcomes, lets n-gram continuations of the request compete with the drafter's candidates for rows, and chooses each round's width from the two fitted models. It needs no cost profile, calibration or width sweep before serving. Its constants (Appendix B) were set once, on one target and a separate development corpus, and are used unchanged on all four.

References (65)