Introduction
A decoder trained with an early-exit recipe can emit a token from any prefix of its layers through the shared final norm and head. Self-speculative decoding turns this into a lossless accelerator [1, 2]: a shallow prefix of layers drafts tokens one at a time, the full -layer model checks all of them in one parallel pass, and the longest drafted prefix that equals the full model's greedy choice is kept, plus one token from the full model. The output is exactly greedy decoding of the full model; only the cost changes. Each round costs roughly layers per drafted token and one verification pass, and it yields the accepted prefix plus one.
The research question is how to choose, round by round, which layers draft, how many tokens are drafted and when drafting stops, so that the most tokens are generated per unit of decoder compute and per second. Three things make it hard.
The best exit is a trade-off that moves. A shallower exit drafts cheaply but is accepted less often; a deeper one is accepted more often but each draft token costs more. Where the optimum lies depends on the model and on the text, and it changes within a single generation.
Confidence is not acceptance. The draft head's top-1 probability is the natural stopping signal, but a shallow layer's softmax is not calibrated against the full model's choice, and the relation differs from layer to layer; layer-wise confidence calibration [3] addresses the same gap.
Errors are not free after they happen. Once a draft token is wrong, every later draft token in the round is wasted compute, and the draft that continues from a wrong token sees a context the full model will never produce. A planner that assumes the draft stays on the right path overvalues long drafts at the wrong times.
The published approaches fix the exit and the draft length [1], draft with the model's own layers without a separate draft model [2], self-speculate on the fly [4], select layers adaptively [5], choose the exit layer from context [6], adapt the draft length with a finite-state rule, or bound self-speculation with layer-wise confidence calibration [3]. Our method keeps the prefix-exit drafts of the first and makes every decision with one quantity: the calibrated probability that a draft prefix survives verification.
Method
We call the method CASD (calibrated acceptance-survival drafting). It has four parts: an online acceptance model, a planner that picks the exit and the draft cap, a survival-based stopping rule with tree verification, and a calibration-time search over drafting modes. The starter it replaces drafts a fixed six tokens from a fixed exit at layer 3 and learns nothing.
Learning acceptance online
After every verification, the controller receives every layer's top- predictions at the verified positions, together with the full model's greedy token there; the prompt's last positions arrive in the same form when a prompt begins. From these rows (for a chain, only the accepted positions and the one after them) we count, for every layer , how often its top-1 token equals the full model's token, split by a 14-bin histogram of the layer's top-1 probability and by a stability bit that records whether layer 's top-1 equals layer 's. The counts come at three time scales: global counts that decay by per round, per-prompt counts that are reset at each new prompt and weighted by 2, and, for the layer base rate only, recent counts that decay by per round and are weighted by 4.
Both estimates are shrunk toward a prior. The base rate of layer (zero-indexed) is
and the conditional acceptance of a token drafted at layer with confidence in bin and stability is shrunk toward that base rate,
where and are the weighted hit and count totals. When drafting from a fixed exit the stability bit is not observed and the two halves of the bin are pooled.
def _alpha(st, l):
pr = _prior_alpha(l, st["L"]); w = 30.0; pw = st["cfg"].get("pweight", 2.0); rw = st["cfg"].get("recent_w", 0.0)
h = st["g_bh"][l] + pw * st["p_bh"][l] + rw * st["r_bh"][l]
c = st["g_bc"][l] + pw * st["p_bc"][l] + rw * st["r_bc"][l]
return float((h + w * pr) / (c + w))
def _a(st, l, p1, stable):
b = _bin(p1); base = _alpha(st, l); w = 18.0
if stable is None:
h = st["g_h"][l, b].sum() + st["cfg"].get("pweight", 2.0) * st["p_h"][l, b].sum()
c = st["g_c"][l, b].sum() + st["cfg"].get("pweight", 2.0) * st["p_c"][l, b].sum()
else:
s = 1 if stable else 0
h = st["g_h"][l, b, s] + st["cfg"].get("pweight", 2.0) * st["p_h"][l, b, s]
c = st["g_c"][l, b, s] + st["cfg"].get("pweight", 2.0) * st["p_c"][l, b, s]
return float(_np.clip((h + w * base) / (c + w), 0.01, 0.999))Planning the exit and the cap
Given these estimates, a planner chooses the exit and the draft cap for the next rounds. For each candidate exit it takes the empirical distribution of confidence bins at that layer and the calibrated acceptance of each bin, and it propagates probability mass over a grid of 28 survival values , where is the product of the acceptances of the tokens drafted so far. The mass is split in two. Alive mass is the probability that every drafted token so far is correct: with probability it stays alive with survival , and with probability it becomes dead. Dead mass has already drafted a wrong token. It contributes no tokens, but it keeps drafting, and therefore keeps costing compute, until the mode's stopping rule fires, and because the draft now runs on a context the full model will not produce, its survival is propagated with the reduced acceptance . A step of mass continues only while the mode's own stopping rule would continue; for the tree mode that is .
With and the mass still drafting at step , the planner maximises the expected tokens per loaded layer,
where the denominator charges one verification pass of layers plus layers per drafted token. In the tree mode adds the chance that a wrong top-1 is rescued by a sibling, with and the measured rate at which the full model's token lies in the layer's top 8. Exits whose base rate is below are skipped, and the result is cached, being recomputed at the start of each prompt and, by default, every 40 rounds. We implemented the propagation as precomputed transition matrices so that the planner costs little per round.
ab_d = ab * cfg.get("dead_decay", 0.55)
ns = grid[:, None] * ab[None, :]
ns_d = grid[:, None] * ab_d[None, :]
_st = 6.0 / 27.0
idx = _np.clip(_np.ceil(-_np.log(_np.clip(ns, 1e-9, 1.0)) / _st - 0.5), 0, 27).astype(_np.int64)
idx_d = _np.clip(_np.ceil(-_np.log(_np.clip(ns_d, 1e-9, 1.0)) / _st - 0.5), 0, 27).astype(_np.int64)
if kind == "tree" and cfg.get("tree_feedback", True):
cont = ns >= cfg.get("smin_tree", 0.26)
cont_d = ns_d >= cfg.get("smin_tree", 0.26)
elif kind == "tree":
cont = _np.ones(ns.shape, bool); cont_d = cont
elif kind == "step":
cont = _np.broadcast_to(ab[None, :] >= cfg["tau_stop"], ns.shape)
cont_d = _np.broadcast_to(ab_d[None, :] >= cfg["tau_stop"], ns.shape)
else:
cont = _np.ones(ns.shape, bool); cont_d = cont
G = len(grid); src_i = _np.broadcast_to(_np.arange(G)[:, None], idx.shape)
Ta = _np.zeros((G, G)); Tad = _np.zeros((G, G)); Td = _np.zeros((G, G))
_np.add.at(Ta, (idx[cont], src_i[cont]), _np.broadcast_to((wts * ab)[None, :], idx.shape)[cont])
_np.add.at(Tad, (idx[cont], src_i[cont]), _np.broadcast_to((wts * (1.0 - ab))[None, :], idx.shape)[cont])
_np.add.at(Td, (idx_d[cont_d], src_i[cont_d]), _np.broadcast_to(wts[None, :], idx.shape)[cont_d])
alive = _np.zeros(G); alive[0] = 1.0
dead = _np.zeros(G)
exp_tok = 1.0; exp_draft = 0.0
wa = float((wts * ab).sum()); wr = float((wts * (1.0 - ab)).sum()) * hres
for step_i in range(wmax):
mass = float(alive.sum() + dead.sum())
if mass < 1e-6:
break
exp_draft += mass
alive_mass = float(alive.sum())
exp_tok += alive_mass * wa + alive_mass * wr
score = exp_tok / ((L - cfg.get("vbeta", 0.0) * E) + ecost * exp_draft)
if score > best[0]:
best = (score, E, step_i + 1)
if step_i == wmax - 1:
break
alive, dead = Ta @ alive, Tad @ alive + Td @ dead
st["ew_cache"] = (kind, st.get("plan_n", 0), best[1], best[2]); st["ew_score"] = best[0]
return best[1], best[2]Plain decoding yields one token per layers, so in the modes that use it the planner also decides whether to speculate at all: when the best predicted score is not above , the round drafts nothing.
E, W = _choose_EW(state, "tree" if mode == "tree" else ("step" if mode == "fixed_step" else "bare"))
E = int(_np.clip(int(E) + int(cfg.get("e_bias", 0)), 1, max(1, L - 1)))
W = int(min(int(W), int(state.get("max_draft_cal", 128)))); state["round_E"] = int(E); state["round_W"] = int(W)
if float(state.get("ew_score", 1.0)) <= 1.03 / max(L, 1):
return {"exit": int(E), "max_draft": 0}
base = {"exit": int(E)}
if cfg.get("half_last") and int(E) >= 2:
mk = _np.zeros(2 * L, dtype=bool); mk[:2 * int(E) - 1] = True
base = {"mask": mk}
if mode == "tree":
_wf = int(cfg.get("w_floor", 0)) if cfg.get("tree_feedback", True) else 0
W = int(min(max(int(W), _wf), int(state.get("max_draft_cal", 128)))); state["round_W"] = int(W)
return dict(base, max_draft=int(W), tree=True, feedback=bool(cfg.get("tree_feedback", True)), topk=int(min(cfg["topk"], state.get("max_topk", 64))), fp32=True)
if mode == "fixed_step":
return dict(base, max_draft=int(W), feedback=True, fp32=True)
return dict(base, max_draft=int(W))Stopping by survival, verifying a tree
In the default tree mode the planner's cap is raised to at least 24 tokens, and drafting is stopped by the survival product instead. After each draft token, with confidence at the exit, we update and continue while and the cap is not reached. The floor exists because the planner's model treats successive acceptances as independent and so undervalues long drafts in easy stretches; we apply it only when this feedback stopping is on.
def step(feat, state):
cfg = state["cfg"]
try:
p1, _tid = _p1(feat)
E = int(state.get("round_E", 3))
a = _a(state, max(0, E - 1), p1, None)
state["S"] = float(_np.clip(state["S"] * a, 0.0, 1.0))
i = int(feat.get("i", 0))
if cfg["mode"] == "tree":
return bool(state["S"] >= cfg.get("smin_tree", 0.26) and a >= cfg.get("tree_afloor", 0.0) and i + 1 < state.get("round_W", 20))
return bool(a >= cfg["tau_stop"] and state["S"] >= cfg["smin"]
and i + 1 < state.get("round_W", 20))
except Exception:
return TrueThe drafted steps are then turned into a token tree for the verifier. Starting from the children of the last committed token, we grow the tree best-first by path value, the product of the draft probabilities along the path, up to 96 nodes and dropping nodes worth less than . The draft's distributions at deeper levels were computed along its own top-1 chain, so they are only an approximation for children of an alternative token; every extension below a node that has left the top-1 chain is therefore discounted by .
def offer(pidx, pth, d, is_main_parent):
if d > n:
return
row_p = probs[d - 1]; row_t = ti[d - 1]
fac = 1.0 if is_main_parent else rho
for r in range(k):
p = float(row_p[r])
if p <= 0.0 or pth * p * fac < thr:
continue
ism = bool(is_main_parent and r == 0)
val = pth * p * fac
cnt[0] += 1
_hq.heappush(heap, (-val, cnt[0], pidx, int(row_t[r]), d, ism))
offer(-1, 1.0, 1, True)
used = set()
while heap and len(parent) < budget:
nval, _c, pidx, t, d, ism = _hq.heappop(heap)
val = -nval
if val < thr:
break
key = (pidx, t)
if key in used:
continue
used.add(key)
idx = len(parent)
parent.append(int(pidx)); token.append(int(t))
if d < n:
offer(idx, val, d + 1, ism)
if not parent:
parent = [-1] + list(range(n - 1)); token = [int(ti[d, 0]) for d in range(n)]
return parent, tokenChoosing the mode with the simulator
The interface lets the controller simulate itself before decoding. We use those simulations for a staged search over complete configurations: first a set of main drafting modes, which differs according to whether elapsed time is reported (where it is not: the tree mode, a fixed exit with calibrated step stopping, a wide tree with top-64 children and 256 nodes, per-token exits, and a fixed exit with the planned cap and no feedback), then refinements of the winner, then the remaining variants, at most 40 trials and stopping early if the deadline is near. Candidates are ranked by etpl, or by tokens per second where the interface reports elapsed time. The per-token exit mode, which drafts each token at the first candidate layer whose calibrated acceptance clears a threshold or where the survival-weighted gain in acceptance from continuing to the next candidate is worth no more than the realised tokens-per-layer price of the extra layers, remains among the candidates. Most requested limits are clipped to the maxima the interface states, and every per-round entry point falls back to a safe default on an exception.
Results
| Method | ① | ② | ③ | ④ | ||||
|---|---|---|---|---|---|---|---|---|
| Tokens per layer loaded ↑ | Measured speed-up ↑ | Tokens per layer loaded ↑ | Measured speed-up ↑ | Tokens per layer loaded ↑ | Measured speed-up ↑ | Tokens per layer loaded ↑ | Measured speed-up ↑ | |
| Muse Wonder Full | 0.198 | 2.071 | 0.161 | 1.931 | 0.113 | 2.746 | 0.116 | 2.617 |
| LayerSkip | 0.143 | 1.685 | 0.111 | 1.413 | 0.089 | 2.145 | 0.077 | 1.939 |
| Liu et al. | 0.158 | 1.914 | 0.118 | 1.567 | 0.087 | 2.183 | 0.080 | 2.097 |
| Draft & Verify | 0.139 | 1.621 | 0.092 | 1.231 | 0.088 | 2.176 | 0.051 | 1.375 |
| DEL | 0.170 | 1.916 | 0.129 | 1.711 | 0.104 | 2.485 | 0.091 | 2.247 |
| SWIFT | 0.097 | 1.252 | 0.085 | 1.275 | 0.048 | 1.360 | 0.048 | 1.408 |
| Random exit layer | 0.086 | 1.181 | 0.075 | 1.094 | 0.047 | 1.347 | 0.042 | 1.264 |
| SpecBound | 0.131 | 1.217 | 0.097 | 1.086 | 0.109 | 1.962 | 0.085 | 1.711 |
- ① LayerSkip Llama-3.2-1B · CNN/DailyMail 1-shot
- ② LayerSkip Llama-3.2-1B · XSUM 0-shot
- ③ LayerSkip Llama-3-8B · CNN/DailyMail 1-shot
- ④ LayerSkip Llama-3-8B · XSUM 0-shot
CASD is ahead of every published baseline on both metrics on every setting. On 1B/CNNDM it reaches an etpl of 0.198 against 0.170 for the strongest baseline, DEL dynamic exit layer [6], and a measured speedup of 2.071 against 1.916. On 1B/XSum the figures are 0.161 against 0.129 and 1.931 against 1.711, and on 8B/XSum they are 0.116 against 0.091 and 2.617 against 2.247. Against the fixed-exit starter the gains are larger still: on 8B/XSum, for example, the fixed exit reaches 0.077 and 1.939.
The margin is smallest on etpl on 8B/CNNDM. There the strongest baseline is SpecBound [3] at 0.109, against our 0.113. On measured speedup on the same setting the gap is wider: 2.746 against 2.485 for DEL dynamic exit layer [6].
The two metrics do not always agree, which is why we let the calibration search optimise wall-clock throughput where it can see it. On 8B/CNNDM and 8B/XSum the bounded per-token exit baseline has a higher etpl than the fixed exit (0.109 against 0.089 on 8B/CNNDM) but a lower measured speedup (1.962 against 2.145). The means do not say why; per-token controller decisions are one possible cost that layer counts do not see. CASD leads on both metrics on every setting, though from these means alone we cannot say which of its modes the search selected on each setting.
How we got here
We began by building a local stand-in for the task. The official early-exit checkpoints were gated, so we converted public mirrors of them and recorded every layer's top- predictions along greedy generations, then wrote a teacher-forced simulator of the controller interface and, later, a harness that runs real draft rollouts on the GPU, in which a draft that has gone wrong continues from its own wrong tokens. The development measurements below are ours, from those harnesses, not from the evaluation.
- The cost model came first. Reading the interface told us that verification is one parallel pass whatever the draft length, so a round costs plus per drafted token. That is the denominator of the planner's score, and it is why trees are attractive: in teacher-forced simulation a sibling tree added 14 to 21% over a chain at the same exit and depth, and when a shallow exit's top-1 was wrong the full model's token was in its top 5 roughly half the time.
- Calibration was the signal, and few features were needed. Acceptance rose steeply and monotonically with the exit layer's confidence, with similar curves across layers, and agreement with the next layer was a strong additional signal; that became the stability bit. In teacher-forced simulation on one checkpoint, a fixed exit with calibrated step stopping reached 0.142 against 0.128 for a confidence-threshold rule in the style of bounded per-token exits. Later ablations found nothing beyond confidence and stability that replicated with real drafts: the margin between the top two tokens added nothing, a round-to-round difficulty adjustment had no effect on outcomes and was removed, and the calibration layer as a whole was worth about 1 to 3% over raw confidence, the rest of the gain being structural.
- Spread sublayer masks collapsed. The interface allows drafting with any subset of attention and MLP sublayers, as layer-skipping methods do. On these early-exit-trained models it was catastrophic: at six kept sublayers a contiguous prefix agreed with the full model on 0.715 of positions and a strided mask on 0.003. We first suspected our masked forward pass, verified that it reproduced the full model exactly, and dropped the direction; a half-layer prefix remains only as one late candidate in the search.
- Off-trajectory drafting changed the planner. Our first planner assumed that the draft's confidence stays on its usual distribution after a wrong token, and it undervalued large caps, while real rollouts showed that a large cap with dynamic stopping won clearly. We added the dead mass, with its decayed acceptance; we later measured that a wrong context shifts the confidence distribution down (to about 0.76 of its value) while the confidence-to-acceptance relation is preserved, and that sits on a plateau. In the realistic harness the resulting ranking was tree 0.123, fixed exit with step stopping 0.102, and the context-aware exit baseline 0.099.
- Per-token exits underperformed. In teacher-forced ablation the per-token exit mode reached 0.0954 against 0.1380 for the tree mode and 0.1290 for the fixed exit with step stopping, and several rule variants did not close the gap. Combinations of per-token exits or decoder-side thresholds with trees also stayed below the plain tree mode. These modes remain only as candidates for the search.
- A draft-length floor, and a bug it caused. About 40% of tree rounds exhausted the planned cap, a sign that the planner's independence assumption undervalues easy stretches. A floor of 24 gave about 3% on long generations and was neutral elsewhere. It also, we found, silently applied to the no-feedback tree variant, where it overrode the planned cap and cut that variant's etpl from 0.1271 to 0.0587 in our harness; the floor now applies only with feedback stopping.
- Wider trees helped; token-level calibration did not. A tree drawn from the top 64 with 256 nodes was about 3% better at matched settings in the realistic harness, so it joined the first stage of the search. Calibrating individual node probabilities hurt wide trees, whose nodes fall in sparsely observed low-probability bins, and is off by default. A learned off-chain discount and a stopping threshold scaled by the tokens-per-layer price showed no gain and were removed.
- Controller latency matters for the speedup. Under a modelled fast-decoder scenario, a controller overhead of about 1.75 ms per round, mostly the planner, would have erased our wall-clock lead. Rewriting the planner as transition matrices cut a recomputation from 10.04 ms to 4.91 ms with identical etpl, and the cache interval was lengthened.
By the end, our own realistic-harness summary put the policy at an etpl of 0.146 to 0.149 against 0.117 for the strongest baseline on one checkpoint, 0.080 to 0.083 against 0.059 on a second and 0.051 to 0.053 against 0.038 on a third, and on a model without early-exit training it drafted nothing and matched plain decoding while the baselines lost 20 to 45%.
Limitations
- The margin on etpl is thin on 8B/CNNDM. There our etpl is only slightly above that of the strongest baseline, SpecBound [3], so our etpl gain is much smaller on that setting than on the others.
- The planner's model is approximate. It treats successive acceptances as independent and models off-trajectory drafting with a single decay factor; the draft-length floor of 24 is a patch for the first approximation rather than a fix. The tree's off-chain discount likewise stands in for distributions the draft never computed.
- Many constants are tuned, not derived. The shrinkage weights (30 and 18), the bin edges, the stopping threshold , the decay , the discount and the floor were set in our own harnesses on a handful of public checkpoints. The calibration search softens this by choosing among configurations per run, but it can only choose among the candidates we wrote.
- We do not know which mode ran where. The search picks a mode on each run, and the means available to us do not record which one won, so we cannot attribute the results to the tree mode specifically.
- Wall-clock gains depend on controller overhead. The planner, the tree builder and the per-token callbacks run on the CPU between GPU passes. Our latency work was done against a modelled GPU time, not the evaluation's decoder, so the measured speedup reflects an overhead we could estimate but not measure directly.
- Much of the interface is unused. We draft almost only with layer prefixes; apart from one half-layer candidate in the search, the sublayer masks, sublayer probes and hidden-state features the interface offers play no part in the final policy, because our development measurements found them worse or redundant on early-exit-trained models.
References
- Mostafa Elhoushi, Akshat Shrivastava, Diana Liskovich et al. (2024). LayerSkip: Enabling Early Exit Inference and Self-Speculative Decoding. ACL.
- Jun Zhang, Jue Wang, Huan Li et al. (2024). Draft & Verify: Lossless Large Language Model Acceleration via Self-Speculative Decoding. ACL.
- Zhuofan Wen, Yang Feng (2026). SpecBound: Adaptive Bounded Self-Speculation with Layer-wise Confidence Calibration. ACL.
- Heming Xia, Yongqi Li, Jun Zhang et al. (2025). SWIFT: On-the-Fly Self-Speculative Decoding for LLM Inference Acceleration. ICLR.
- Seongjin Cha, Gyuwan Kim, Dongsu Han et al. (2026). KnapSpec: Self-Speculative Decoding via Adaptive Layer Selection as a Knapsack Problem. ICML.
- Hossein Entezari Zarch, Lei Gao, Chaoyi Jiang et al. (2025). DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding. COLM.