Skip to content
dgem has moved to github.com/GoogleCloudPlatform/dgem. Docs are moving to googlecloudplatform.github.io/dgem; this site stays up during the move.

DiffusionGemma — Zero-Shot Decision Model

Turn declarative .json.tmpl schemas into sub-second zero-shot Decision Policies with per-option probabilities and a hesitation score for hesitation-gated hand-off—via Decision Studio (Web UI), Model Context Protocol (MCP), HTTP REST API, or CLI across Vertex AI Dedicated Endpoints (/invoke/*), Serverless Cloud Run GPUs, and Apple Silicon Metal.

📝 Policies and decisions

For policy authors and users: write a .json.tmpl policy, read probabilities and hesitation, add samples and follow-up questions, run datasets. Start with Your first decision policy.


🖥️ 1. Decision Studio Web App (dgem serve)

Embedded Lit WebComponents playground (./bin/dgem serve --port 8090) featuring all 26+ .json.tmpl policies, topbar Backend Target selector (vertex_first | vertex | cloudrun), Stage 2 Gemini Cascade (gemini-3.8-flash), an approximate bounding-box canvas (EXP-09; coarse, see what dgem can do with images), and OpenTelemetry Trace Waterfall inspection.

🤖 2. Model Context Protocol (MCP) Server

Connect Gemini CLI, Claude Desktop, Cursor, or cloud agents via dgem mcp (stdio) or POST /mcp (Streamable HTTP). Exposes 6 native MCP tools (decide_policy, locate_bounding_boxes, decide_custom_questions, list_policy_templates, get_health_and_gpu_status, warmup_gpu) with backend (vertex_first | vertex | cloudrun) and Stage 2 Gemini Cascade parameters.

🌐 3. HTTP Gateway REST API (/api/decide & /v1/systemone)

Call POST /api/decide/{template} or POST /v1/systemone with X-DGem-Backend: vertex_first | vertex | cloudrun (X-DGem-Backend-Used returned on every response). Routes to the warm Vertex AI dedicated endpoint with automatic Cloud Run failover (Gateway and routing).

⌨️ 4. CLI & 9 Benchmark Harnesses

Execute sub-second decisions (dgem decide), generative prompts (dgem ask), and nine reproducible benchmark suites (bench, bench-ecotone, bench-intents, bench-calibration, bench-bbox, bench-rerank, bench-jev, bench-permutation, bench-decision-index).


📜 Policy-as-Template (Zero-Shot)

Treat .json.tmpl files as executable decision policies rather than brittle prompts. Add new boolean gates, [A-Z] choices, or ordinal rubrics in seconds without retraining encoder heads—achieving 100% accuracy on AgentDrift trajectory hijacks, deepset/prompt-injections, LLM-AggreFact grounding, and MS MARCO.

📊 Uncertainty Gate & Stage 2 Gemini Cascade

Every field comes with its own probabilities and Shannon entropy HH, which rises when human annotators disagree (EXP-04). Routing only high-entropy items to gemini-3.8-flash lifted a 50-item public calibration suite from 88% to 98.0% while escalating 34% of items (EXP-05b).

🎯 Hesitation-Gated Decisions

Clear answers return in about 0.1 s; hesitant ones go to a larger model. Hesitation flags wrong answers with AUROC ≈ 0.85 on 231 JevBench items (EXP-17), and a live 35% gate reached 81/100 safety and 86/100 faithfulness with 8–32% handed off (EXP-18). How it works

⚡ Single-Step Slot Denoise (O(1))

Unmask all decision slots simultaneously in one forward step (~55 ms GPU on Vertex G4), completely eliminating autoregressive token-by-token generation overhead.


Confidence beyond Shannon, in three measured steps

Section titled “Confidence beyond Shannon, in three measured steps”

Start with Shannon entropy, shown as hesitation; calibrate each policy on its own held-out data; hand hesitant answers off. Read the full story →

Step 1 · Start with Shannon
Hesitation % · AUROC ≈ 0.85
A probability for every option; their normalized Shannon entropy flags likely errors (231 JevBench items, EXP-17)
Step 2 · Beyond Shannon: calibrate per policy
ECE 0.081 → 0.054
Raw probabilities are over-confident by domain; a temperature fitted on held-out folds fixes it (JevBench n=231, EXP-14; XNLI 0.227 → 0.036, n=4,493)
Step 3 · Gate on hesitation
221 / 231 with 39% handed off
Answers at ≥ 16% hesitation go to gemini-3.8-flash; the rest stay at about 0.1 s (EXP-14)
Withdrawn (September 2026)
-56.2% ECE · Beats #1 Hopper
Temperature fitted and scored on the same items; cross-validated, no gain on 50 items. Current view →

⚖️ Confidence Beyond Shannon

Every answer carries a probability for each option and a hesitation score. Templates and prompt layout are designed not to distort them, option-order bias is measured on every release, and calibration is fitted per domain. Read why dgem decisions can be trusted →

🔎 Listwise Reranking & Image Questions

Continuous Softmax Expectation (r^i=∑g⋅pi,g\hat{r}_i = \sum g \cdot p_{i,g}) scores 10 candidate RAG passages + 2 security gates in 1 pass (EXP-10, 0.9265 nDCG@10, 0.0% tie rate) and answers categorical questions about images (presence, relations, 3×3 location, count) in one ~0.2 s pass, routing unsure answers to Gemini (what dgem can do with images).

☁️ Vertex AI (/invoke/*), Cloud Run & Apple Metal

Run with no cold start (~55 ms GPU per decision) on Vertex AI Dedicated Endpoints (g4-standard-48 + RTX PRO 6000), scale-to-zero ($0.00/hr idle) on Cloud Run GPU, or offline on Apple Silicon Metal.


Measured with serving image 504638d, 3-question decision, samples: 1, p50 (receipts). Details: From laptop to production.

TargetHardwareCold startGPU / end to endUse it for
Vertex AI dedicated endpointg4-standard-48 + 1× RTX PRO 6000None (min 1 replica)55 / 150 msProduction (default vertex_first)
Cloud Run GPU1× RTX PRO 60002.3–2.7 min (Direct VPC egress)61 / 153 msFailover, batch, $0-idle use
Apple Silicon (diffgemma)M-series, 4-bitNone~0.9 sDevelopment, offline

Launch the interactive Decision Studio Web App, REST API Gateway, and MCP Server in a single command:

Terminal window
# 1. Start Decision Studio Web UI + HTTP API + Streamable HTTP MCP Server on port 8090
./bin/dgem serve -u "https://<CLOUD_RUN_URL>/v1" --gcp-auth --port 8090
# -> Open http://localhost:8090 in your browser for Decision Studio
# -> Connect MCP clients to http://localhost:8090/mcp (or run './bin/dgem mcp' over stdio)
# 2. Call any named .json.tmpl policy over HTTP REST (no dgem CLI needed by caller)
curl -s http://localhost:8090/api/decide/support_triage \
-H "Content-Type: application/json" \
-d '{"variables": {"ticket": "Charged twice on invoice #9481 and prod API locked!"}}' | jq .