Diffusion Language Models, MTP, and QAT Explained: Decoding Strategies for Faster LLM Inference
A practical guide to three complementary techniques for accelerating large language model inference: diffusion language models (block-level parallel denoising), multi-token prediction (MTP) with speculative decoding, and quantization-aware training (QAT). The article explains why autoregressive decoding is bottlenecked by memory bandwidth, how each technique changes—or leaves unchanged—the way tokens are generated, what each one costs and risks, and how to choose, combine, and validate them for real deployments. It includes pseudocode, a side-by-side comparison, scenario-based selection advice, and a pre-launch verification checklist.
1. Introduction: Decoding Is the New Battleground for LLM Inference
A common question in large language model (LLM) engineering is this: given similar parameter counts and similar hardware, why does one service stream tokens quickly while another is painfully slow? The answer usually does not live in the model’s parameter table. It lives in the decoding step—the moment the model decides how to produce the next token.
For the past few years, autoregressive decoding has been the de facto standard. It strictly generates one token at a time, unfolding left to right. Consider a request that generates several hundred tokens: the model must read the same set of weights several hundred times over, and the bottleneck typically sits in memory bandwidth rather than floating-point compute.
The industry has since developed several complementary optimization routes:
- On the precision side, quantization-aware training reduces the amount of data that must be moved and computed for weights.
- On the scheduling side, multi-token prediction (MTP) paired with speculative decoding lets the main model confirm several candidates at once.
- On the generation paradigm side, diffusion language models replace “writing one token at a time” with “draft a whole block, then refine repeatedly.”
These routes are often discussed under a single heading, which makes it easy to assume they are the same kind of thing. In reality they operate on different technical dimensions. Each can be used on its own, or they can be stacked. Clarifying “who changes the way tokens are generated, who merely accelerates the confirmation process, and who reduces the cost of each computation” is the first step toward good inference-deployment decisions.
2. The Autoregressive Bottleneck: Why Writing One Token at a Time Is Slow
2.1 Two phases: compute-bound and memory-bound
Take the mainstream decoder-only architecture as an example. Autoregressive generation roughly splits into two phases.
Prefill phase: The user’s entire prompt is encoded in parallel. The matrix multiplications are large and compute-unit utilization is high, making this a compute-intensive phase. This phase determines the time to first token (TTFT).
Decode phase: To generate each new token, the model runs a full forward pass, reads all the weights, references the Key/Value cache for all previous positions, and ultimately produces only a small vector—the probability distribution for a single token. Each step moves a huge amount of data while doing very little effective computation, making this a classic memory-bound phase. The interval between each output token (TPOT)—the “streaming speed” the user actually perceives—is determined primarily by this phase.
2.2 The serial bottleneck through the roofline lens
The roofline model helps explain this. In it, the performance a piece of hardware can actually achieve is bounded by two limits: a compute ceiling and a bandwidth ceiling. The point where they intersect is set by arithmetic intensity—how many floating-point operations correspond to each byte moved from memory.
In the decode phase, reading the weights once means each weight value typically participates in a single multiply-accumulate. Arithmetic intensity is close to 1, far below the ratio of peak compute to bandwidth on a GPU, which can run into the hundreds. As a result, decode speed depends almost entirely on memory bandwidth, while high-throughput units such as Tensor Cores sit largely idle.
At the same time, the sequential dependency of generating one token at a time makes it hard to split the work across multiple units that can run in parallel. At low batch concurrency, this serial structure leaves most of the compute idle for long stretches.
2.3 The hidden cost of the KV cache
To let the model “remember” the context when generating a new token, the decode phase caches the Key and Value for all previous positions. This cache has a price:
- It grows linearly with context length and keeps consuming memory.
- It must be re-read on every decode step.
The longer the context, the greater the memory-access pressure and the slower the decoding. Reducing “the amount of data that must be moved per output token” therefore becomes the core problem of decode optimization.
3. Discrete Diffusion Language Models: Turning “Writing” into “Drafting and Polishing”
3.1 From image diffusion to text diffusion
Diffusion models were originally used for image generation: starting from a pure-noise image, they denoise repeatedly, gradually revealing outlines, structure, and finally detail. Text is inherently discrete—there are no continuous pixel values to “denoise.” Diffusion language models address this by using “masks” to express “not yet determined”:
- Every position on a canvas carries a special marker indicating that the token has not yet been revealed.
- At each step, the model can predict the content of all pending positions on the canvas in a single pass.
This form is called masked discrete diffusion, and it is one of the mainstream technical routes for diffusion language models today.
3.2 The decoding flow: draft the whole block, then refine repeatedly
If autoregressive decoding is like a person writing an article from left to right, word by word, discrete diffusion decoding is more like laying out a draft sheet, writing out the whole passage, and then revising it over and over. Take a text block of length 256 (commonly called a “canvas” in diffusion decoding). Decoding roughly proceeds through these steps:
- Set up the canvas: Every position on the current canvas is filled with a pending marker; before the canvas lies the already-determined history.
- Parallel prediction: The model runs one forward pass, modeling the state of all positions; each pending position gets a candidate token and a confidence score. This is something autoregressive decoding cannot do—it can only determine one position.
- Selective retention: Positions are revealed according to a predefined policy. Common approaches include:
- Keep the few highest-confidence positions, with the count increasing as denoising progresses and slowing toward the end;
- Allow low-confidence positions to “reconsider” and become pending again in later steps;
- Decide which positions are best revealed first based on the strength of their dependency on already-revealed content.
- Iterative refinement: Revealed positions become new context, and the model re-predicts the remaining positions. Semantically related content becomes clearer, and grammar and details are corrected along the way.
The whole process closely resembles “outline first, details later” in image diffusion, as illustrated below:
Step 0: [?] [?] [?] [?] [?] [?] [?] [?] # Draft the whole block with pending markersStep 1: [data] [?] [?] [?] [process] [?] [?] [?] # After parallel prediction, fill in the highest-confidence positions firstStep 2: [data] [need] [?] [preprocess] [process] [?] [?] [?] # Semantically related positions are progressively revealedStep 3: [data] [need] [first] [preprocess] [process] [then] [train] [?] # Nearly completeStep 4: [data] [need] [first] [preprocess] [process] [then] [train] [model] # Canvas generation complete
3.3 Generating a full document: block-level autoregression
If every block “guesses by looking at the future” and blocks lack strong constraints between them, a whole document easily becomes internally inconsistent. A common solution is block-level autoregression: split the output into text blocks of fixed length and generate them one block at a time. Once a block is determined, it is appended to the context and serves as history for decoding the next block.
This produces two nested levels of looping:
- Intra-block parallelism: Within a block, denoising runs in parallel and multiple positions are revealed simultaneously.
- Inter-block autoregression: A clear order is still maintained from one block to the next.
3.4 Why parallel denoising shifts the bottleneck from memory bandwidth toward compute
To understand how diffusion decoding accelerates in a different way, we need to return to the performance bottleneck of autoregressive decoding.
Each autoregressive step reads the model weights and the KV cache but produces only one token. In this mode, each read of the weights serves the prediction of a single position. Parallel denoising merges the predictions of multiple positions into the same forward pass: one read of the weights can update a batch of pending positions on the canvas. The cost of moving the weights is amortized across multiple tokens, and arithmetic intensity rises accordingly.
For specialized accelerators with a high ratio of compute to bandwidth performance, this structure gives previously idle compute units more work to do, shifting the constraining factor for decoding partially from memory bandwidth toward compute capacity. This is the core mechanism of diffusion-style decoding, and the fundamental reason it can deliver significant throughput gains.
This benefit also has prerequisites. If the model is small, or the hardware already has ample bandwidth but limited compute, the bottleneck may remain on the memory-access side and the gains will be discounted. Acceleration numbers in public technical reports are typically measured under specific hardware and workload combinations; actual gains vary with model structure, context length, block length, number of denoising steps, and concurrency. End-to-end stress testing on the target hardware and business data is essential before launch.
3.5 Structured illustration: whole-block parallel prediction in one forward pass
The following simplified illustration shows the core logic of parallel denoising, with the model call abstracted into a generic interface:
def block_denoise(model, history, canvas_len=256, num_steps=32):"""Block-level parallel denoising: within a fixed-length canvas, predict inparallel, retain the best, and refine iteratively.model.run_step(ids, position_ids) is an abstract model forward interface."""mask_id = model.mask_token_idcanvas = [mask_id] * canvas_len # Start by drafting the whole block with "pending" markersfor step in range(num_steps):seq = history + canvas# A single forward pass models all canvas positionslogits = model.run_step(seq,position_ids=list(range(len(seq))),)probs = model.softmax(logits[len(history):])draft = model.sample(probs) # Candidate token for each canvas positionconfidence = model.token_confidence(probs, draft)# As the process advances, reveal more positions; finalize all near the endreveal_count = model.reveal_schedule(step, num_steps, canvas_len)for pos in model.select_positions(confidence, reveal_count):canvas[pos] = draft[pos] # Reveal positions; leave others for the next refinement roundif all(tok != mask_id for tok in canvas):breakreturn canvas
4. MTP and Speculative Decoding: A “Draft Accelerator” That Doesn’t Change How You Write
Unlike diffusion decoding, MTP and its most typical realization—speculative decoding—do not change the sequential generation logic of autoregression. What they do is “write a few drafts ahead of time, then have the main model check them quickly.”
4.1 Two common forms
Training-side multi-token prediction: While predicting the current token, the model also sets up several additional prediction targets or prediction heads to learn the 2nd, 3rd, and further tokens simultaneously. This is like training the model to “think a few steps ahead.” It both strengthens representation capability and lays the groundwork for parallel guessing during inference.
Inference-side drafting and verification: There are two common approaches.
- One is that the model itself has multi-step prediction capability, or is fitted with a lightweight draft module that produces several candidate tokens at once.
- The other is to introduce a separate draft model with fewer parameters, responsible for “quick guessing.”
Either way, the main model then concatenates the batch of candidates with the known prefix and, through one parallel forward pass, obtains the true probability distribution at each candidate position and compares it against the draft one by one.
4.2 Acceptance, rejection, and correction
Speculative decoding has a simple yet rigorous decision rule, which can be described with a random number q drawn from a uniform distribution:
- For the k-th draft token, if q is less than the ratio of the probability given by the main model to the probability given by the draft, the token is accepted.
- Otherwise the token is rejected, and a token is resampled from the corrected distribution—“the main model’s distribution minus the draft distribution, then normalized”—as the final output for this round.
- After the first rejected position, all subsequent draft tokens are discarded.
This mechanism yields an important property: under an ideal implementation, the final output distribution is exactly the same as the distribution the main model would produce one token at a time—what is commonly called lossless acceleration.
def speculative_decode(target, draft, prefix, gamma=4):"""gamma: number of candidate tokens produced by the draft side per round.Draft probabilities can be given explicitly by the draft side; with greedydecoding, they can be approximated as point estimates."""# 1) Draft side autoregressively generates gamma candidates (simplified for# illustration; KV cache omitted)draft_tokens, draft_probs = [], []ids = list(prefix)for _ in range(gamma):probs = draft.next_token_probs(ids)tok = draft.sample(probs)draft_tokens.append(tok)draft_probs.append(probs[-1][tok])ids.append(tok)# 2) Target model verifies all candidates in one parallel passverified = target.next_token_probs(prefix + draft_tokens)rand = uniform(0.0, 1.0)accepted = 0for k, tok in enumerate(draft_tokens):p = verified[k][tok] # Probability given by the target model at this positiond = draft_probs[k] # Probability given by the draft sideif rand <= min(1.0, p / d):accepted += 1else:# 3) Reject: resample from the corrected distributioncorrected = normalize(maximum(0.0, verified[k] - draft_dist[k]))bonus = sample(corrected)return list(prefix) + draft_tokens[:accepted] + [bonus]# All accepted: sample an extra token from the target model's distribution at the last positionreturn list(prefix) + draft_tokens + [sample(verified[gamma])]
Note that different implementations make trade-offs between lossless sampling and greedy approximation. In practice, the concrete acceptance-policy implementation should be the reference; the code above is meant to illustrate the mechanism.
4.3 What determines the acceleration ceiling
Speculative decoding still “confirms” tokens sequentially, one at a time—except that each round confirms at least one token. The more draft hits there are, the more tokens confirmed per round, and the fewer times the main model must be called.
But its gains are not unconditional:
- Draft quality sets the ceiling: Candidates further along the chain depend more on whether the earlier guesses were right; errors accumulate along the candidate chain, and acceptance rates typically decline with position.
- There is a “verification amplification” cost: The main model must do one computation for all candidates, roughly 1+γ times the original work. During prefill—where compute was originally idle—this adds almost no extra latency; but once decoding itself is already close to compute-bound, verification amplification eats into the gains.
- Memory savings are not complete: Even if all drafts are rejected, the main model still has to read the entire set of weights and the KV cache; only the scheduling overhead between multiple incremental calls is saved.
- Gains diminish in batching scenarios: As concurrent requests increase, decoding itself trends toward compute-intensive, and the relative advantage of speculative decoding is compressed.
Speculative decoding is therefore more of a low-cost, low-risk “nice-to-have”: the main body is still the familiar autoregressive generation, with just a draft accelerator added after the main model.
5. QAT: Reducing the Amount of Data per Computation
Quantization compresses weights and activations from higher precision (such as FP16/BF16) to lower bit widths (such as INT8, INT4). By the time it is applied, it generally splits into two categories:
- Post-training quantization (PTQ): After the model is trained, a small calibration set is used to gather activation statistics, and the weights are then mapped to lower precision.
- Quantization-aware training (QAT): Simulated quantization is introduced into the computation during training or fine-tuning, letting the model “experience” the numerical error from low precision in advance and adjust its weights accordingly.
5.1 Why “awareness” is needed
During forward and backward passes, pseudo-quantization nodes are interspersed: values are first simulated as low precision, then dequantized to participate in subsequent computation. Because the rounding operation in the quantization mapping is non-differentiable, a straight-through estimator is typically used to let gradients bypass the quantization nodes and flow directly back to the weights. As a result, during training the model actively seeks out weight distributions that are insensitive to rounding error, and the accuracy loss after quantization is often noticeably smaller than compressing after the fact.
5.2 What it means for decode speed
The main costs in the decode phase are moving weights and reading the KV cache. Compressing weights from FP16 to INT8 directly halves the amount of data read; compressing to INT4 reduces it to roughly a quarter. In memory-bound decoding scenarios, this compression translates into speed gains almost linearly, while memory footprint and startup cost also drop noticeably.
5.3 Implementation essentials
- Hardware support: The hardware and inference kernels must support low-precision matrix operations or efficient dequantization; without hardware support, speed gains are greatly diminished.
- Layered error tolerance: The error from weight quantization and from activation quantization is not the same. Activations often contain outliers, and aggressive compression easily causes noticeable accuracy drops. A common practice is to use a lower bit width for weights and a higher bit width for activations, while keeping sensitive layers at higher precision.
- Calibration data: QAT also needs calibration data, and its distribution should be close to the real business scenario.
- Combining with other techniques: What QAT changes is precision; it is orthogonal to diffusion decoding or speculative decoding and can be freely combined. A common combination is to use a quantized model as the drafter and a high-precision main model for verification, reducing draft overhead.
5.4 Limitations
QAT requires a complete training or fine-tuning pipeline and costs more than post-training quantization. When the bit width is pushed too low, complex reasoning tasks can still suffer noticeable accuracy drops, usually requiring finer per-channel or grouped strategies, or mixed-precision schemes, to compensate. In addition, the performance of low-precision decoding is closely tied to the specific hardware and inference-engine implementation, so re-validation is required when migrating deployments.
6. How the Three Routes Compare
Back to the original question: what exactly is the relationship between diffusion decoding, MTP, and QAT? They sit at different levels and are complementary.
| Dimension | Diffusion decoding | MTP / Speculative decoding | QAT |
|---|---|---|---|
| Level of effect | Generation paradigm: generate a whole block at once | Decode scheduling: confirm multiple candidates at once | Numerical precision: reduce weight and activation bit width |
| Changes how tokens are generated? | Yes—from token-by-token generation to whole-block parallel denoising | No—still confirms results in autoregressive order | No—independent of the generation method |
| Acceleration mechanism | Multiple positions share one weight read, raising arithmetic intensity | Reduces the number of main-model forward calls | Reduces the data moved per forward pass |
| Effect on output distribution | A new paradigm; requires dedicated evaluation | Identical to the main model under an ideal implementation | Involves quantization error |
| Main cost | Each step computes over the whole block; high compute consumption | Draft computation and verification amplification | High training cost; depends on hardware support |
| Main risk | Quality, stability, and ecosystem maturity | Candidate acceptance rate decays with position | Accuracy loss at low bit widths |
| Better-suited scenarios | Fixed workloads, on-premise deployment, throughput-first | Stable quality with low re-engineering cost | Memory-constrained, bandwidth-constrained |
The table also leads to a more concise conclusion: speculative decoding changes “how many are confirmed at once,” diffusion decoding changes “how much you write at once and how you write it,” and QAT changes “how many bits each computation uses.” The three can be combined orthogonally—for example, “quantization + speculative decoding” or “quantization + diffusion decoding”—and such combinations are already widely adopted in industry deployment practice.
7. Scenario-Based Selection and Deployment Advice
7.1 Choosing by scenario
- Stable quality and a mature ecosystem: Prefer a mature autoregressive model, with quantization and speculative decoding stacked on top; this gives the most certain gains.
- On-premise or edge deployment with ample hardware compute: Diffusion language models are worth evaluating. Their fixed block length and high parallelism make it easier to saturate the compute units.
- Long-context, high-concurrency online services: You must balance memory and bandwidth together. Combine techniques such as paged KV-cache management, prefix reuse, and continuous batching, rather than focusing only on the decoding algorithm itself.
- Partial rewriting and fragment-completion tasks: The bidirectional modeling and iterative-refinement properties of diffusion models are naturally suited to “given context, fill in the middle” tasks.
7.2 Don’t look at tokens/s alone
A common mistake is to focus only on output tokens per second while ignoring time to first token, tail-latency distribution, and end-to-end throughput. A more scientific approach is end-to-end evaluation, covering at least the following three categories of metrics:
| Metric type | Representative metrics | Focus |
|---|---|---|
| Latency | Time to first token, average interval per output token, tail latency | Interactive experience, long-text reading experience |
| Throughput | Requests and output tokens processed per unit time | Concurrency capacity, cost per unit |
| Quality | Task accuracy, instruction-following, long-text consistency | Business outcomes and user retention |
7.3 A pre-launch verification checklist
- Align hardware with the inference engine: Confirm how well the target hardware supports low-precision kernels and the computation patterns required for parallel denoising.
- Cover business distribution in the calibration set: Both QAT and quantization evaluation need calibration and evaluation data close to real scenarios.
- Stress-test real workloads: Test the performance curve under different input lengths, output lengths, and concurrency levels using real request distributions, not a single benchmark.
- Run quality regression: For candidate decoding strategies or quantized models, run offline evaluation covering core business scenarios plus manual spot checks.
- Establish observability: Build monitoring and alerting for latency, throughput, and error rate, with tiered thresholds and notification channels, and retain logs for key call chains to ease troubleshooting.
7.4 Lowering the engineering barrier with cloud platforms
If an organization lacks a dedicated inference-optimization team, general-purpose capabilities from cloud platforms can significantly lower the barrier. For example:
- Switching to a quantized version with one click in model hosting and inference services;
- Scaling on demand via elastic container platforms to handle traffic peaks;
- Managing model versions and calibration data through object storage;
- Tracking production performance continuously via logging, monitoring, and alerting services.
As an example, Baidu AI Cloud’s Qianfan model platform offers capabilities such as online inference, model deployment, and hosting, and its content-security offering provides general support for model content safety. These capabilities revolve around the general stages of model serving, and organizations can combine them flexibly according to their needs without having to build up from the underlying compute layer. For specific capabilities and how to enable them, refer to the official documentation.
8. Conclusion
Back to the original question: what exactly is the relationship between diffusion language models, MTP, and QAT?
You can view them as optimization approaches at three different levels:
- MTP and speculative decoding do not change the essence of autoregression; they simply add a “draft accelerator” to a conventional model. They are highly compatible and low-risk, but the acceleration ceiling is limited by draft quality.
- QAT compresses weights and activations at the numerical-precision level, reducing the data moved per forward pass. It is orthogonal to the decoding method and can be freely combined with the other two.
- Diffusion language models represent a change at the generation-paradigm level, moving from token-by-token generation to whole-block parallel denoising with repeated refinement, shifting the decoding bottleneck partially from memory bandwidth toward compute. On suitable hardware and workloads, they have the potential to deliver several-fold throughput gains.
Which route to choose depends on your business scenario, hardware conditions, and risk tolerance. For most teams, a more pragmatic approach is to first stack quantization and speculative decoding on a mature autoregressive model to capture certain gains, then evaluate whether diffusion decoding is worth adopting based on actual workload characteristics. After all, the evolution of decoding methods has only just begun—and understanding the mechanism behind each technique is what allows you to make rational decisions amid a fast-changing technological landscape.
