Skip to content

The Journey to Decision Models

For decades, software engineers and product teams had to choose between two extremes when building classification and decision systems: fast, rigid classical models (like Naive Bayes, Logistic Regression, and BERT) or slow, expensive autoregressive Large Language Models (chat LLMs such as Gemini).

DiffusionGemma introduces a third paradigm: Discrete Diffusion Decision Models.

✨ Interactive Walkthrough: New to decision models? Open the plain-language walkthrough βž”: what a decision model is, one pass vs. word-by-word, when to trust an answer (hesitation), and built-in guardrails. The full version, with a hesitation-gating walkthrough and a glossary, is the Concepts tab in Decision Studio (./bin/dgem serve).


0. Product & Executive Overview: Why Decision Models & How the Entropy Gate Works

Section titled β€œ0. Product & Executive Overview: Why Decision Models & How the Entropy Gate Works”

If you are a Product Manager, Engineering Leader, or Systems Architect, here is the core problem dgem solvesβ€”without the machine learning jargon:

  1. Traditional Predictive ML (~10 ms Β· Fast & Trustworthy, Slow to Build): Give a traditional model 10,000 labeled customer tickets and it will classify new ones in milliseconds with a genuine confidence score (e.g., 99% Billing vs. 51% Billing). The catch: Every time your product adds a new routing department or policy rule, your team has to collect new data and retrain the model from scratch.
  2. Autoregressive LLMs (seconds Β· Instant Setup, Slow & Overconfident at Runtime): Chat models let you define categories on the fly in plain English (zero-shot). The catch: They generate text one word at a time from left to right. Using a chat LLM just to classify a ticket into three fields is like asking a novelist to write a paragraph just to check a boxβ€”and because it outputs a plain string ("department": "Technical"), it hides whether the model was 99% certain or guessing 51/49 on a coin flip.
  3. Decision Models (dgem + DiffusionGemma Β· sub-second Β· Zero-Shot Setup + Per-Field Uncertainty): Instead of generating words left to right, DiffusionGemma evaluates all of your decision blanks simultaneously on a fixed canvas in one single pass. Because it locks directly onto your allowed options, it cannot emit invalid JSON or an off-menu labelβ€”and it returns a per-field uncertainty score (Shannon Entropy in nats). That score is a strong starting signal, not a guarantee: see how it can be fooled and how dgem checks it.

How the Entropy Gate Works (The β€œTriage Nurse vs. Specialist” Pattern)

Section titled β€œHow the Entropy Gate Works (The β€œTriage Nurse vs. Specialist” Pattern)”

In many products, most incoming requests are obvious (e.g., β€œOur API is returning 502 Bad Gateway”), while a minority are genuinely mixed (e.g., β€œOur API is returning 502 Bad Gateway AND we are disputing our $45,000 Q3 invoice”).

Instead of sending all of your traffic to a slow, expensive frontier reasoning modelβ€”or letting a fast model guess blindly on ambiguous edge casesβ€”dgem uses an Entropy Gate:

Illustrative numbers below; your split depends on your traffic and threshold.

flowchart TD
    IN["πŸ“₯ Incoming Request / Ticket\n(All Production Traffic)"] --> S1["⚑ Stage 1: dgem + DiffusionGemma\nSingle Forward Pass\nComputes Answer + Uncertainty (nats)"]
    S1 -->|"🟒 Low Uncertainty (H < 0.35 nats)\ne.g. ~70% of Traffic (Clear Signal)"| FAST["βœ… Fast Auto-Route\nSub-second Β· No Frontier LLM Cost"]
    S1 -->|"🟠 High Uncertainty (H β‰₯ 0.35 nats)\ne.g. ~30% of Traffic (Mixed / Borderline)"| ESC["⚠️ Auto-Escalate to Frontier Model (Gemini 3.8 Flash)\nwith Stage-1 Odds Attached (75% Tech / 23% Billing)"]
  • When the signal is clear (H < 0.35 nats): DiffusionGemma puts nearly all the probability on one answer. The request takes the Green Fast Lane, finishing in sub-second latency at a fraction of LLM cost.
  • When the request contains conflicting signals (H β‰₯ 0.35 nats): DiffusionGemma detects its own internal tug-of-war (for example 75% Technical vs. 23% Billing) and raises an Amber Flag. Your application routes only that ambiguous slice to a frontier model (or human reviewer), passing along DiffusionGemma’s odds as a diagnostic clue. A size-normalized gate (H~β‰₯0.16\tilde{H} \ge 0.16, the Hesitation % scale) works across questions with different numbers of options; fit the threshold on your own labelled data (Calibrate your policy).

1. The Three Eras of Decision Systems (Technical Deep Dive)

