Discrete Diffusion vs. Autoregression
1. The Bottleneck of Autoregressive LLMs
Section titled β1. The Bottleneck of Autoregressive LLMsβStandard Large Language Models (LLMs) operate under a sequential autoregressive factorization:
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:
- It must sequentially predict structural characters (
{,\n,",k,e,y,",:,). - It suffers from high memory bandwidth pressure: loading billions of parameters from memory to compute a single tokenβs logits.
- It takes dozens or hundreds of forward passes, one per output token.
2. Discrete Block Diffusion & Multi-Canvas Sampling
Section titled β2. Discrete Block Diffusion & Multi-Canvas Samplingβ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 forward passes.
3. How Discrete Diffusion Slot Readout Works
Section titled β3. How Discrete Diffusion Slot Readout WorksβIn a structured decision query (steps: 1, think: 0), no conversational prose is generated:
- 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. - Single-Pass Readout: A single forward pass executes across the causal prompt prefix and bidirectional canvas.
- Restricted-Softmax Logit Readout: Rather than decoding free-form text, the engine extracts the raw logits restricted to the valid single-token candidate vocabulary (
{"yes","no"}forboolean,[AβZ]forchoice,1..9forscore; each label must be one token at the same position, hence at most 26 options) and normalizes via softmax:
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| = 54. Uncertainty & Cardinality-Normalized Entropy
Section titled β4. Uncertainty & Cardinality-Normalized EntropyβSingle-pass restricted-softmax readout provides calibrated epistemic uncertainty at every decision slot :
- Raw Shannon Entropy ():
- Cardinality-Normalized Epistemic Entropy (): Because maximum entropy scales logarithmically with option count ( for binary
booleanvs. for 26-waychoice),dgemnormalizes each slotβs entropy by its theoretical ceiling :
π‘ 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 (say0.25 nats) looks smaller in raw nats than the 26-way slot. - How Fixes It: Dividing by puts every slot onto a universal uncertainty scale (
--normalize-entropy --cascade-threshold 0.16):- 26-option intent slot: , at the threshold: a confident answer.
- 3-option NLI slot: escalates to Stage 2.
- See also: the Glossary entry on Multi-Slot Scale Inversion.
- Adaptive Sampling & Prior-Guided Escalation:
- Low Normalized Entropy (): The decision is decisive.
dgemearly-exits immediately after 1 forward pass. - High Normalized Entropy ():
dgemforwards the Pass-1 Slot Prior Distribution ([TIER-1 DISCRETE DIFFUSION PRIOR TELEMETRY]) to Stage 2βeither an Intra-Model Self-Cascade (--cascade-self-think 256on the samedgemmaGPU) or a Cross-Model Cascade (gemini-3.8-flash).
- Low Normalized Entropy (): The decision is decisive.
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 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:
- 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),dgemformats 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_disputeB = account_compromiseC = feature_requestSeeded Diffusion Canvas (1 token per slot):intent: @ - Step 2 β Run 1 Forward Pass (
think=0) & Readlogprobsof Only Those Letters: Instead of generating free-form text,dgemexecutes 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: (For numericscoreslots like1..5, it does the exact same thing over the digit tokens'1'..'5', computing the weighted average and spread from those 5 probabilities). - Step 3 β Measure Whether the Top Letters Are in a Close Race ():
- If the restricted probabilities are
{A: 97.5%, B: 1.5%, C: 1.0%}, letterAdominates (). We takeAimmediately 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 betweenAandB().
- If the restricted probabilities are
- Step 4 β Divide by to Scale the βTie Meterβ from
0.0to1.0(): Why canβt we use the same raw entropy cutoff () for a 2-choiceyes/noquestion and a 26-choiceA..Zquestion? Because a flat dead tie between 2 choices has a maximum entropy of , while a flat tie between 26 choices has a maximum entropy of . Dividing by : scales our βtie meterβ onto0.0(one letter dominates) to1.0(dead tie) regardless of how many classes you put in your template. When ,dgemescalates the query to a reasoning pass (think > 0or 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:
| Term | 10-Word Plain-English Mental Model | Canonical 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 () | 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 +
TabPFNCannot Undo Pooling Loss: By the Data Processing Inequality, once compresses a multi-clause passage or tool trajectory into a fixed vector , information about which specific quantifier modifies which entity is lost.TabPFNis 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 (), whereasdgemexecutes declarative.json.tmplpolicies with zero support rows ().
π‘ 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 (): Any single forward pass through a transformer of fixed depth (
GTR,DeBERTa,TabPFN, ordgemmaatsteps=1, think=0) executes a constant number of sequential layer operations. - Concrete Proof (
anli-02indgem 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
2019never appears in the input tokens! To recognize the contradiction, the model must (1) bind2015+four years later, (2) compute the latent sum2019, and (3) evaluate2019 < 2018(Falsecontradiction).
- Why
dgemCan Handle This Without Slowing Down Easy Traffic: In Pass 1 (think=0), the model may outputentailment, but its normalized entropy rises above the gate (). That triggers Pass 2 (think > 0with the Pass-1 prior block), which can compute2015 + 4 = 2019on its scratchpad and answercontradiction.
Architectural Comparison Matrix
Section titled βArchitectural Comparison Matrixβ| Capability / Dimension | GTR Dual-Encoder + TabPFN / TabFM | Fine-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 ) | β Yes (Full cross-attention) | β Yes (Full 26B-A4B cross-attention) | β Yes (Full 26B-A4B cross-attention) |
| Zero-Shot Policy Onboarding | β οΈ Partial (TabPFN requires support rows) | β No (Requires fine-tuning per head) | β
Yes (via .json.tmpl, rows) | β
Yes (via .json.tmpl, 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 limit) | β
Possible ( triggers think>0 + Priors) |
| Latency | Lowest (small encoders) | Low | One forward pass of a large model | One pass, plus a reasoning pass for escalated items only |
6. Terminology: Discrete Diffusion Slot Readout
Section titled β6. Terminology: Discrete Diffusion Slot Readoutβ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.