Introduction
An early-exit decoder is trained so that any prefix of its layers, followed by the shared final norm and LM head, is a usable next-token predictor. Self-speculative decoding turns that into free drafts [1, 2]: a cheap subset of the model's own layers proposes a few tokens, the full model checks them all in one parallel pass, and the longest agreeing prefix is kept together with one token from the full model. The output is exactly the full model's greedy decoding. Only the cost changes, so the whole research question is a control question: which layers should draft, how many tokens, and when should drafting stop, round by round, so that the most tokens are committed per unit of decoder compute?
Three things make this harder than tuning an exit layer and a draft length. First, the objective is a ratio. Maximising acceptance alone chooses the full model as drafter; minimising draft cost alone chooses the first layer. What matters is committed tokens divided by compute, including the verification pass, which is paid once per round whatever was drafted. Second, the quantity that decides whether another draft token is worth buying, whether the draft is still on the full model's greedy path, is never observed during drafting. The draft head reports only its own logits. Third, the right answer moves with the text: a shallow exit that copies a repeated phrase perfectly may be useless on new content a few tokens later.
The field's answers address parts of this. A fixed exit and draft length is the LayerSkip recipe [2]. Draft & Verify searches for skipped sublayers and stops on a confidence threshold [1], SWIFT adapts the skipped layers on the fly [3], DEL picks the exit layer from context [4], SpecBound bounds a per-token exit by calibrated layer-wise confidence [5], and KnapSpec selects layers as a knapsack problem [6]. Each of these fixes one lever and uses a heuristic for the others. We wanted one criterion that sets all of them.
Method
Our method, which we call renewal-priced belief-state drafting (RPBD), has one organising idea: every decision in a round is a purchase, and every purchase is priced at the rate the decoder is already achieving.
One price for every decision
A round drafts some tokens, verifies them, and commits tokens, where is the number of accepted draft tokens. Its cost is one full verification plus the draft layers used, the head calls, and a small per-node charge for the verified tree. Rounds repeat, so by the renewal-reward theorem the long-run rate is
A policy that maximises buys an extra unit of work only when the tokens it is expected to add exceed times its cost. We therefore price everything at : another draft step, another alternative token in the verification tree, the choice between a shallow and a deep drafter, and the choice not to draft at all. Costs are measured in units of one full forward pass, with the constants in the code: a head call costs 0.035, a verified node 0.0015, the tree overhead 0.025, and a prefix exit at layer costs . The working price is the best rate predicted by the schedule below, pulled part of the way toward the rate realised in recent rounds.
What the draft head tells us
At each draft step the head returns its top- logits and its log-partition. We reduce them to a discrete evidence bin from the margin and the top token's log-probability,
cut at the edges , and doubled by one bit: whether the drafted token equals the token it was fed. That bit matters because copying the input can be a strong sign of a correct draft on one model and a strong sign of an error on another; its direction is learned, not assumed. The outcome we learn to predict is the rank of the full model's greedy token in the layer's top-, with meaning absent.
def _ranks(state, sid, target):
match = np.asarray(sid)[...,:state.K] == np.asarray(target)[...,None]
return np.where(match.any(-1),match.argmax(-1),state.K)
def _groups(rank,k):
return (rank!=0).astype(int)+(rank>=k)
def _bins(state, val, lse, top, inputs):
v=np.asarray(val,dtype=float)
margin=v[...,0]-v[...,min(1,v.shape[-1]-1)]
b=np.searchsorted(state.edges,margin+.5*np.minimum(0.,v[...,0]-lse))
return b + (len(state.edges) + 1) * (top == inputs)After every verification the interface returns every layer's top- at every committed position. That is a free, labelled sample for every exit at once, not only for the one that drafted. We fold it into per-layer tables of (bin, rank) counts, a slow table with a forgetting horizon of 2048 tokens and a fast one with a horizon of 48, and shrink them hierarchically toward each other and toward a prior. A third store keyed by the input word, whose entries are weighted by agreement with the preceding words, corrects these estimates at the root of each round for words the decoder has seen before.
Stopping on a belief, not on a threshold
Let be the probability that the draft is still on the full model's greedy path. We learn two distributions over evidence bins for each layer: while the draft is aligned and after its first disagreement, the latter from draft steps that the verifier later showed to be off the path. A new observation updates the belief by Bayes' rule, and then the conditional probability that the greedy token is the draft's top choice carries it forward:
With as the state, when to stop is a small Markov decision problem. For the six most promising drafters we discretise on a grid of 15 points, build the transition matrix of under one more draft step, and charge each step its layer cost plus the tree nodes it adds; a node is added only if its probability is at least times the node cost. The stop rule and the rate are found together, by alternating the two steps of a fractional policy iteration: for fixed continue/stop decisions, solve the linear system for the expected reward and cost, with for a draft horizon , and set ; then continue exactly where the action's reward exceeds times its cost.
grid = np.linspace(0., 1., 15)
S=len(grid)
horizon = max(1, min(state.limit, state.capacity, 32))
base_cost=1.+state.head_cost+state.tree_cost
layer_cost = full_cost[ix] + state.head_cost + .004
node_cost = state.node_cost
s = grid[None, :, None]
mix = s * on[:, None, :] + (1. - s) * off[:, None, :]
post = s * on[:, None, :] / np.maximum(mix, 1.e-15)
child = post[:, :, :, None] * rank[:, None, :, :k]
nxt = np.clip(child[:, :, :, 0] * (S - 1), 0., S - 1)
lower = nxt.astype(np.int64)
upper = np.minimum(lower + 1, S - 1)
frac = nxt - lower
rows=np.arange(L*S).reshape(L,S,1)*S
T = (np.bincount((rows + lower).ravel(), (mix * (1. - frac)).ravel(), minlength=L*S*S) +
np.bincount((rows + upper).ravel(), (mix * frac).ravel(), minlength=L*S*S)).reshape(L, S, S)
rate=cheap_score[ix].copy()
transition=(1.-1./horizon)*T
eye=np.eye(S)
keep=grid*avg[ix,:k].sum(1)[:,None] > rate[:,None]*layer_cost[:,None]
for _ in range(2):
use=child>=node_cost*rate[:,None,None,None]
r=(mix*(child*use).sum(-1)).sum(-1)
c=layer_cost[:,None]+node_cost*(mix*use.sum(-1)).sum(-1)
rc=np.stack((r,c),axis=-1)
value=np.linalg.solve(eye-transition*keep[:,:,None],rc*keep[:,:,None])
rate=(1.+value[:,-1,0])/(base_cost+value[:,-1,1])
action=rc+transition@value
keep=action[:,:,0]>rate[:,None]*action[:,:,1]During drafting, step applies the update above and asks whether continuing is worth its price,
using a word-conditioned look-ahead into the same value function.
def step(feat, state):
ids=feat["top_id"][0]
gain=_grow(state,ids,feat["top_val"][0].astype(float),feat["lse"][0])
if not gain:
return False
b=state.steps[-1][1]
s = state.survival
alive = s / (s + (1. - s) * state.likelihood[b])
state.survival = alive*state.primary
value=_lookahead(state,int(ids[0]),state.survival)
value+=state.survival*state.coverage*_credit(state,int(ids[0]))
return value>0. or (state.copy_weight>0. and gain>state.rate*state.cost)A tree, and a copy of what is already verified
The verifier accepts a tree, so a draft step need not commit to its top-1 token. Every draft step's top- candidates become children of the frontier, each carrying its parent's probability times the calibrated probability of its rank; nodes whose mass does not exceed times the node cost are not offered, and the tree is cut to the interface's capacity by mass. Alongside the draft model we run a copy component: the committed sequence is indexed by its suffixes of up to eight tokens, and when the current suffix recurs, the token that followed it last time receives extra mass. How often a copied continuation is right is learned online, separately for each match length, starting from a prior that rises with the length of the match. On a branch that leaves the copied continuation, only the draft model contributes.
Choosing the drafter, or not drafting
At the root of each round we compare every prefix exit and every calibrated sparse mask at the common price. For each we compute the value of a one-step draft, and for the drafters kept in the stopping schedule also the value of an adaptive draft that continues under the stopping policy, both net of times their cost and both using the root distribution conditioned on the current input word. The one-step value is penalised by its standard error, so an arm seen rarely must look clearly better before it is used. If the best value is negative the round drafts nothing and the full model decodes one token: abstaining is a priced action like any other.
def _choose_root(state):
ix, on, rank, raw_on, raw_rank, off, rate, cost, grid, value, action = state.table
root_on, root_rank = _root_joint(state, raw_on, raw_rank)
root_on, _, root_rank = _add_arms(state, root_on, root_on, root_rank, True)
w,q=root_on[ix],root_rank[ix]
price = float(rate.max())
if state.cycle_time:
price+=.35*np.clip(state.cycle_tokens/state.cycle_time-price,-.4*price,.5*price)
p = q[:,:,0] * (len(grid)-1)
lo = np.minimum(p.astype(int), len(grid)-2)
f = p-lo
rows = np.arange(len(ix))[:,None]
future = value[:,:,0]-price*value[:,:,1]
v = future[rows,lo]*(1.-f)+future[rows,lo+1]*f
gain=np.maximum(0.,root_rank[:,:,:-1]-price*state.node_cost).sum(-1)
hit=(root_on*gain).sum(1)
single=hit-price*(state.tree_cost+state.work)
single+=hit*_credit(state,state.seq[-1])
adaptive=single[ix]+(w*np.maximum(0.,v)).sum(1)-.004*price
single-=np.sqrt(hit*(1.-hit)/state.exposures)
j=int(adaptive.argmax())
arm=int(single.argmax())
# With one step, a continuation has no realizable value.
state.fixed=min(state.capacity,state.limit)==1 or single[arm]>adaptive[j]
state.rate=price
if state.fixed:
state.cost,state.abstain,state.coverage=state.work[arm],single[arm]<0.,hit[arm]
else:
arm=int(ix[j])
state.cost=cost[j]
state.abstain=adaptive[j]<0.
state.coverage=1.-on[j]@rank[j,:,-1]
state.baseline=on[j]
state.conditional,state.likelihood=rank[j],off[j]/on[j]
state.forward=rank[j],state.likelihood,future[j]
state.grid=grid
state.go=action[j,:,0]-price*action[j,:,1]
state.arm,state.root_cond=arm,root_rank[arm]A small portfolio of sparse masks
Prefix exits are not the only drafters the interface allows: any subset of attention and MLP
sublayers can draft. During the one calibration simulation, plan collects metered probes of
candidate masks on recently committed windows. Each candidate injects one later attention block,
MLP block or whole layer into a cheap prefix, preferring layers whose predictions repair the
prefix's errors. Each mask is paired with the prefix exit whose outcomes are most informative about
its own, by mutual information, so that its behaviour can be transported to new prompts through an
exit we always observe. We then select up to five masks greedily, each for the coverage it adds over
the best prefix exits and the masks already chosen, with a pessimistic margin of 0.6 standard
errors.
def _portfolio(state,conservative=True):
records=list(state.records.values())
if not records:
return []
windows=state.situations
D=min(12,min(g.shape[1] for g in windows))
d=np.arange(1,D+1)
source=np.stack([np.eye(3)[z].mean(-2) for z in _spans(np.stack(windows),D)],axis=2)
layers=state.L
incumbent=_value(1.-source[...,2],np.arange(1,layers+1)/layers).max(1)
scores=[]
for rec in records:
anchor=rec.anchor
work=rec.keep.sum()/2
ref=_reference(rec)
counts=np.zeros((D,3,2))
for i,(g,b,r) in enumerate(rec.examples):
weight=.45 if i==0 and len(rec.examples)>1 else 1.
pairs=zip(_spans(g[anchor],D),_spans(_groups(r,state.K),D))
for j,(old,new) in enumerate(pairs):
counts[j]+=weight*np.bincount(2*old+(new==2),minlength=6).reshape(3,2)
strength=8.*np.sqrt(d)[:,None]
den=counts.sum(-1)+strength
hit=(counts[...,0]+strength*(1.-source[:,ref,:,None,2]))/den
weight=source[:,anchor]
cover=(weight*hit).sum(2)
error=np.sqrt((weight**2*hit*(1.-hit)/den).sum(2))
cover=np.clip(cover+(-.6 if conservative else 1.)*error,.001,1.)
sc=_value(cover,work/layers)
scores.append(sc)
scores = np.stack(scores)
selected = []
for _ in range(min(5,len(records))):
gap = scores-incumbent
gain = np.maximum(0.,gap).mean(axis=1)+.12*np.max(gap,axis=1)+.03*gap.mean(axis=1)
idx = int(gain.argmax())
selected.append(records[idx])
incumbent=np.maximum(incumbent,scores[idx])
scores[idx]=-1.e6
return selectedThe method has no per-setting constants. Everything that differs between models and texts, which layers are informative, how far a draft survives, how often the text repeats itself, is estimated from the verifier's feedback while decoding.
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 ↑ | |
| GPT-6.2 Astra | 0.205 | 2.314 | 0.155 | 1.935 | 0.123 | 2.929 | 0.117 | 2.691 |
| 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
RPBD is ahead of every published baseline on every setting, on both measures. On the compute measure it reaches 0.205 on 1B/CNNDM against 0.170 for the strongest baseline, DEL dynamic exit layer [4], and 0.155 on 1B/XSum against 0.129. On 8B/CNNDM the strongest baseline on this measure is SpecBound [5] at 0.109, against our 0.123, and on 8B/XSum we reach 0.117 against 0.091.
The gain survives the trip to wall-clock time, which is not automatic for a controller that does more bookkeeping per token than a fixed exit. Our speedups over plain decoding are 2.314, 1.935, 2.929 and 2.691 on 1B/CNNDM, 1B/XSum, 8B/CNNDM and 8B/XSum, against best baseline values of 1.916, 1.711, 2.485 and 2.247. The fixed-exit LayerSkip recipe, the starting point of the task, reaches 0.143 and 1.685 on 1B/CNNDM.
The ordering of the baselines is not stable across settings: the strongest on the compute measure is not the same on every setting, and SpecBound, which is behind several baselines on the first two settings, is the strongest on the compute measure on 8B/CNNDM. A controller that learns its choices from feedback, rather than fixing one lever, does not have to bet on one of them. These measurements do not separate the contributions of the tree, the copy component, the masks and the stopping rule; the only ablations we have are our development measurements below.
How we got here
We started from the observation that the verifier returns, after every round, the full model's greedy token and every layer's top- at each committed position. That is a counterfactual label for every exit, not only the one that drafted, and our first controller used it to rank both "draft another token" and "verify an alternative here". In our development runs on public early-exit models it reached 56.9 tokens/s on a general-text model against 42.5 for the starter and 50.9 for a dynamic-exit reference, with identical greedy outputs. We framed the objective from the start as a ratio of reward to cost, following the classical analysis of speculative decoding, in which the expected output of a round assumes a constant acceptance rate and maximising acceptance alone selects the full model.
The method grew by a long series of versions, each kept or dropped on paired development comparisons over several public models, several calibration samples and held-out prompt orders.
- Retrieval from the history overreached at first. Adding a fresh retrieval probability to every hypothetical partial branch helped the specialist models but made drafts too long on general text. Anchoring a single historical continuation at the real committed prefix, and letting only the draft model contribute after it diverges, fixed that; this is the copy component above.
- The stopping rule became a hidden-state problem. We replaced threshold stopping with the belief over alignment and the dynamic program, using draft steps after the first observed disagreement as free samples of the off-path distribution.
- Wider trees paid. On held-out prompts in development, wider verification trees with a nominal node cost raised throughput on a general-text model from 60.1 to 63.2 tokens/s, which set the node price we use.
- Mask search overfits its calibration sample. Searching more sublayer combinations found stronger masks on some calibration samples, and also selected masks that lost throughput on new prompts. We therefore kept the earlier selection policy; the masks are chosen as a portfolio for their added coverage, with a pessimistic margin, and compared conservatively with every prefix exit. On a small specialist model the portfolio raised the development layer-efficiency proxy from 2.71 to 3.16; it was nearly neutral on a larger model and slightly worse on general text.
- Double counting made masks look too accurate. Repeated words were counted both in the general estimate and in the word-specific one. In a development check on a small specialist model, chosen masks for words already seen were forecast to put the target first 64% of the time and achieved 37%. Discounting repeated observations of the same word in the general estimate gave the largest late improvement we saw.
- Several ideas did not pay for their CPU time. A Bayesian change-point filter on the local statistics, off-path calibration learned per tree group, adaptive mid-decoding probing priced by a knowledge-gradient rule, and a deeper exit for the first draft token all improved a compute proxy somewhere and lost wall-clock time or were mixed elsewhere; none is in the final method.
- Shorter copy contexts beat longer ones. Querying sparse, longer suffixes (up to 32 tokens) looked like a small fix, but in fresh development comparisons the dense short suffixes gave 92.5 tokens/s against 84.6 on a small specialist model, and were within noise on general text, so we kept them.
- A one-step edge case. When the interface allows only one draft step, a continuation value has no meaning; the root decision now compares only full verification against a one-step draft.
The tree verification we use follows work on tree-structured speculation that is not among the references here, and the ratio objective follows the original analysis of speculative decoding; the development figures in this section are our own measurements, recorded in the run's trace.
Limitations
- We cannot say which part carries the gain. The method combines a stopping rule, a verified tree, a copy component, word-conditioned calibration and sparse masks. The measured results show the whole is ahead on every setting; they do not show which components matter where.
- Many hand-set constants. The evidence-bin edges, forgetting horizons, shrinkage strengths, the copy-reliability prior, the mode weights of the tree and the per-node and per-head costs were set in development, not derived. They contain no per-setting values, but they were tuned on a handful of public models and may be less well matched elsewhere.
- The cost model is nominal. Costs are counted in layer units with fixed overheads. Where real hardware prices a wide tree or a head call differently, the price is wrong by that amount; our development runs showed exactly such cases, where a compute gain did not become a wall-clock gain.
- Mask calibration is a small, noisy sample. The masks are chosen from a limited number of probes in one calibration pass, and our own development showed that mask choice is sensitive to which prompts it saw. The conservative margins limit the damage; they do not remove the variance.
- Exactness at near ties. The verifier chooses every committed token, so the output is the full model's greedy decoding as the verifier computes it. In development, wider verification batches occasionally produced a different token at numerical near ties than a single-row greedy run; the reference methods showed the same behaviour, a property of batched floating-point verification.
- The controller is large. It is several hundred lines of dense numerical code with many interacting estimators, which makes it harder to audit and to port than a rule of a few lines.
References
- Jun Zhang, Jue Wang, Huan Li et al. (2024). Draft & Verify: Lossless Large Language Model Acceleration via Self-Speculative Decoding. ACL.
- Mostafa Elhoushi, Akshat Shrivastava, Diana Liskovich et al. (2024). LayerSkip: Enabling Early Exit Inference and Self-Speculative Decoding. ACL.
- Heming Xia, Yongqi Li, Jun Zhang et al. (2025). SWIFT: On-the-Fly Self-Speculative Decoding for LLM Inference Acceleration. ICLR.
- Hossein Entezari Zarch, Lei Gao, Chaoyi Jiang et al. (2025). DEL: Context-Aware Dynamic Exit Layer for Efficient Self-Speculative Decoding. COLM.
- Zhuofan Wen, Yang Feng (2026). SpecBound: Adaptive Bounded Self-Speculation with Layer-wise Confidence Calibration. ACL.
- Seongjin Cha, Gyuwan Kim, Dongsu Han et al. (2026). KnapSpec: Self-Speculative Decoding via Adaptive Layer Selection as a Knapsack Problem. ICML.