Section titled β€œ1. The Three Eras of Decision Systems (Technical Deep Dive)”
Era 1: Classical Statistical ML --> Era 2: Classical Symbolic NLP --> Era 3: Autoregressive GenAI --> The Emerging Era: Decision Models
(Naive Bayes, SVM, XGBoost) (N-grams, HMMs, WFSTs) (Gemini, Gemma) (Discrete Block Diffusion / dgem)
Bag-of-Words / Zero Context Local Sliding Window Causal Sequential Next-Token Non-Autoregressive Canvas Readout
Microsecond / Cheap CPU Millisecond / C++ Rulebooks Multi-Second / Heavy GPU Loops Sub-Second / Guaranteed Schema

Era 1: Classical Statistical ML & Discriminative Encoders (1960s–Present)

Section titled β€œEra 1: Classical Statistical ML & Discriminative Encoders (1960s–Present)”
  • Core Algorithms: Naive Bayes, Logistic Regression, Support Vector Machines (SVMs), Random Forests, XGBoost, Dual-Encoders (GTR / Sentence-T5), Tabular Foundation Models (TabPFN), and Fine-Tuned Cross-Encoder Heads (BERT, DeBERTa-v3).
  • Mechanism: Treat text as an unordered Bag-of-Words (BoW) matrix, static linear classification head, or pooled dense embedding vector u∈Rdu \in \mathbb{R}^d: P(C∣w1,…,wn)∝P(C)∏i=1nP(wi∣C)P(C \mid w_1, \dots, w_n) \propto P(C) \prod_{i=1}^n P(w_i \mid C)
  • Strength: Microsecond to millisecond inference, minimal memory footprints, and fixed output schemas.
  • Fatal Flaw: Zero-Shot Rigidity, Late-Pooling Loss & Independent Heads. Classical statistical ML cannot model word order, grammatical modifiers, or negation. Fine-tuned encoder heads understand context but require dataset relabeling and weight retraining whenever policies changeβ€”and evaluating 3 questions requires 3 separate classification heads that cannot attend to each other.
πŸ’‘ Concept Aside: What about pairing a GTR Dual-Encoder with a Zero-Shot Tabular FM (TabPFN / TabFM)? (click to expand)
  • Why Engineers Ask: Can we encode the input and policy labels with a GTR (Sentence-T5) dual encoder, normalize the similarity vectors into a table, and run a zero-shot tabular model (TabPFN) on top?
  • The Two Bottlenecks:
    1. Late Vector Pooling: GTR compresses a 1,000-token input into a single vector u∈Rdu \in \mathbb{R}^d before reading your policy rules, destroying token-to-token alignment (e.g., SQL parameter drift in a tool call, or 50–75% < 100% in a numeric claim).
    2. Support-Row Requirement: TabPFN requires labeled support rows (Nsupport>0N_{\text{support}} > 0) in its tabular context grid, whereas dgem’s .json.tmpl policies compile zero-shot (N=0N=0) via full token-level cross-attention.
  • Deep Dive: Read the full breakdown in Discrete Diffusion vs. Autoregression (Β§5) and the Glossary & Mental Models.

Era 2: Classical Symbolic NLP & Automata (1990s–Present)

Section titled β€œEra 2: Classical Symbolic NLP & Automata (1990s–Present)”
  • Core Algorithms: Regular Grammars, Hidden Markov Models (HMMs), Weighted Finite-State Transducers (WFSTs like OpenFst, Google Sparrowhawk, NVIDIA NeMo).
  • Mechanism: Model sequential transitions using regular languages (Chomsky Type-3) and shortest-path algorithms over tropical semirings: ShortestPath(T∘Input∘V)\text{ShortestPath}(T \circ \text{Input} \circ V)
  • Strength: Extremely fast (milliseconds in C++), deterministic, zero hallucinations, and mathematically verifiable.
  • Fatal Flaw: Local context horizon (1–3 token sliding window). WFSTs cannot build full-sentence dependency parse trees. As language complexity increases, grammar rulebooks explode into combinatorial conflicts (e.g., tuning a title rule for β€œDr. Smith” causes street thoroughfares like β€œOcean Dr.” to expand to β€œOcean doctor”).

Era 3: Autoregressive Generative AI (2018–Present)

Section titled β€œEra 3: Autoregressive Generative AI (2018–Present)”
  • Core Algorithms: Causal Transformer Decoders (for example Gemini and Gemma).
  • Mechanism: Autoregressive sequence generation. Starting from the prompt, the model serially predicts token t+1t+1 conditioned exclusively on preceding tokens t1…tt_1 \dots t: P(w1,…,wT)=∏t=1TP(wt∣w<t)P(w_1, \dots, w_T) = \prod_{t=1}^T P(w_t \mid w_{<t})
  • Strength: Deep semantic reasoning, world knowledge, and zero-shot instruction following.
  • Fatal Flaws for Structured Decisions:
    1. The Sequential Token Tax: To output a single word like "billing", the model must serially generate thought rationales, markdown tags, or JSON formatting loops, consuming seconds per request.
    2. Formatting & Syntax Drift: Autoregressive models can emit invalid JSON, wrap responses in conversational filler, or succumb to prompt injections.
    3. Strict Causal Masking: Tokens generated early cannot attend to tokens that appear later in the sequence.

