Blockwise and Semi-Autoregressive Generation › Blockwise Parallel Decoding

Michael BrenndoerferNovember 17, 20265 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 137Blockwise and Semi-Autoregressive Generation › Blockwise Parallel Decoding
Reading section 4 of 11 · Blockwise Parallel Decoding · 5 minSection 4 of 11 · 5 min

Section 4 of 11 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Stern, Shazeer, and Uszkoreit (2018) train proposal predictors for offsets two through kk. The first proposal is the original autoregressive model's greedy next token. The other predictors use the same committed prefix. The verifier then runs the original model on the proposed continuations, allowing position ii to condition on earlier proposals. The first proposal already matches by construction. The algorithm appends the longest agreeing contiguous prefix.

The worked example uses a related greedy draft-and-verify procedure. It allows an independent draft, then uses the target to ensure progress even when no draft token agrees. Begin from a committed prefix y≤ty_{\le t}. The target's greedy choice at the next position is the token with largest conditional probability. Choose a fixed tie-breaking rule and use it in the baseline and verifier.

  1. Draft. Propose up to kk tentative tokens y~t+1,…,y~t+k\tilde y_{t+1},\ldots,\tilde y_{t+k}. In the example a small autoregressive table proposes them sequentially. A parallel proposal head is also possible.
  2. Verify. Supply all the proposed tokens together as a known extension. The target evaluates p(⋅∣y≤t,y~t+1,…,y~t+i−1)p(\cdot\mid y_{\le t},\tilde y_{t+1},\ldots,\tilde y_{t+i-1}) for proposal position ii. A causal attention mask prevents position ii from seeing later proposals. In a Transformer implementation the conditionals can be evaluated in one batched pass, with the first-position distribution possibly available from the cached prefix.
  3. Accept the longest agreeing prefix. Let mm be the number of consecutive matches from the start. Append those mm tokens.
  4. Continue with the target. At the first disagreement, use the target's greedy choice at position m+1m+1. If the whole proposal agrees, the algorithm can use the extra target score after the final proposal when the pass also produced that score. EOS and output-budget limits take precedence.

The greedy guarantee follows from the prefixes. Before the first proposal, the target verifier and the baseline are conditioned on the same committed text. If the verifier accepts that proposal, it appends the same token as the baseline. Inductively, the prefixes continue to match throughout the agreeing part. At the first disagreement, the verifier's target choice is the baseline's next token under that still-matching prefix. After appending it, the next iteration starts from the new verified prefix. With no EOS or length stop before the iteration, the verification and correction step commits at least one token.

Scores After the First Rejected Proposal

The first disagreement occurs at proposal position m+1m+1. Its target score uses a prefix consisting entirely of committed tokens and agreeing proposals, so the score can supply the correction. At positions i>m+1i>m+1, the verifier's scored prefixes already contain the rejected proposal. Scoring the same continuation after replacing that token requires the corrected prefix. A tree-based verifier may already have scored this other prefix if the tree contained it.

Verifying with a KV Cache

A target runtime can score an extension while filling provisional entries in the KV cache. It then retains the entries for the accepted prefix and invalidates later entries. Depending on the cache layout this might mean changing its valid length or releasing pages. The correction or extra token needs an entry of its own before its keys and values become part of a subsequent prefix. The draft model also needs its state to match the new sequence before it drafts again. These cache operations affect latency even when the greedy output is identical.

One practical alignment check is to write the candidate predictions beside the inputs used to produce them. With prefix of length tt and a draft of length three, the logits from the prefix's last position supply the prediction at t+1t+1. The logits from the first draft position supply the prediction at t+2t+2. The logits from the second draft position supply the prediction at t+3t+3. The logits from the last draft position can supply an extra token at t+4t+4. This follows the usual next-token convention where the output at an input position predicts the following position. It is easy to be off by one here if the scoring API returns only logits for the newly submitted positions.

If the second proposal fails verification, its cache entry and the third proposal's entry must be invalidated. The first proposal's entry can remain because earlier inputs at that location agreed and the target is causal. Replacing the second proposal with the target's correction changes the required state from that position onward. Leaving the rejected entries physically allocated is fine if the runtime keeps them outside the valid prefix.

Relaxed Verification

Stern and colleagues also test verification that accepts a proposal when it ranks among the target's top kk choices. This can increase the length of accepted blocks. It drops the greedy equality guarantee when it permits a choice below the target's top rank. Section 5 and the reported experiments in the paper explain how this relaxation changes the quality and latency trade-off.

End of Sequence and Output Budget

A committed EOS ends generation. The draft stops proposing after a tentative EOS. The verifier can reject that proposal and continue from its replacement when the replacement is nonterminal and the budget allows. The decoder counts committed EOS against the output budget and excludes the supplied BOS. An exhausted budget suppresses any extra token.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy