Introduction
Speculative decoding speeds up a large target model by letting a cheap drafter propose several future tokens, which the target verifies in one parallel forward pass. The target keeps the longest prefix of drafts that equals its own greedy choices and adds one token of its own, so a round produces tokens when drafts are accepted. Plain autoregressive decoding sits at about one token per round (for example 1.014 on the first column of Math); everything a drafter buys is the extra accepted tokens, net of the time the drafter itself takes.
Drafters have moved from small separate language models to small networks that read the target's own hidden states. Some propose tokens one at a time from those features [1]; others attach independent heads, one per future position [2]; and recent block drafters propose a whole block in a single pass over the target's features, as a block-diffusion-style model [3] or through other parallel-draft designs [4] and hybrid ones that prioritise early tokens [5]. The parallel ones are fast, and they share one weakness. Every position of the block is predicted from the same features and mask symbols, so position is chosen without knowing which token was chosen at position . Because verification keeps only a matched prefix, an early mistake discards everything after it, and an inconsistent suffix is wasted work. The methods the field has tried against this restore some dependence between drafted tokens, from semi-autoregressive generation with a confidence schedule [6] to decoupling causal modelling from autoregressive drafting [7].
The trade-off is that a corrector which feeds every corrected token back to the next position puts a serial loop, with a vocabulary-sized output at each step, into every decoding round. Our question was whether most of the acceptance that full sequential correction buys can be kept while running most of the block in one batched call. Two further choices matter for the metric. The objective should reward the thing that is measured, the length of the accepted prefix, rather than the likelihood of each token alone. And where verification carries a cost per submitted draft, the number of drafts to submit is itself a decision the drafter should make.
Method
Our drafter, which we call PACR (prefix-anchored causal rectification), has three parts: a parallel block backbone, a causal rectifier on top of it that is decoded sequentially only for the first few positions, and a training and submission rule built around the accepted prefix. The file the run submitted replaces the starter's no-drafter default entirely; the starter only returned the target's own next-token distribution at every position.
The backbone we kept
The backbone is a five-layer stack of decoder layers whose block queries attend to the target's fused features through key/value injection and are non-causal inside the block. The submitted code states that this design is shared by the DFlash-family reference drafters, and we did not change it. A block is the anchor token followed by mask symbols, and its keys and values are the target's features at the positions strictly before the anchor, so training and decoding see the same context. Each layer also carries small grouped convolutions inside the block, around its attention and its MLP (two taps, groups of 16 channels), each with a base kernel that is the identity and a dynamic part that is zero at initialisation. The output of the backbone at block slot is a hidden state , and the provisional logits are produced by the target's own frozen output head,
Slot predicts the token that follows the anchor by positions.
Causal rectification
On top of the backbone we put a recurrent corrector in the style of a sequential head [7]: a one-layer GRU (hidden size 1024) that reads the embeddings of the tokens that precede slot in the block, and a low-rank output map (width 256) that turns the hidden state and the GRU state into a correction of the logits. With the GRU state after the anchor and the first drafted tokens, and with the first slot left uncorrected,
The correction has a full-vocabulary output, so it can promote any token, not only a small candidate set; its input is the whole causal prefix rather than only the previous token.
def _rectify(self, m, hidden, base, prev_ids):
bsz, n, L = hidden.shape[:3]
g = m.prefix_gru(self._emb[0](prev_ids).reshape(bsz * n, L, -1))[0].reshape(bsz, n, L, -1)
corr = m.embed_proj(torch.cat([hidden[:, :, self.PREFIX:], g[:, :, self.PREFIX:]], -1))
return torch.cat([base[:, :, :self.PREFIX], base[:, :, self.PREFIX:] + corr], 2)Prefix-anchored decoding
In training the GRU reads the true preceding tokens. In decoding it has to read the drafter's own tokens, and that is where the choice lies. Feeding every corrected token back is exact but serial. Running one GRU over the provisional tokens is one call, but the provisional tokens are exactly the inconsistent ones the corrector is meant to repair. We take the middle path, and decode the first corrected slots sequentially (the argmax of each corrected is fed to the next step) and then rectify the remaining suffix in a single batched GRU call over the provisional tokens that follow:
Early positions gate every later acceptance, so a mistake there is the most expensive and is the one to repair with the freshest context; late positions are only reached when everything before them was right, so a slightly stale prefix costs less. The call count drops from one per slot to plus one. The rule needs no extra parameters and was applied to checkpoints trained with teacher-forced prefixes, so the depth is a decoding-time choice.
def _auto(self, m, hidden, base, anchor):
bsz, n, L = base.shape[:3]
H = min(3, L - 1)
if H == 0:
prev = torch.cat([anchor, base.argmax(-1)[:, :, :-1]], -1)
return self._rectify(m, hidden, base, prev)
ba = bsz * n
tokens = base.argmax(-1)
first = torch.cat([anchor, tokens[:, :, :1]], -1).reshape(ba, 2)
state = m.prefix_gru(self._emb[0](first))[1]
last = anchor.reshape(ba, 1)
outs = [base[:, :, 0]]
for j in range(1, H + 1):
if j > 1:
_, state = m.prefix_gru(self._emb[0](last), state)
lg = base[:, :, j].reshape(ba, -1)
hg = hidden[:, :, j].reshape(ba, -1)
lg = lg + m.embed_proj(torch.cat([hg, state[0]], -1))
outs.append(lg.reshape(bsz, n, -1))
last = lg.argmax(-1, keepdim=True)
if H < L - 1:
suffix_ids = torch.cat([last, tokens[:, :, H + 1:L - 1].reshape(ba, -1)], 1)
g = m.prefix_gru(self._emb[0](suffix_ids), state)[0]
g = g.reshape(bsz, n, L - H - 1, -1)
corr = m.embed_proj(torch.cat([hidden[:, :, H + 1:], g], -1))
suffix = base[:, :, H + 1:] + corr
outs.extend(suffix[:, :, j] for j in range(L - H - 1))
return torch.stack(outs, 2)Training objective
Training samples up to 512 anchors per conversation, restricted to anchors whose own token and next token are answer tokens, and runs the backbone once over all of them. Two choices define the loss.
Survival weights. For slot let be the probability that the corrected drafter gives to the true next token under the true prefix, and with . The weight of slot is the expected number of accepted tokens at or beyond it,
computed without gradient and over valid slots only. With this is the weight whose weighted cross-entropy has the same gradient as maximising the expected accepted length ; the agent's notes record this identity and attribute the smoothed weighting to DFlash 2's training recipe. The smoothing is the one place where our weights differ from the exact acceptance gradient.
Soft targets and a base-to-corrected curriculum. The target of each slot is not the sampled token but the target model's own next-token distribution at that position, obtained by passing the target's final hidden state through its output head. The loss mixes the base and corrected logits, with the weight moving from the base to the corrected logits over training,
where counts the blocks with at least one valid slot and is the fraction of optimiser steps
done. The curriculum follows the recipe the agent's notes attribute to Domino [7],
teacher forcing with a base-logit stage. The optimiser settings in TRAIN_OVERRIDES are the harness's
documented defaults.
def loss(self, module, batch, aux):
m, L = module, self.cfg["block_len"]
anchors, keep = _sample_anchors(batch["loss_mask"], self.NUM_ANCHORS, aux["generator"])
hidden = _train_blocks(m, self._emb[0], batch, anchors, keep, L, self.cfg["mask_token_id"])
target, valid, prev = self._labels(batch, anchors, keep)
base = self._head[0](hidden)
final = self._rectify(m, hidden, base, prev)
p = torch.softmax(final.float(), -1).gather(-1, target.unsqueeze(-1)).squeeze(-1)
with torch.no_grad():
smooth = (1.0 - self.DPACE_ALPHA) * p + self.DPACE_ALPHA
smooth = torch.where(valid, smooth, torch.ones_like(smooth))
prefix = smooth.cumprod(-1)
w = torch.flip(torch.cumsum(torch.flip(prefix * valid.float(), [-1]), -1), [-1])
w = w * valid.float()
den = valid.any(-1).float().sum() + 1e-6
S = batch["input_ids"].shape[1]
lab = anchors.unsqueeze(-1) + torch.arange(1, L + 1, device=target.device).view(1, 1, -1)
ix = (lab.clamp(min=1, max=S - 1) - 1).unsqueeze(-1).expand(-1, -1, -1, hidden.shape[-1])
tl = torch.gather(batch["target_last_hidden"].unsqueeze(1).expand(-1, anchors.shape[1], -1, -1), 2, ix)
tp = torch.softmax(self._head[0](tl).float(), -1)
ce_b = -(tp * torch.log_softmax(base.float(), -1)).sum(-1)
ce_f = -(tp * torch.log_softmax(final.float(), -1)).sum(-1)
lam = max(0.0, 1.0 - aux["step"] / max(1, aux["total_steps"]))
return lam * (ce_b * w).sum() / den + (1.0 - lam) * (ce_f * w).sum() / denCost-aware submission length
Where each submitted draft carries a cost , the drafter also decides how many of its drafts to submit. If estimates the probability that the first drafts are all accepted, the expected tokens per unit cost of submitting drafts is
and we take the maximum over every , not the first at which it stops rising. With all drafts are submitted.
def _submit_len(survival, cost_c):
"""Choose the prefix maximizing expected tokens per unit verification cost,
(1 + sum_{i<=n} S_i) / (1 + c n), over every n rather than stopping at the
first local decrease. `survival` estimates acceptance of the whole prefix.
With c = 0 every position is submitted."""
B, L = survival.shape
if cost_c <= 0:
return torch.full((B,), L, dtype=torch.long, device=survival.device)
thr = (1.0 + survival.float().cumsum(-1)) / (
1.0 + cost_c * torch.arange(1, L + 1, device=survival.device).float())
return thr.argmax(-1) + 1The estimate is a cumulative product of per-position acceptance probabilities. Raw top-1
probability is overconfident, and a calibrated estimate from the logit margin is underconfident, in
the agent's development measurements, so we use their geometric mean. After training, calibrate
fits for every slot a logistic map from the margin between the top two log-probabilities to the
probability that the slot's top-1 matches the target, on held-out conversations, using only slots
whose earlier slots all matched, by at most 30 damped Newton steps:
with the top-1 probability and the top-two margin at slot .
def _margin_survival(lp, module):
top = torch.topk(lp, 2, -1).values
margin = top[..., 0] - top[..., 1]
calibrated = torch.sigmoid(margin * module.conf_a.float() + module.conf_b.float())
return (top[..., 0].exp() * calibrated).sqrt().cumprod(-1)Results
| Method | ① | ② | ③ | ④ | ⑤ | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| τ, first benchmark ↑ | τ, second benchmark ↑ | τ, third benchmark ↑ | τ, first benchmark ↑ | τ, second benchmark ↑ | τ, third benchmark ↑ | τ, first benchmark ↑ | τ, second benchmark ↑ | τ, third benchmark ↑ | Effective τ, GSM8K ↑ | Effective τ, MATH-500 ↑ | Effective τ, AIME25 ↑ | Effective τ, HumanEval ↑ | Effective τ, MBPP ↑ | Effective τ, LiveCodeBench ↑ | Effective τ, MT-Bench ↑ | Effective τ, Alpaca ↑ | Effective τ, Arena-Hard v2 ↑ | Speed-up, batch 1 ↑ | Speed-up, batch 16 ↑ | |
| Kimi K3.1 Pro | 5.773 | 5.497 | 4.899 | 4.767 | 4.485 | 5.060 | 2.981 | 2.813 | 3.061 | 4.349 | 4.182 | 3.763 | 3.677 | 3.466 | 3.888 | 2.434 | 2.302 | 2.525 | 1.504 | 1.547 |
| No drafter | 1.014 | 1.007 | 1.006 | 1.004 | 1.002 | 1.001 | 1.002 | 1.003 | 1.007 | 0.751 | 0.746 | 0.745 | 0.743 | 0.743 | 0.742 | 0.742 | 0.743 | 0.746 | 0.812 | 0.741 |
| Medusa-1 | 2.776 | 2.772 | 2.421 | 2.258 | 2.346 | 2.157 | 1.761 | 1.698 | 1.622 | 2.364 | 2.358 | 2.094 | 1.955 | 2.020 | 1.884 | 1.569 | 1.517 | 1.431 | 1.421 | 0.985 |
| EAGLE-3 | 5.192 | 5.008 | 4.422 | 4.280 | 4.005 | 4.598 | 2.677 | 2.512 | 2.834 | 3.922 | 3.815 | 3.404 | 3.305 | 3.116 | 3.541 | 2.222 | 2.095 | 2.346 | 1.940 | 1.076 |
| DFlash | 5.292 | 5.040 | 4.443 | 4.294 | 4.034 | 4.580 | 2.740 | 2.576 | 2.805 | 4.057 | 3.891 | 3.475 | 3.385 | 3.192 | 3.596 | 2.305 | 2.179 | 2.362 | 2.309 | 1.348 |
| DSpark | 5.704 | 5.375 | 4.795 | 4.597 | 4.365 | 4.878 | 2.858 | 2.694 | 2.890 | 4.287 | 4.063 | 3.660 | 3.529 | 3.352 | 3.740 | 2.342 | 2.215 | 2.387 | 2.272 | 1.346 |
| DFlash 2 | 5.804 | 5.534 | 4.987 | 4.776 | 4.491 | 5.106 | 2.991 | 2.814 | 3.097 | 4.349 | 4.164 | 3.791 | 3.632 | 3.426 | 3.897 | 2.427 | 2.285 | 2.538 | 2.486 | 1.202 |
| Domino | 5.661 | 5.374 | 4.785 | 4.587 | 4.365 | 4.826 | 2.913 | 2.749 | 2.900 | 4.265 | 4.080 | 3.680 | 3.540 | 3.372 | 3.725 | 2.399 | 2.267 | 2.412 | 2.297 | 1.349 |
| Gumiho | 4.340 | 4.065 | 3.564 | 3.239 | 3.319 | 3.241 | 2.378 | 2.281 | 2.244 | 3.419 | 3.222 | 2.873 | 2.648 | 2.698 | 2.671 | 2.029 | 1.953 | 1.953 | 1.844 | 1.170 |
| PARD | 5.218 | 5.090 | 4.536 | 4.271 | 3.994 | 4.443 | 2.876 | 2.729 | 3.229 | 3.995 | 3.922 | 3.539 | 3.374 | 3.168 | 3.508 | 2.395 | 2.291 | 2.667 | 1.812 | 1.171 |
- ① Qwen3-4B target · one trained drafter, 7 drafts per round · GSM8K / MATH-500 / AIME25
- ② same drafter · HumanEval / MBPP / LiveCodeBench
- ③ same drafter · MT-Bench / Alpaca / Arena-Hard v2
- ④ same drafter · all nine benchmarks · priced verification (c = 0.05)
- ⑤ same drafter · decoding speed-up over plain decoding, batch 1 and batch 16
All metrics are higher-is-better. On Math, Code and Chat, PACR is second on eight of the nine columns, each time behind DFlash 2, and third on the ninth, behind PARD and DFlash 2. On Math, for example, PACR reaches 5.773, 5.497 and 4.899 on the three columns against DFlash 2's 5.804, 5.534 and 4.987. On Code the gap is small on the first two columns (4.767 against 4.776, and 4.485 against 4.491) and larger on the third (5.060 against 5.106). On Chat, PACR is level with DFlash 2 on the second column (2.813 against 2.814) and behind both DFlash 2 and PARD on the third (3.061 against 3.097 and 3.229). On the eight columns where it is second, it is ahead of every other published baseline, including DSpark and Domino. From the means alone we cannot say whether the differences of a few hundredths to DFlash 2 are larger than run-to-run variation.
On Priced, which prices verification, PACR has the highest value of the published baselines and ours on five of the nine columns (columns 2, 4, 5, 7 and 8), and on column 1 it is level with DFlash 2 (4.349 against 4.349). On column 4 it is 3.677 against DFlash 2's 3.632, and on column 5 3.466 against 3.426. DFlash 2 is ahead on columns 3 and 6 (3.763 against 3.791, and 3.888 against 3.897), and on column 9 PACR is third, behind PARD and DFlash 2 (2.525 against 2.667 and 2.538).
Speed-up is where the picture is mixed. On the second column PACR has the highest measured speed-up of the published baselines and ours, 1.547 against 1.349 for Domino, the strongest baseline there. On the first column it is 1.504, ahead of Medusa (1.421) but behind every other published drafter, with DFlash 2 at 2.486. We did not expect this: the agent's one-prompt live timing in development put an earlier version of the drafter ahead of DFlash 2 end to end. We did not isolate the cause, and the gap on this column is the largest in the table.
How we got here
All development numbers below are the agent's own acceptance lengths on public conversations it generated from the target's answers, replayed with exact greedy verification round by round; they are not the task's measurements.
Diagnosis. The agent began by reading the harness and comparing every reference drafter. Its assessment was that the strong references share a five-layer parallel block backbone, and that the open problem was not another head but the train-to-decode mismatch of masked, conditionally independent drafts. It built its own simulator of greedy decoding rounds, because token accuracy alone does not predict accepted length, and found and fixed several bugs in it (padding handling, a batch dimension, post-end-of-sequence tokens) before trusting a number.
First design: one-shot rectification. The first candidate produced a provisional block in parallel, encoded the proposed tokens with a causal prefix encoder and corrected all positions in one batched call. At 512 steps it did not beat the stronger references. With a matched backbone and weighting, the one-shot corrector reached 1.48225 against 1.49423 for a sequential Domino-style corrector and 1.48163 for DFlash 2, and the notes say the one-shot version kept later positions less accurate than the sequential one, which fits stale provisional prefixes.
Dead ends. Several things were tried against that gap and dropped:
- a self-prefix auxiliary loss and a second rectification iteration did not help (1.3753 and 1.3777, against 1.3901 for the plain one-shot corrector in an earlier unmatched comparison);
- a recurrent candidate lattice, a GRU scoring a small candidate set, ended at 1.463 against 1.482 for DFlash 2 at the same schedule;
- horizon-specific feature queries sat about 0.02 below their paired backbone and were stopped;
- a hidden-state rectifier that applies the frozen output head once to corrected states finished below the one-shot corrector on both seeds;
- initialising layers from the target helped a DFlash-style backbone (1.4146 against 1.3752) but hurt the lattice badly (1.27 at step 384). The final drafter does not load pretrained weights;
- a direct expected-accepted-length objective on a DFlash backbone gave 0.0049 more, which the agent judged not meaningful.
The hybrid. The idea that became PACR came from where one-shot correction failed: the first stale provisional token. The agent tested correcting only the first one or two positions sequentially and the rest in one call, on weights that needed no retraining. The first implementation was wrong (its recurrent state started from the anchor alone, while the sequential head starts from the anchor and the first base token), and the agent discarded its numbers and checked the fixed version against the fully sequential control. On a checkpoint trained on an expanded corpus the corrected results were 1.7070 for the pure one-shot rule, 1.7153 for two sequential positions, 1.7169 for three and 1.7181 for fully sequential decoding. The agent kept three as the compromise, with DFlash 2 at 1.6978 on the same holdout. These comparisons used hard cross-entropy checkpoints, and the same checkpoint was re-evaluated under each rule, so they are paired.
The submission length. The agent first tested the margin-calibrated survival estimate alone. It beat raw top-1 survival at one tested cost and lost to it at lower costs, so the agent tried the geometric mean, which won at all three costs it tried. At the middle one, on 96 held-out conversations, the blend gave 1.42198 against 1.41733 for raw survival and 1.41563 for the calibrated estimate. It also tested full sequential correction for the cost-aware setting, which gained 0.00007 and was not adopted. The exact search over all prefix lengths stayed, though the agent noted that it usually coincides with the reference's stop at the first decrease.
Objectives, and the last change. The agent tried three further objectives. Occupancy-matched anchors, which score only the positions a simulated decode actually starts from, were worse at mid-training (1.60143 against 1.64277 at step 512) and were dropped. A direct greedy-ranking loss (cross-entropy plus a margin against the strongest alternative) failed at its first checkpoint (1.101 against 1.237). The last, soft-target distillation from the target's full distribution, was tried late, motivated by the possibility that sampled training tokens differ from the target's greedy choice. In the shortest, single-pass comparison it gave +0.0127 and +0.0100 on two seeds; on that evidence the agent adopted the soft targets and re-ran the fixed training path on one and four GPUs with them. In longer multi-pass schedules run afterwards the gap grew: against the matched hard-cross-entropy run, the best soft-target checkpoint of the longest comparison that finished in the trace reached 1.79049 and 1.79197 on two seeds against 1.72361, with hard cross-entropy overfitting the repeated corpus while the soft-target runs did not.
Limitations
- Not the leader on Math, Code and Chat. DFlash 2 is ahead of PACR on every one of those nine columns, and on the third column of Chat PARD is ahead as well. PACR's claim there is, on eight of the nine columns, to be close to DFlash 2 and ahead of the rest.
- The speed-up on the first column of Speed-up is poor. The corrector adds up to three sequential recurrent steps, each with a vocabulary-sized output, on top of a backbone that already attends over the whole context. That is the part of our design we would examine first, but we did not measure it against this column, and the agent's own one-prompt timing pointed the other way. Both observations are real and we cannot reconcile them.
- Development evidence is narrow. Most comparisons used one or two seeds and held-out sets of 64 to 256 conversations, and the agent's own note puts ordinary seed-to-seed variation at about 0.01. The hybrid-depth gain over the one-shot rule (about 0.01) is paired on identical checkpoints, but is of that size.
- The large soft-target gains came with multi-pass training. In the single-pass comparisons the gain was about 0.01; the gap of several hundredths came from longer multi-pass schedules, and was largest in those in which hard cross-entropy overfits a small corpus. How much of that carries to the fixed training regime we did not measure.
- The train-to-decode mismatch is reduced, not removed. The corrector trains on true prefixes and decodes on its own tokens, and past the first three corrected slots on stale provisional tokens. The self-prefix loss that targeted this did not help in development.
- Much of the machinery is borrowed. The backbone, the recurrent correction head, the survival weighting and the base-to-corrected curriculum follow reference drafters, and our contribution is the prefix-anchored decoding rule, the soft-target objective with survival weights, and the blended exact-search submission length. We did not ablate each of these on the final design against the published baselines.
- The cost-aware gains are small. The blended survival estimate beat its two components by a few thousandths of a token in development, tested at three costs of our choosing.
- We changed one file only, the method file, and all of its editable region.
References
- Yuhui Li, Fangyun Wei, Chao Zhang et al. (2025). EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Test. NeurIPS.
- Tianle Cai, Yuhong Li, Zhengyang Geng et al. (2024). Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads. ICML.
- Jian Chen, Yesheng Liang, Zhijian Liu (2026). DFlash: Block Diffusion for Flash Speculative Decoding. ICML.
- Zihao An, Huajun Bai, Ziqiong Liu et al. (2026). PARD: Accelerating LLM Inference with Low-Cost PARallel Draft Model Adaptation. ICLR.
- Jinze Li, Yixing Xu, Haiduo Huang et al. (2025). Gumiho: A Hybrid Architecture to Prioritize Early Tokens in Speculative Decoding. ICML.
- Xin Cheng, Xingkai Yu, Chenze Shao et al. (2026). DSpark: Confidence-Scheduled Speculative Decoding with Semi-Autoregressive Generation.
- Jianuo Huang, Yaojie Zhang, Qituan Zhang et al. (2026). Domino: Decoupling Causal Modeling from Autoregressive Drafting in Speculative Decoding.