When deploying mission-critical systems (such as high-volume customer triage, automated trading, brand safety gating, or real-time speech synthesis), teams encounter four architectural dilemmas:

Decision Architecture DilemmaClassical Statistical ML (Naive Bayes / SVM)Symbolic Automata (WFSTs)Autoregressive LLMs (e.g. Gemini)Discrete Diffusion Decision Models (dgem)
1. The Context Horizon DilemmaZero context (Bag-of-Words). Fails on negation.Local window (1–3 tokens). Fails on semiotic polysemy.Full sequence (unidirectional). Deep reasoning.Full sequence (bidirectional). Deep syntax + slot cross-attention.
2. The Latency & Compute TaxMicroseconds (< 1 ms on CPU).Single-digit ms (1–5 ms on CPU).Multi-second (sequential loop).Sub-second (single forward pass).
3. The Syntactic GuaranteeCategorical output guaranteed.Regular grammar output guaranteed.Probabilistic formatting. Can hallucinate or drift.100% Schema-Guaranteed. Readout directly into pre-allocated slots.
4. Uncertainty CalibrationOverconfident (0.99990.9999 or 0.00010.0001). Unusable.Static arc weights. No probabilistic variance.Logprobs available, but tied to serial token branches.Per-slot probabilities & entropy (Β±Οƒ\pm\sigma and HH); hesitation-gating and per-domain calibration (details).

Rather than generating sequential text, DiffusionGemma treats a decision as a discrete canvas denoising problem:

[System Schema] + [User Input Data] + [Pre-Allocated Canvas: <slot_1> <slot_2> <slot_3>]
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Bidirectional Self-Attention β”‚
β”‚ (Prompt <---> Canvas) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
[Single-Pass Discrete Denoise / Readout]
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β–Ό β–Ό β–Ό
Slot 1: "billing" Slot 2: "yes" Slot 3: "4 (frustrated)"
(confidence: 99.1%) (stderr: Β±0.002) (entropy: 0.04 nats)

Instead of starting an open-ended token generation loop, the system sets aside a short discrete canvas (served with 128 rows; a typical request uses 16 to 64). The canvas holds an answer template with one line per question (urgent: A), and each question in your decision schema (templates/support_triage.json.tmpl) gets exactly one answer token on it.

While autoregressive LLMs apply a causal mask (token 5 cannot look ahead at token 20), DiffusionGemma applies bidirectional self-attention across the entire prompt and canvas.

  • The slot tokens attend to all prompt tokens simultaneously.
  • Crucially, the slot tokens attend to each other. The model’s classification of team = engineering directly influences its confidence on urgent = yes during the exact same forward pass.

At the target slot position, the model projects the latent representation directly against the authorized token vocabulary for that question. For a boolean question ("type": "boolean"), the softmax is restricted strictly to { "yes", "no" }. For a categorical question ("type": "choice"), each option is listed in the prompt with a letter (A: billing, B: technical, …) and the softmax is restricted to those letters. Every label must be a single token at the same canvas position, which is why a choice question has at most 26 options (A–Z); wider taxonomies go through dgem systemone serve, which splits them into brackets.

4. Dual-Mode Uncertainty Telemetry & Epistemic Calibration (ChaosNLI)

Section titled β€œ4. Dual-Mode Uncertainty Telemetry & Epistemic Calibration (ChaosNLI)”

Because decision models project onto restricted candidate vocabularies rather than open-ended decoding paths, they expose clean per-slot probabilities. These are a strong uncertainty signal, though not automatically calibrated probabilities (calibration to a real deployment needs labeled data; see Confidence beyond Shannon):

  • Empirical Standard Error (Β±Οƒ\pm\sigma): On Apple Silicon Metal, multi-seed perturbation noise draws reveal whether the model has high consensus (Β±0.0000\pm 0.0000) or ambiguity (Β±0.1500\pm 0.1500).
  • Monotonic Shannon Entropy (H=βˆ’βˆ‘pkln⁑pkH = -\sum p_k \ln p_k): On items where human annotators disagree (for example ChaosNLI, which has many annotators per item, included in dgem bench-calibration), DiffusionGemma’s single-pass entropy tends to be higher, and accuracy lower, than on items where annotators agree. That makes an entropy threshold a natural trigger to abstain or escalate to a reasoning model.

