< Will Bosler

DFlash ·

DFlash is a speculative decoding technique that increases speed by reducing the time the draft model takes to generate its tokens. In vLLM's benchmark on Math500 with gemma-4-31B-it, DFlash reaches 3,197 tokens per second against a baseline of 1,365, a 2.34x speed up.

0:05 / 0:06

It achieves this using block diffusion. Rather than proposing tokens one at a time, the draft model predicts a whole block of tokens in parallel. The target model then verifies the block as before.

0:02 / 0:10

To do this, the draft uses bidirectional attention, in which every position in the block attends to every other, rather than the causal attention of autoregressive LLMs, in which each position sees only those to its left. The block begins with an anchor, the target's newest token, followed by masks for the slots to be filled. As the masks are blank, looking right leaks nothing.

0:02 / 0:21

A single forward pass fills every slot, so the cost of drafting barely grows with the size of the block. The target model still verifies causally, which preserves the sequential dependence, or temporal cohesion, between the tokens. We gain the extra tokens from the draft for little additional time.

This raises a question: why not predict in parallel with the target model itself? Ultimately, there is no free lunch. Historically, parallel prediction has produced poor outcomes, because each slot in the block has no knowledge of what the others will pick.

0:02 / 0:25

Consider the prompt “Fly to” followed by two blank slots for a city name. On their own, “Los” and “New” are equally probable for the first slot, as are “Angeles” and “York” for the second. Each slot picks alone, and the result can be “Los York”: each token is likely by itself, but together they are not a city.

Once “Los” is locked in, it becomes obvious that the next token should be “Angeles”. This is where the temporal cohesion of autoregressive models comes into play, and bidirectional prediction gives it up.

How, then, does the draft produce tokens that are accepted often enough to make speculative decoding worthwhile? First, every proposal is still verified by the causal target, so a poor draft can only cost speed, never correctness.

0:02 / 0:19

In the worst case, we do not accept the whole block. This is acceptable, since the cost of the verification pass is amortised and the target still contributes a token of its own. Here, “Los” is accepted, “York” is rejected in favour of “Angeles” and the remainder of the block is dropped: two tokens from a single verification pass.

Second, DFlash fuses features from the target model into the cheaper draft model. The DFlash paper finds that this is enough to steer the draft towards good predictions. Within the target's features, before any future tokens have been predicted, there is already enough signal to indicate what is likely to come next. The draft leverages this to predict several tokens at once.

0:02 / 0:37

Provided enough of the drafted tokens are accepted, and drafting them is fast, the result is a net improvement in speed. The paper benchmarks this and finds that it holds, which has made DFlash such a popular technique.

0:02 / 0:11

In summary, DFlash drafts in parallel, steered by features from the target. The target then performs its causal pass with standard rejection sampling, ensuring that the output follows the target model's own distribution.