Gemma Decide E2B v1

Gemma Decide E2B v1 is the lightweight edge/sidecar tier of the Gemma Decide multimodal System 1 decision model family, adapted from google/gemma-4-E2B-it to answer multiple structured decision questions (noul, choice, score) over text, JSON, or image states in a single non-autoregressive forward pass with calibrated probabilities β€” compatible with the Jev and Laya decision schema.

License notice: The gemma-decide codebase is licensed under Apache-2.0. These v1 preview weights are released under CC-BY-NC-4.0 (research / non-commercial) because the v1 training mix includes public research/non-commercial and copyleft benchmark train splits (listed transparently below). The derived training dataset is not redistributed. A clean synthetic/permissive-only Apache-2.0 v2 release is planned.


Key Highlights

  • Single-pass parallel decisions (zero decode tokens): Evaluates 1–16+ noul (binary probability), choice (2–255+ dynamic natural-language options), and score (ordered rubric) questions simultaneously.
  • Multimodal from Day 1: Natively accepts text, structured JSON, and images (280 soft tokens default via Gemma 4 E2B's vision tower).
  • Fast on a single GPU (RTX 4090, bf16 merged + torch.compile):
    • 38.4 ms for 5 parallel questions on typed_decisions (~7.7 ms/decision, 14.4Γ— faster than zero-shot Gemma 4 E2B).
    • 30.0–38.8 ms for single-question routing, guardrails, NLI, or rubric scoring (56.5 ms for 77-way dynamic intent classification).
    • 65.8 ms median for full image + text multimodal decisions (vision_tower.encoder compiled).
  • Calibrated for System-1 β†’ System-2 escalation: Proper scoring rule training (CE + 0.5Β·Brier + 0.5Β·RPS) + held-out per-bucket temperature scaling yields 0.029–0.059 ECE on classification/scoring and 0.109–0.171 ECE on 100% unseen OOD tasks.

Gemma Decide v1 Family Comparison (n <= 400 / 4,400 Questions)

All models trained on the identical 20,997-bundle training split (LocalLLaMA/typed-decisions, Lin-Chen/MMStar, and TIGER-Lab/MMLU-Pro 100% unseen):

Benchmark (Q's) E2B v1 (this model, 10.3 GB) E4B v1 (16.1 GB) 26B-A4B v1 (51.9 GB, 4B active)
Held-out Val (1,000 bundles) 0.495 / 85.6% 0.432 / 87.4% 0.332 / 90.1%
typed_decisions (2,000 unseen) 62.5% (ρ 0.810) 69.1% *(ECE 0.100)* 69.1% *(ρ 0.853)*
sst2 (400, binary noul) 94.0% (ECE 0.030) 96.3% (ECE 0.023) 97.0% *(ECE 0.019)*
sst5 (400, 5-pt score) 59.0% (ρ 0.863) 62.5% *(ECE 0.045)* 65.3% *(ρ 0.888)*
mnli (400, 3-way NLI) 86.0% (flip 2.5%) 87.8% *(flip 0.0%)* 91.0% *(ECE 0.028)*
mmstar (400, unseen vision) 48.3% (ECE 0.171) 54.8% (ECE 0.153) 66.3% *(ECE 0.118)*
banking77 (400, 77-way) 82.0% *(ECE 0.031)* 83.3% (ECE 0.050) 84.5% *(flip 3.3%)*
mmlu_pro (400, 10-way 0-CoT) 37.0% (ECE 0.109) 46.5% (ECE 0.112) 59.0% *(ECE 0.057)*

Architecture

  1. Tree-Masked Causal Backbone (google/gemma-4-E2B-it):
    • state (text/JSON/images) occupies positions 0 .. L_state - 1.
    • Every question branch Q_i starts at logical position L_state and attends only to state + its own causal prefix (zero cross-question leakage, mathematically verified against sequential forward passes).
    • Preserves Gemma 4 E2B's 20/35 KV-shared layers (logits_to_keep = num_question_tokens slices state tokens before layer 15), 4:1 sliding-512/global attention, Per-Layer Embeddings (PLE), and native multimodal fusion.
  2. 2-Layer Bidirectional DecisionHead (~39M params, hidden_size=1536, ffn_dim=2048):
    • Each option line ends with Gemma 4's built-in <mask> token.
    • A lightweight 2-layer Pre-Norm bidirectional transformer runs over each question branch so all options attend to each other (handling "Other / None of the above" and reducing option-order bias) before a 2-layer MLP produces calibrated option logits.
  3. Standalone Merged Checkpoint (10.32 GB, zero PEFT):
    • Trained with LoRA (r=32, alpha=64) on both language_model and vision_tower + unfrozen embed_vision projector + full DecisionHead (101.49M trainable params), then folded into base weights via merge_and_unload().

Detailed Benchmarks (n <= 400 / 4,400 Questions, RTX 4090 bf16 Merged + Compiled)

LocalLLaMA/typed-decisions, multimodal Lin-Chen/MMStar, and TIGER-Lab/MMLU-Pro are 100% unseen during training (zero leakage).

Benchmark Q's Acc ECE ↓ Brier ↓ Spearman / MAE p50 ms @0.80 Conf (Acc / Cov) @0.90 Conf (Acc / Cov) Flip Rate (40Q)
typed_decisions (100% unseen) 2,000 62.5% 0.140 0.247 0.810 / 0.433 38.4 76.7% (50% cov) 81.0% (33% cov) 12.5%
sst2 (binary noul) 400 94.0% 0.030 0.086 β€” 38.8 97.0% (90% cov) 99.1% (83% cov) β€”
sst5 (5-pt ordinal score) 400 59.0% 0.059 0.537 0.863 / 0.518 38.3 74.2% (8% cov) 100.0% (0.5% cov) β€”
mnli (3-way NLI choice) 400 86.0% 0.029 0.208 β€” 35.4 93.8% (81% cov) 96.2% (65% cov) 2.5%
mmstar (100% unseen vision) 400 48.3% 0.171 0.645 β€” 65.8* 67.2% (33% cov) 79.3% (22% cov) 22.5%
banking77 (77-way dynamic choice) 400 82.0% 0.031 0.260 β€” 56.5 95.5% (67% cov) 97.5% (51% cov) 10.0%
mmlu_pro (100% unseen 10-way, 0-CoT) 400 37.0% 0.109 0.768 β€” 30.0 68.9% (19% cov) 79.5% (11% cov) 60.0%

*65.8 ms median across varied aspect ratios (351Γ—190 to 2048Γ—1365) with vision_tower.encoder compiled (97.8 ms with eager ViT).

typed_decisions per-primitive accuracy (2,000 unseen questions): choice = 67.5%, noul = 60.3%, score = 60.3% (MAE = 0.433 on 0–4 scale, Spearman = 0.810).


Training Data & Upstream Attributions

Trained on 21,997 bundles (45,319 calibrated questions; 20,997 train / 1,000 held-out validation & calibration; 5,997 multimodal bundles) for 2 epochs (2,625 steps, grad_accum=16) on 1Γ— NVIDIA A100-SXM4-80GB. Soft probability targets were distilled from Gemma 4 31B (google/gemma-4-31B-it, Apache-2.0) using 2-permutation order-debiased logprobs alongside train-split ground-truth anchors.

Upstream sources used (train splits only; strict zero-overlap with all eval sets):

  • Synthetic software/agent JSON states generated by Gemma 4 31B across 24 domains Γ— 4 tones (Apache-2.0 outputs)
  • Conversational states adapted from wildchat-1m (ODC-BY) and no_robots (CC-BY-NC-4.0), labeled by Gemma 4 31B
  • Multimodal vision states adapted from A-OKVQA (research/NC), ChartQA (GPL-3.0), DocumentVQA (research/NC), and ScienceQA-IMG (CC-BY-NC-SA-4.0), labeled by Gemma 4 31B
  • Text ground-truth train anchors: PolyAI/banking77 (CC-BY-4.0), SetFit/sst2 & SetFit/sst5, nyu-mll/glue (mnli), google/boolq (CC-BY-SA-3.0), allenai/ai2_arc (CC-BY-SA-4.0), allenai/sciq (CC-BY-NC-3.0)

Usage

Install

uv pip install "gemma-decide[serve] @ git+https://github.com/firworksyt/gemma-decide.git"
# or clone the repo:
# git clone https://github.com/firworksyt/gemma-decide && cd gemma-decide && uv sync --extra serve

Python

import torch
from gemma_decide.model import GemmaDecideModel
from gemma_decide.schema import ChoiceQuestion, DecisionRequest, NoulQuestion, ScoreQuestion

model, processor = GemmaDecideModel.from_checkpoint(
    "Firworks/gemma-decide-e2b-v1",
    dtype=torch.bfloat16,
    device_map="cuda:0",
)
model.compile_for_inference(dynamic=True)

req = DecisionRequest(
    state={"ticket": "My debit card was declined twice at the grocery store."},
    questions={
        "urgent": NoulQuestion(instructions="Requires immediate customer support action."),
        "intent": ChoiceQuestion(
            instructions="Select the customer intent.",
            criteria={
                "declined_card_payment": "Card payment was declined",
                "lost_or_stolen_card": "Card was lost or stolen",
                "card_delivery": "Waiting for card delivery",
            },
        ),
        "frustration": ScoreQuestion(
            instructions="Rate user frustration level.",
            criteria=["Calm", "Mildly annoyed", "Frustrated", "Very angry"],
        ),
    },
)
resp = model.decide(req, processor)
print(resp.model_dump_json(indent=2))

FastAPI Server (/v1/decisions & /v1/systemone)

uv run python scripts/serve.py \
  --checkpoint Firworks/gemma-decide-e2b-v1 \
  --compile --warmup --host 127.0.0.1 --port 8080

Limitations & Intended Use

  • System 1, not System 2: Designed for fast, calibrated routing, guardrails, moderation, intent classification, rubric grading, and lightweight visual triage β€” not multi-step math, code synthesis, or complex chain-of-thought reasoning. Pair with a confidence threshold (e.g., confidence >= 0.80) to escalate uncertain cases to a frontier LLM, or step up to gemma-decide-e4b-v1 / gemma-decide-26b-a4b-v1 for harder reasoning and vision workloads.
  • Vision resolution: Trained at Gemma 4 E2B's 280 soft-token budget (which fits inside E2B's 512-token local sliding window). Fine dense OCR or tiny chart text may still require higher-resolution System-2 VLMs.
  • Non-commercial v1 weights: Use for research, evaluation, and non-commercial prototypes; await a clean Apache-2.0 v2 checkpoint for commercial production deployments.
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Firworks/gemma-decide-e2b-v1

Finetuned
(538)
this model