But raw entropy can be fooled. DiffusionGemma has a habit of picking whichever option is listed first (β€œBox A”). On a borderline question that habit can make a coin flip look like near-certainty, and the entropy gate then waves it through. Confidence beyond Shannon: hesitation-gated decisions explains how dgem handles this: it hands hesitant answers to a larger model, keeps the answer template and prompt layout from distorting the probabilities, monitors option-order bias on every release, and calibrates per domain.

5. Templates as Executable Decision Policies (Policy-as-Code)

Section titled β€œ5. Templates as Executable Decision Policies (Policy-as-Code)”

In classical ML or fine-tuned encoder architectures (such as a fine-tuned DeBERTa-v3 safety classifier), the decision policy is baked into static linear classification weights. If security engineering adds a 4th trajectory hijack state (injection_point vs. hijacked vs. failed_injection), the classifier head must be retrained.

In dgem, a declarative .json.tmpl file is the classifier head:

  • Zero-Shot Policy Compilation: A new policy (trajectory-hijack detection, prompt-injection screening, RAG grounding, passage relevance) is a template edit, with no fine-tuned weights. dgem bench-calibration runs a small suite of such policies over public datasets so you can check them yourself.
  • Joint Multi-Slot Conditioning (slot_1 <-> slot_2): Unlike encoder classifiers that require separate models for binary toxicity (yes/no) and ordinal severity (1–5), a single .json.tmpl policy evaluates all slots simultaneously in one forward pass.

4. The Unified AI Architecture: A Three-Tier Hierarchy

Section titled β€œ4. The Unified AI Architecture: A Three-Tier Hierarchy”

DiffusionGemma does not replace FSTs or conversational LLMs; it fills the critical missing middle tier of modern enterprise architectures:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Tier 1: Deterministic Fast Path (C++ OpenFst / WFSTs) β”‚
β”‚ Latency: milliseconds | Compute: CPU | Scope: routine tokens β”‚
β”‚ Use Case: Currency ($5.99), phone numbers, dates, punctuation, regex. β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ Unresolved Ambiguity / Tied Arc Weights
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Tier 2: Discrete Diffusion Decision Model (DiffusionGemma / dgem) β”‚
β”‚ Latency: sub-second | Compute: GPU / Metal | Scope: ambiguous cases β”‚
β”‚ Use Case: Polysemy, AgentDrift guardrails, RAG grounding, NLU routing. β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ High Epistemic Entropy (H > 0.30 nats)
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Tier 3: Conversational Autoregressive LLM (Vertex AI Gemini) β”‚
β”‚ Latency: seconds | Compute: large model | Scope: hesitant cases only β”‚
β”‚ Use Case: Multi-hop scratchpad reasoning (ANLI-R3), open generation. β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. Tier 1 (The Deterministic Fast Path): Use classical C++ WFSTs or regular expressions for unambiguous transformations. If text contains "$5.99", an FST expands it to β€œfive dollars ninety-nine cents” in about a millisecond. Never pay GPU overhead for deterministic string replacement.
  2. Tier 2 (The Discrete Decision Model): When inputs exhibit semantic ambiguity, polysemy, negation, or require multi-rubric policy enforcement, route to DiffusionGemma. In one forward pass, it resolves the decision policy with full bidirectional context, 100% schema enforcement, and per-slot Shannon entropy HH.
  3. Tier 3 (The Conversational Reasoning Engine): When DiffusionGemma’s uncertainty telemetry flags high uncertainty (H>0.30H > 0.30 natsβ€”such as on human-contested ChaosNLI items or multi-hop ANLI-R3 traps), escalate to a Thinking / Autoregressive LLM (like Google Cloud Vertex AI Gemini) to execute serial scratchpad reasoning or synthesize an explanation for a human reviewer.

QuestionClassical ML / EncodersAutoregressive LLMsDiscrete Diffusion Decision Models (dgem)
How does it decide?Feature weights / static linear headsToken-by-token sequential predictionBidirectional canvas slot denoising
How are policies updated?Relabel dataset & retrain weightsPrompt engineering + output parserDeclarative .json.tmpl (Policy-as-Code)
How fast is it?Microseconds – millisecondsSecondsSub-second (1 forward pass)
Can slots attend to each other?No (independent heads)Unidirectional (left -> right only)Yes (slot_1 <-> slot_2 bidirectionally)
Does it know when it’s unsure?Overconfident out-of-domainUncalibrated sequence logprobsOften: entropy rises with human disagreement, but option order can hide it (hesitation-gating)
Can it handle vision?Separate vision classifiersYes (multimodal autoregression)Yes (native SigLIP vision canvas)

By decoupling deep contextual reasoning from slow sequential text generation, DiffusionGemma and dgem bring the power of 26B foundation models to sub-second, zero-shot decision engineering.