Skip to content

Discrete Diffusion vs. Autoregression

Standard Large Language Models (LLMs) operate under a sequential autoregressive factorization:

P(x1,x2,…,xT)=∏t=1TP(xt∣x<t)P(x_1, x_2, \dots, x_T) = \prod_{t=1}^T P(x_t \mid x_{<t})

Each forward pass generates exactly one token. Even if the model only needs to output a single boolean decision or three fields of a JSON object:

  1. It must sequentially predict structural characters ({, \n, ", k, e, y, ", :, ).
  2. It suffers from high memory bandwidth pressure: loading billions of parameters from memory to compute a single token’s logits.
  3. It takes dozens or hundreds of forward passes, one per output token.

DiffusionGemma (dgemma) breaks this sequential bottleneck by using discrete block diffusion:

  • Block-Autoregressive Canvas: The decoder works on a short canvas (served with 128 rows, 32 on Cloud Run L4; each request uses the smallest multiple of 16 that holds its answer template) with bidirectional self-attention.
  • Iterative Denoising: The answer positions begin as seeded noise tokens and are denoised in parallel across a single pass (steps: 1, think: 0) or a small number of steps.
  • Joint Multi-Slot Conditioning (slot_1 <-> slot_2): Unlike independent classification heads, all masked decision slots attend to the prompt and to each other simultaneously in O(1)O(1) forward passes.

In a structured decision query (steps: 1, think: 0), no conversational prose is generated:

  1. Canvas Seeding: The known policy template (e.g. urgent: @\nteam: @\nsentiment: @) is pre-seeded into the canvas, where @ marks an answer position. The serving image fills each one with a random token (seeded per sample) and asks vLLM for a read-only step that returns the logprob of every allowed label at that position.
  2. Single-Pass Readout: A single forward pass executes across the causal prompt prefix and bidirectional canvas.
  3. Restricted-Softmax Logit Readout: Rather than decoding free-form text, the engine extracts the raw logits zm,kz_{m,k} restricted to the valid single-token candidate vocabulary Vm\mathcal{V}_m ({"yes","no"} for boolean, [A–Z] for choice, 1..9 for score; each label must be one token at the same position, hence at most 26 options) and normalizes via softmax:

pm,k=exp⁑(zm,k)βˆ‘j∈Vmexp⁑(zm,j)p_{m,k} = \frac{\exp(z_{m,k})}{\sum_{j \in \mathcal{V}_m} \exp(z_{m,j})}

Seeded Canvas:
[<|channel>thought\n<channel|>urgent: @ \nteam: @ \nsentiment: @ ]
β–² β–² β–²
Slot 1 Slot 2 Slot 3
[p(yes), p(no)] [p(A)..p(Z)] [p(1)..p(5)]
|V_1| = 2 |V_2| = 26 |V_3| = 5

Single-pass restricted-softmax readout provides calibrated epistemic uncertainty at every decision slot mm:

  • Raw Shannon Entropy (HmH_m): Hm=βˆ’βˆ‘k∈Vmpm,kln⁑pm,k∈[0,ln⁑∣Vm∣]H_m = -\sum_{k \in \mathcal{V}_m} p_{m,k} \ln p_{m,k} \in [0, \ln|\mathcal{V}_m|]
  • Cardinality-Normalized Epistemic Entropy (H~m\tilde{H}_m): Because maximum entropy scales logarithmically with option count (ln⁑2=0.693Β nats\ln 2 = 0.693\text{ nats} for binary boolean vs. ln⁑26=3.258Β nats\ln 26 = 3.258\text{ nats} for 26-way choice), dgem normalizes each slot’s entropy by its theoretical ceiling ln⁑∣Vm∣\ln|\mathcal{V}_m|: H~m=Hmln⁑∣Vm∣∈[0,1]\tilde{H}_m = \frac{H_m}{\ln|\mathcal{V}_m|} \in [0, 1]
πŸ’‘ Concept Aside: Why does Raw Entropy ($H_m$) cause "Multi-Slot Scale Inversion" without $\ln|\mathcal{V}_m|$ normalization? (click to expand)

Illustrative numbers.

  • In Plain English: A 26-option banking classifier naturally leaks tiny probability crumbs across 25 runner-up classes even when it is confident and right, inflating its raw entropy (say 0.52 nats). Meanwhile, a 3-option NLI slot (entailment / neutral / contradiction) has a small maximum ceiling (1.099 nats), so a real spike in uncertainty (say 0.25 nats) looks smaller in raw nats than the 26-way slot.
  • How H~m=Hm/ln⁑∣Vm∣\tilde{H}_m = H_m / \ln|\mathcal{V}_m| Fixes It: Dividing by ln⁑∣Vm∣\ln|\mathcal{V}_m| puts every slot onto a universal [0,1][0, 1] uncertainty scale (--normalize-entropy --cascade-threshold 0.16):
    • 26-option intent slot: 0.52/ln⁑(26)β‰ˆ0.160.52 / \ln(26) \approx \mathbf{0.16}, at the threshold: a confident answer.
    • 3-option NLI slot: 0.25/ln⁑(3)β‰ˆ0.23β‰₯0.16β€…β€ŠβŸΉβ€…β€Š0.25 / \ln(3) \approx \mathbf{0.23 \ge 0.16} \implies escalates to Stage 2.
  • See also: the Glossary entry on Multi-Slot Scale Inversion.
  • Adaptive Sampling & Prior-Guided Escalation:
    • Low Normalized Entropy (H~m<0.160\tilde{H}_m < 0.160): The decision is decisive. dgem early-exits immediately after 1 forward pass.
    • High Normalized Entropy (H~mβ‰₯0.160\tilde{H}_m \ge 0.160): dgem forwards the Pass-1 Slot Prior Distribution ([TIER-1 DISCRETE DIFFUSION PRIOR TELEMETRY]) to Stage 2β€”either an Intra-Model Self-Cascade (--cascade-self-think 256 on the same dgemma GPU) or a Cross-Model Cascade (gemini-3.8-flash).

How dgem Computes Confidence & Entropy from Template Logprobs (Step-by-Step)

Section titled β€œHow dgem Computes Confidence & Entropy from Template Logprobs (Step-by-Step)”

In standard autoregressive LLM pipelines, estimating whether the model is confident on a custom taskβ€”without generating long Chain-of-Thought rationales or running N=10–20N=10\text{–}20 Monte Carlo rollouts (self-consistency)β€”multiplies token costs by orders of magnitude.

dgem avoids that token-cost explosion by turning your .json.tmpl policy into a single-token logprob tie-detector across 4 concrete steps:

  1. Step 1 β€” Map User-Supplied Classes to Single Letters (A, B, C…) in the Prompt: When you define custom classes in a template (even for a domain not in the model’s training distribution), dgem formats them into a single-letter legend in the prompt prefix and places one masked blank (@) per question on the diffusion canvas:
    Prompt Prefix:
    Slot 'intent' options:
    A = billing_dispute
    B = account_compromise
    C = feature_request
    Seeded Diffusion Canvas (1 token per slot):
    intent: @
  2. Step 2 β€” Run 1 Forward Pass (think=0) & Read logprobs of Only Those Letters: Instead of generating free-form text, dgem executes 1 forward pass and inspects the raw token logits at that exact @ blank. It discards the other ~255,997 words in the vocabulary and runs a softmax strictly over the valid letters (A, B, C) you supplied: pA,pB,pC=softmax(zA,zB,zC)p_A, p_B, p_C = \text{softmax}(z_A, z_B, z_C) (For numeric score slots like 1..5, it does the exact same thing over the digit tokens '1'..'5', computing the weighted average E[v]=βˆ‘k=15kβ‹…pk\mathbb{E}[v] = \sum_{k=1}^5 k \cdot p_k and spread from those 5 probabilities).
  3. Step 3 β€” Measure Whether the Top Letters Are in a Close Race (HmH_m):
    • If the restricted probabilities are {A: 97.5%, B: 1.5%, C: 1.0%}, letter A dominates (Hm=0.13Β natsH_m = 0.13\text{ nats}). We take A immediately and pay zero generation tokens.
    • If the restricted probabilities are {A: 54.0%, B: 42.0%, C: 4.0%}, the model’s attention is torn between A and B (Hm=0.82Β natsH_m = 0.82\text{ nats}).
  4. Step 4 β€” Divide by ln⁑(NumberΒ ofΒ Choices)\ln(\text{Number of Choices}) to Scale the β€œTie Meter” from 0.0 to 1.0 (H~m\tilde{H}_m): Why can’t we use the same raw entropy cutoff (HmH_m) for a 2-choice yes/no question and a 26-choice A..Z question? Because a flat dead tie between 2 choices has a maximum entropy of ln⁑(2)=0.693\ln(2) = 0.693, while a flat tie between 26 choices has a maximum entropy of ln⁑(26)=3.258\ln(26) = 3.258. Dividing by ln⁑(numberΒ ofΒ choices)\ln(\text{number of choices}): H~m=Hmln⁑(numberΒ ofΒ choices)∈[0,1]\tilde{H}_m = \frac{H_m}{\ln(\text{number of choices})} \in [0, 1] scales our β€œtie meter” onto 0.0 (one letter dominates) to 1.0 (dead tie) regardless of how many classes you put in your template. When H~mβ‰₯0.16\tilde{H}_m \ge 0.16, dgem escalates the query to a reasoning pass (think > 0 or Tier-2 LLM) and passes along the Pass-1 letter breakdown ({A: 54%, B: 42%}) so the reasoning model knows which two candidates to disambiguate.

5. Architectural FAQ: Can Dual-Encoders (GTR) + TabPFN Replace a Decision Model, or Do You Need Test-Time Compute?

Section titled β€œ5. Architectural FAQ: Can Dual-Encoders (GTR) + TabPFN Replace a Decision Model, or Do You Need Test-Time Compute?”

Engineers from search, retrieval, and tabular ML backgrounds frequently ask a foundational design question:

β€œCould the goal of a fast, reasoning-capable classifier be achieved without a generative modelβ€”specifically by pairing a GTR-style Dual Encoder (Sentence-T5) with a TabPFN / TabFM zero-shot tabular classification foundation model? Or do you strictly need a decoder and test-time compute (think > 0) to pull off reasoning?”

The Operative Decoder Ring (5 Core Concepts in Plain English)

Section titled β€œThe Operative Decoder Ring (5 Core Concepts in Plain English)”

For readers arriving from different specialties (Platform Engineering, Search/Retrieval, or LLM Infrastructure), here is how the five architectural terms map to plain English:

Term10-Word Plain-English Mental ModelCanonical Example
Dual Encoder (GTR / T5)Compresses input and label into two separate vectors, then compares.Semantic search & topical intent (Banking77 similarity).
Tabular FM (TabPFN / TabFM)Predicts a spreadsheet column by attending to labeled example rows.Few-shot classification over numerical/embedding feature grids.
Cross-Attention Canvas (dgem)Every input word directly inspects every policy rule and slot.Zero-shot AgentDrift security audit & LLM-AggreFact grounding.
Normalized Entropy (H~m\tilde{H}_m)A universal 0.0–1.0 uncertainty gauge adjusted for option count.Early-exiting a confident 26-way intent while escalating a torn 3-way NLI item.
Test-Time Compute (think > 0)Scratchpad tokens generated only when a problem needs multi-step math.Solving 2015 + 4 = 2019 > 2018 in anli-02 (--cascade-self-think 256).
πŸ’‘ Concept Aside: Late Interaction (`GTR` Pooling Bottleneck) vs. Early All-to-All Cross-Attention (`dgem`) (click to expand)
1. GTR Dual-Encoder + TabPFN (Late Interaction / Vector Bottleneck):
Input Text (1,000 tokens) ──► [T5 Encoder] ──► Single Vector u (R^768) ──┐
β”œβ”€β”€β–Ί [TabPFN Grid] ──► Prediction
Policy Rules / Labels ──► [T5 Encoder] ──► Label Vectors v_k β”€β”€β”˜
⚠️ Bottleneck: Input tokens never attend to Policy tokens! Fine-grained numbers,
negations ("NOT in allowlist"), and variable bindings are crushed during pooling.
2. DiffusionGemma Canvas Readout (Early Token-Level Cross-Attention):
[Policy Rules (.json.tmpl) + Input Text (1,000 tokens) + Masked Slots <s_1, s_2, s_3>]
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ All 26B-A4B Layers: Every token in Input, β”‚
β”‚ Policy, and Slots <s_1 <-> s_2> mutually attend β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–Ό
Joint Calibrated Readout (one pass)
  • Why Normalization + TabPFN Cannot Undo Pooling Loss: By the Data Processing Inequality, once Ex(x)E_x(x) compresses a multi-clause passage or tool trajectory into a fixed vector u∈Rdu \in \mathbb{R}^d, information about which specific quantifier modifies which entity is lost. TabPFN is a powerful Bayesian decision boundary estimator over tabular columns, but it can only partition the features it is givenβ€”and it requires in-context labeled support rows (Xtrain,ytrainX_{\text{train}}, y_{\text{train}}), whereas dgem executes declarative .json.tmpl policies with zero support rows (Nsupport=0N_{\text{support}} = 0).
πŸ’‘ Concept Aside: Why Fixed-Depth Circuits (`think=0`) Cannot Solve Latent Multi-Hop Arithmetic Without Test-Time Compute (`think > 0`) (click to expand)
  • The Circuit-Depth Bound (TC0\mathsf{TC}^0): Any single forward pass through a transformer of fixed depth LL (GTR, DeBERTa, TabPFN, or dgemma at steps=1, think=0) executes a constant number of sequential layer operations.
  • Concrete Proof (anli-02 in dgem bench-calibration):
    • Premise: β€œMira joined the lab in 2015 and became its second director four years later, succeeding the founder.”
    • Hypothesis: β€œMira led the lab before 2018.”
    • Notice that the number 2019 never appears in the input tokens! To recognize the contradiction, the model must (1) bind 2015 + four years later, (2) compute the latent sum 2019, and (3) evaluate 2019 < 2018 (False β€…β€ŠβŸΉβ€…β€Š\implies contradiction).
  • Why dgem Can Handle This Without Slowing Down Easy Traffic: In Pass 1 (think=0), the model may output entailment, but its normalized entropy H~m\tilde{H}_m rises above the gate (β‰₯0.160\ge 0.160). That triggers Pass 2 (think > 0 with the Pass-1 prior block), which can compute 2015 + 4 = 2019 on its scratchpad and answer contradiction.
Capability / DimensionGTR Dual-Encoder + TabPFN / TabFMFine-Tuned Cross-Encoder (DeBERTa-v3)dgem Single-Pass Canvas (steps=1, think=0)dgem Prior-Guided Cascade (think=0 β†’ think>0)
Token-to-Policy Cross-Attention❌ No (Late pooling into u∈Rdu \in \mathbb{R}^d)βœ… Yes (Full cross-attention)βœ… Yes (Full 26B-A4B cross-attention)βœ… Yes (Full 26B-A4B cross-attention)
Zero-Shot Policy Onboarding⚠️ Partial (TabPFN requires N>0N>0 support rows)❌ No (Requires fine-tuning per head)βœ… Yes (via .json.tmpl, N=0N=0 rows)βœ… Yes (via .json.tmpl, N=0N=0 rows)
Joint Multi-Slot Readout (s_1 <-> s_2)❌ No (1 target column per pass)❌ No (Independent linear heads)βœ… Yes (boolean + choice + score in 1 pass)βœ… Yes (boolean + choice + score in 1 pass)
1-Hop Relational Grounding⚠️ Brittle (Pooling loses parameter/negation scope)βœ… Strong (If fine-tuned on domain)βœ… Strongβœ… Strong
Latent Multi-Hop Arithmetic❌ Fails (Fixed circuit depth, no scratchpad)❌ Fails (Fixed circuit depth, no scratchpad)❌ Fails (Single-pass TC0\mathsf{TC}^0 limit)βœ… Possible (H~mβ‰₯0.16\tilde{H}_m \ge 0.16 triggers think>0 + Priors)
LatencyLowest (small encoders)LowOne forward pass of a large modelOne pass, plus a reasoning pass for escalated items only

The formal technique is Discrete Diffusion Slot Readout (or bidirectional masked logit extraction). It builds directly upon foundational literature:

  • Masked Language Modeling (BERT, 2018): Evaluating logits across bidirectional transformer encoder layers.
  • Non-Autoregressive Sequence Generation (Mask-Predict, 2019): Parallel canvas denoising.
  • Discrete Denoising Diffusion (D3PM, 2021; MDLM, 2024): Denoising categorical state spaces.
  • DiffusionGemma (Google DeepMind, 2025/2026): The 26B-A4B MoE architecture providing an autoregressive prefix encoder paired with a discrete diffusion decoder with bidirectional attention.

dgem uses stock, unmodified weights from Google DeepMind (google/diffusiongemma-26B-A4B-it) and implements this technique directly.