Speculative Decoding vs. Text Diffusion: A Detailed Comparison of Two LLM Decoding Approaches
This article examines the decoding bottleneck in generative text models and compares two ways of addressing it: speculative decoding and multi-token prediction, which speed up the existing autoregressive paradigm, and discrete text diffusion with block-parallel denoising, which replaces sequential generation with parallel block generation. It walks through the core mechanism of each, their quality and speedup trade-offs, and how the two relate to one another, then offers practical guidance on when to choose each approach, along with notes on quantization, layered evaluation, and deployment.
1. Where Does the Decoding Bottleneck Actually Sit?
Inference for generative text models splits into two phases: Prefill, which encodes the input context in a single parallel pass, and Decode, which generates tokens one at a time. Prefill is typically compute-bound, while Decode is usually memory-bound: every token requires moving all the weights and the KV Cache from GPU memory into the compute units, yet the vector that actually participates in the matrix operations is often just a single token.
This leads to a counterintuitive conclusion: during single-request Decode, the GPU’s compute units sit idle most of the time. Batching tries to fill that compute by packing many requests into one matrix, but the cost is single-user latency (TTFT, TPOT), which suffers from queuing and intra-batch alignment. So the optimization goals naturally fork into two paths:
- Keep the generation paradigm unchanged and make one forward pass emit more valid tokens — multi-token prediction, draft models, and speculative decoding all belong to this family.
- Change the generation paradigm so one forward pass truly produces a span of text in parallel — discrete text diffusion and its block sampling belong to this family.
Understanding this fork is the key to understanding why these two techniques are often discussed together, yet are not a simple either/or replacement.
2. Path One: Autoregressive + Multi-Token Prediction / Speculative Decoding
2.1 Core mechanism
Autoregression is fundamentally a chain decomposition: P(x) = Π P(xt | x{<t}). It imposes a strong ordering constraint on tokens and is naturally hard to parallelize. Multi-Token Prediction (MTP) adds extra prediction heads for each position during training, so a single forward pass can produce multiple candidate tokens. Speculative Decoding goes a step further: a lightweight draft model (or multi-prediction heads sharing the main backbone) guesses K candidates in a row, and then the main model verifies them all in one parallel pass.
The crucial point is that verification is cheap: the main model has to run one forward pass over the K candidate positions anyway, which compresses what would have been K serial forward passes into a single one while yielding the distribution for all K positions. During verification, positions are compared one by one; at the first mismatch, all subsequent drafts are discarded and generation rolls back.
Illustrative logic:
def speculative_decode(prompt, draft, target, gamma=5):tokens = [prompt]while True:# Draft model guesses gamma candidates in a row (may take shortcuts)draft_tokens = draft.generate(tokens, num_tokens=gamma)# Target model gets the target distribution for gamma+1 positions in one parallel forward passlogits = target.forward(tokens + draft_tokens) # shape: [K+1, V]accepted = 0for i in range(len(draft_tokens)):p = softmax(logits[i])q = draft_tokens[i].prob# Rejection sampling: accept with probability min(1, p/q)if rand() < min(1.0, p[0] / q[0]):accepted += 1tokens.append(draft_tokens[i])else:# On mismatch, resample one token from the residual distribution# and discard all subsequent draftstokens.append(sample_from_residual(p, q))breakif accepted == len(draft_tokens):tokens.append(sample(softmax(logits[-1])))return tokens
Three engineering details are worth making explicit:
- The output distribution is not rewritten. Standard speculative decoding, combined with rejection sampling, can be proven to produce a final distribution identical to token-by-token sampling from the target model. This is the root reason its quality is “stable.”
- Speedup depends on the acceptance rate. The ideal speedup approaches K+1, but the real number depends on draft quality, task predictability, and batch size. With very large batches, the main model is already saturating the compute, so the gains from speculation are significantly diluted.
- The draft must be cheap. If the draft model is too large, it guesses well but computes slowly, and the net gain can turn negative.
2.2 Advantages and costs
Advantages: excellent compatibility — it does not alter the semantic structure of the weights and does not depend on a specific sampler; it can be layered onto an existing inference stack; and it is theoretically lossless in output quality.
Costs: it is still a “write left to right” sequential paradigm, so the speedup ceiling is bounded by the length of a single-step guess; the draft model adds extra memory overhead and implementation complexity; and in high-throughput scenarios (large batches, high concurrency) the gains decay noticeably.
3. Path Two: Discrete Text Diffusion and Block-Parallel Denoising
3.1 Core mechanism
Text diffusion rewrites generation from “sampling position by position” to “denoising an entire sequence.” During training, masking or replacement noise is applied to the token sequence according to a noise schedule. During inference, generation starts from a high-noise state (a canvas full of [MASK] / placeholders); in each round the model predicts the distribution for all masked positions in parallel, then unmasks part of them at once.
Its parallelism does not come from “guessing a few” tokens — it comes from the fact that the position dimension itself is never serialized. A single forward pass can refresh many positions across a whole block simultaneously. Illustrative pseudocode:
def diffusion_decode(prompt, length=256, steps=64):# canvas: a placeholder region filled entirely with noisecanvas = [MASK] * lengthprefix = promptfor step in reversed(range(steps)):# One forward pass predicts the distribution for the whole block in parallellogits = model.forward(prefix + canvas)keep = noise_schedule.num_to_unmask(step) # how many positions to reveal this round# Pick the highest-confidence positions; keep the rest maskedidx = topk_confidence(softmax(logits), keep)for i in idx:canvas[i] = sample(softmax(logits[i]))return prefix + canvas
In practice, a single global noise level is rarely used alone. Instead, systems adopt block-autoregressive, multi-canvas sampling: an outer loop advances left to right block by block to keep long-form text coherent, while an inner loop hands each block (for example, a 256-token canvas) to the diffusion process for parallel denoising and iterative correction. This mirrors the intuition from image diffusion: a blurry outline emerges first, then grammar, detail, and transitions are filled in and refined step by step.
3.2 A public configuration example
A recently published MoE text-diffusion experimental model from a research team has roughly the following configuration: about 26B total parameters, about 3.8B activated per token, 30 layers, 8 experts activated out of 128 with 1 shared expert, a context length up to 256K, a single canvas length of 256 tokens, and a permissive Apache 2.0 license. The role of MoE here is to lower the activated compute per forward pass, so the total cost of “many denoising iterations” does not spiral out of control — a key constraint on whether text diffusion can be practical at all.
3.3 Advantages and costs
Advantages: the position dimension is naturally parallel, which suits consumer-grade GPUs and local deployment; the number of valid tokens produced per forward pass far exceeds that of autoregression; because the whole block is visible, it naturally supports intermediate edits and conditional editing — filling blanks, fixing errors, or rewriting a segment without re-running the entire text; and parallel denoising during training is friendlier to compute utilization.
Costs: it requires multiple iterations, so the total number of forward passes is often higher than autoregression, and the benefit hinges entirely on whether the inequality “parallel gains > iteration overhead” holds; the training objective and the sampler (masking strategy, confidence ranking, re-masking ratio) introduce new, tuning-sensitive hyperparameters; capabilities such as output quality, instruction following, tool calling, and structured output are still catching up to mature autoregressive models; and the inference stack and ecosystem support are thin, so existing optimizations such as quantization, caching, and batching cannot be carried over directly.
4. The Essential Relationship Between the Two Paths
This can be summarized as follows:
| Dimension | Autoregressive + Speculative Decoding | Text Diffusion + Block Denoising |
|---|---|---|
| Changes the generation paradigm? | No — still sequential token-by-token generation | Yes — block-parallel generation with iterative correction |
| Source of parallelism | Verifying multiple candidate positions in one pass | The position dimension itself is never serialized |
| Quality risk | Low — distribution provably identical | Medium — depends on the sampler and training adequacy |
| Speedup ceiling | Bounded by candidate length and acceptance rate | Bounded by iteration count and model size |
| KV Cache friendliness | High | Low — the caching mechanism must be redesigned |
| Ecosystem maturity | High | Early stage |
| Extra capabilities | None | Controllable intermediate states, local editing |
In one sentence: speculative decoding bolts an accelerator onto the old paradigm, while text diffusion changes the way the writing is done. The two are not competing on the same axis — the former optimizes “how many to guess per step,” while the latter optimizes “how much to write at once.”
5. Selection and Practical Recommendations
- When to prefer speculative decoding: you already run a mature autoregressive service, you have high demands on output quality and compatibility, concurrency is moderate, and you need to ship fast. This is the highest return-on-investment starting point.
- When to prefer text diffusion: local or edge GPU deployment, interactive generation and rewriting tools, scenarios that need “generate-while-editing” intermediate-state interaction, and long-context drafting tasks.
- Quantization and precision: whichever path you take, evaluate quantization schemes before deployment. Post-Training Quantization (PTQ) is quick to adopt but may cost precision; Quantization-Aware Training (QAT) inserts pseudo-quantization nodes and fine-tunes to compensate for the error, which suits quality-sensitive scenarios where the training cost is acceptable. For MoE structures, pay extra attention during quantization to expert-level outliers and routing jitter.
- Evaluation must be layered. Do not report a single “total throughput” number. At minimum, report first-token latency (TTFT), per-user inter-token latency (TPOT), total system throughput (tokens/s), cost per token, and quality metrics (perplexity, task accuracy, long-form consistency, structured-output compliance rate). Text diffusion’s TTFT advantage and its TPOT behavior need to be examined separately, because it emits a whole block at once.
- Deployment form: containerize the model service on a container platform with GPU resource pools and elastic scaling; add a logging service for request-level tracing, monitoring and alerting for latency percentiles and error-rate alerts, and object storage to archive input/output samples for offline review. On Baidu AI Cloud, the combination of “container platform + logging service + monitoring and alerting + object storage” is sufficient to support the observability and cost accounting of an inference service like the one described above.
- Always run A/B tests and canary rollouts. A new decoding paradigm involves tuning sampling parameters, so roll it out gradually by traffic percentage, then compare acceptance rate, the distribution of iteration counts, timeout rate, and manual quality scores before a full launch.
6. Conclusion
Text diffusion represents a challenge to the fundamental assumption of “sequential generation.” It shifts the decoding bottleneck from “moving the weights once per token” to “how to write a whole block correctly in fewer iterations.” Multi-token prediction and speculative decoding, by contrast, leave that assumption untouched and simply push existing hardware utilization higher. In the short term, the sound engineering path is still “autoregressive as the backbone, speculative decoding for efficiency,” while tracking text diffusion’s quality curve and sampler maturity with small-scale experiments. Once parallel gains reliably outweigh iteration overhead and the ecosystem tooling is filled in, block-parallel generation is likely to first prove its real advantage in local deployment and interactive editing scenarios.
