Break the 1-token-per-forward-pass Roofline wall with Block Masked Diffusion: continuous-time NELBO derivations, migrating Gated DeltaNet hybrids in dQwen3.5 and Clover-35B-A3B, Mix-FT sampler alignment, and PBPO reinforcement learning.
1.Breaking the 1 forward pass = 1 token Roofline wall#
Autoregressive (AR) decoding factorizes . While trivial to train, decoding at small batch sizes sits on the flat memory-bound slope of the Roofline (roofline-flashattention-pagedattention): streaming gigabytes of weights from HBM yields a single token per forward pass.
Diffusion Language Models (dLLMs) replace serial token-by-token emission with iterative parallel denoising across two converging paradigms:
- Block Masked Diffusion (
dQwen3.5,Clover-35B-A3B): Partitions output sequences into blocks of size (e.g., ). Inter-block attention remains strictly causal so clean prefix blocks stay cached in KV memory, while intra-block attention is fully bidirectional—allowing forward passes to unmask an entire block in parallel and raise arithmetic intensity by . - Continuous Latent ODE/SDE Diffusion (
Sigma, arXiv:2610.02665[2]Large Language Continuous Diffusion ModelsOpen arXiv:2610.02665 ↗): Discrete unmasking cannot smoothly revise an early mistaken commit or apply continuous value-gradient guidance.Sigmaconstructs a smooth low-dimensional latent manifold above token embeddings, warm-starting from pretrained AR weights and supporting high-order ODE solvers plus Classifier-Free Guidance (CFG) for math and code.
2.Continuous-time Masked Diffusion NELBO#
In discrete absorbing-state masked diffusion, each token in a block is independently replaced with [MASK] at noise level . Evaluating the exact variational bound reduces to a remarkably clean time-weighted cross-entropy objective:
Under an absorbing forward kernel with linear schedule (so the mask rate is and ), the continuous-time Negative Evidence Lower Bound (NELBO) integrates the instantaneous KL divergence between the true posterior and the learned reverse denoiser :
Notice two critical properties: (1) unmasked positions contribute zero loss because they are already revealed, and (2) the factor upweights low-noise regimes where only a few [MASK] tokens remain and high-confidence context resolves subtle syntactic dependencies.
class BlockMaskedDiffusionLM(nn.Module):
"""
Block Masked Diffusion Language Model (dQwen3.5, arXiv:2609.20751; Mix-FT, arXiv:2611.02666):
- Inter-block: strictly causal across blocks so clean prefix blocks are cacheable.
- Intra-block: fully bidirectional within each block so multiple [MASK] tokens unmask in parallel.
"""
def __init__(self, vocab_size: int = 128, hidden_size: int = 128, num_layers: int = 3, num_heads: int = 4):
super().__init__()
self.vocab_size = vocab_size
self.mask_token_id = vocab_size - 1
self.embed = nn.Embedding(vocab_size, hidden_size)
self.pos_embed = nn.Embedding(512, hidden_size)
encoder_layer = nn.TransformerEncoderLayer(
d_model=hidden_size,
nhead=num_heads,
dim_feedforward=hidden_size * 2,
activation="gelu",
batch_first=True,
norm_first=True,
)
self.backbone = nn.TransformerEncoder(
encoder_layer, num_layers=num_layers, enable_nested_tensor=False
)
self.lm_head = nn.Linear(hidden_size, vocab_size - 1, bias=False)
@staticmethod
def build_block_causal_mask(seq_len: int, block_size: int, device: torch.device) -> Tensor:
"""Position i attends to j iff block_idx(j) <= block_idx(i); True masks out future blocks."""
idx = torch.arange(seq_len, device=device)
blk_i = idx.unsqueeze(1) // block_size
blk_j = idx.unsqueeze(0) // block_size
return blk_j > blk_i
def forward(self, x_noisy: Tensor, block_size: int = 16) -> Tensor:
b, s = x_noisy.shape
pos = torch.arange(s, device=x_noisy.device).unsqueeze(0).expand(b, s)
h = self.embed(x_noisy) + self.pos_embed(pos)
attn_mask = self.build_block_causal_mask(s, block_size, x_noisy.device)
h = self.backbone(h, mask=attn_mask)
return self.lm_head(h)
def compute_mdlm_nelbo_loss(self, clean_ids: Tensor, block_size: int = 16) -> Tensor:
"""Continuous-time masked diffusion NELBO: 1/t-weighted cross-entropy over masked positions."""
b, s = clean_ids.shape
t = torch.empty(b, 1, device=clean_ids.device).uniform_(0.05, 1.0)
mask_flags = torch.rand(b, s, device=clean_ids.device) < t
mask_flags[:, -1] = True
x_t = torch.where(mask_flags, torch.full_like(clean_ids, self.mask_token_id), clean_ids)
logits = self.forward(x_t, block_size=block_size)
token_ce = F.cross_entropy(
logits.view(-1, self.vocab_size - 1),
clean_ids.view(-1),
reduction="none",
).view(b, s)
weighted_loss = (token_ce * mask_flags.float()) / t
return weighted_loss.sum() / mask_flags.float().sum()3.Hybrid linear-RNN migration (dQwen3.5 & Clover-35B-A3B)#
A major 2026 architectural collision emerged when frontier AR backbones (Qwen3.5, Qwen3.8-Next, Kimi K3) replaced 75% of attention layers with strictly unidirectional linear RNNs such as Gated DeltaNet. Standard diffusion adaptation assumed full bidirectional attention everywhere—incompatible with causal recurrent state .
dQwen3.5(arXiv:2609.20751[1]dQwen3.5: Hybrid-Attention Diffusion Language ModelsOpen arXiv:2609.20751 ↗) resolves this via hybrid block adaptation: clean prefix blocks retain fast unidirectionalGated DeltaNetrecurrence , while inside the active noisy block, attention layers open to full bidirectional masks and linear RNN layers apply lightweight bidirectional state fusion with causal annealing.Clover-35B-A3B(arXiv:2611.24636[5]Clover-35B-A3B-Preview Technical ReportOpen arXiv:2611.24636 ↗) scales this hybrid MoE + Gated DeltaNet block-diffusion recipe to 35B total / 3B active parameters, reaching 73.6 on SWE-bench Verified at on a single GB300.dLoop(arXiv:2611.26275[6]dLoop: Looped Diffusion Language Models via Recurrent Latent RefinementOpen arXiv:2611.26275 ↗) further embeds Looped Transformer latent refinement (looped-transformers-latent-recurrence) inside each diffusion step so uncommitted tokens exchange global context before hard unmasking.
4.Few-step sampler alignment (Mix-FT) and PBPO RL#
Why does naive confidence-based parallel unmasking degrade when compressed to steps? Because standard MDLM trains independent per-token marginals . Unmasking multiple tokens simultaneously without modeling their joint correlation can emit incompatible pairs (e.g., "New" + "Francisco").
Mix-FT(arXiv:2611.02666[3]Train the Sampler You Run: Few-Step Masked Diffusion Language Models via Mixture-Likelihood Fine-TuningOpen arXiv:2611.02666 ↗)—Train the Sampler You Run—optimizes an importance-weighted mixture-likelihood lower bound directly over the few-step sampler's actual reveal trajectories, closing the quality gap at steps.PBPO(Prefix-Block Policy Optimization, arXiv:2611.07783[4]PBPO: Prefix-Block Policy Optimization for Diffusion Language ModelsOpen arXiv:2611.07783 ↗) solves the RLVR bottleneck for dLLMs. In autoregressive GRPO, computing is a single forward pass. In block diffusion, a -token block can be unmasked along distinct reveal orders, making the marginal block likelihood intractable.PBPOmodels the concrete unmasking transition trajectory conditioned on the clean prefix block as a Markov sub-process, decomposing the policy ratio across actual unmasking steps so PPO/GRPO importance ratios remain exact and low-variance.
@torch.no_grad()
def sample_block_parallel(
self, prefix_ids: Tensor, block_size: int = 16, denoise_steps: int = 4
) -> tuple[Tensor, list[int]]:
"""
Confidence-aware parallel unmasking: decodes a block_size chunk in denoise_steps
forward passes by committing the top-k highest-confidence [MASK] tokens per step.
"""
if prefix_ids.shape[0] != 1:
raise ValueError("sample_block_parallel expects batch size 1")
cur_block = torch.full(
(1, block_size), self.mask_token_id, dtype=torch.long, device=prefix_ids.device
)
tokens_per_step = math.ceil(block_size / denoise_steps)
revealed_per_iter: list[int] = []
for step in range(denoise_steps):
full_seq = torch.cat([prefix_ids, cur_block], dim=1)
logits = self.forward(full_seq, block_size=block_size)[:, -block_size:, :]
probs = F.softmax(logits, dim=-1)
confidences, pred_tokens = probs.max(dim=-1)
still_masked = cur_block == self.mask_token_id
num_remaining = int(still_masked.sum().item())
if num_remaining == 0:
break
k = num_remaining if step == denoise_steps - 1 else min(tokens_per_step, num_remaining)
masked_conf = confidences.masked_fill(~still_masked, -1.0)
_, topk_pos = torch.topk(masked_conf, k=k, dim=-1)
cur_block.scatter_(1, topk_pos, pred_tokens.gather(1, topk_pos))
revealed_per_iter.append(k)
return torch.cat([prefix_ids, cur_block], dim=1), revealed_per_iterIn our companion CPU lab (labs/llm/block-diffusion), BlockMaskedDiffusionLM verifies the block-causal mask geometry, converges under -weighted MDLM NELBO training, and decodes a 16-token block in 4 confidence-ranked parallel unmasking passes.
5.References#
- dQwen3.5: Hybrid-Attention Diffusion Language Models (2026).
- Large Language Continuous Diffusion Models (Sigma) (2026).
- Train the Sampler You Run: Few-Step Masked Diffusion LM via Mixture-Likelihood Fine-Tuning (Mix-FT) (2026).
- PBPO: Prefix-Block Policy Optimization for Diffusion Language Models (2026).
- Clover-35B-A3B-Preview Technical Report (2026).
- dLoop: Looped Diffusion Language Models via Recurrent Latent Refinement (2026).
- Return to Chapter 1: From Vanilla Transformer to Llama-3 and Mixtral: Five Architectural Mutations.
References
- [1]
- [2]
- [3]
- [4]
- [5]
- [6]