Summary
Table | |
|---|
| Backbone | google/gemma-4-31B-it (revision 842da37) |
| Design | letter readout: the model's own output-layer logits of the option labels |
| Trained weights | stage 1: full fine-tune of every linear projection of the 60 decoder layers (29.29B parameters), two runs averaged and blended with the backbone; stage 2: a rank-32 LoRA improvement stage, merged into the dense weights. The token embeddings (tied with the output layer) and every norm are the backbone's |
| Attention | bidirectional in the 10 global (full-attention) layers; causal in the 50 sliding-window layers |
| Question types | choice, noul and score (trained on choice and noul) |
| Decision Index | to be added: our run of the public 0.3 suite is in progress |
| Temperature | a global T = 1.167 and 22 per question category (0.850 to 1.333) |
| Token limits | none declared; trained on prompts of up to 16,384 tokens |
| GPU memory | 58.3 GiB of bf16 weights |
How it works
- Prompt. Gemma's own chat template with thinking off: a system turn, then one user turn with the list of questions
and the state, then one block per question with its labelled options, ending in an
Answer: ( slot.
- Score. At each slot, the model's output-layer logits of the question's option labels (A, B, …, then AA, AB, …,
up to 255 options; final logit softcap included). A softmax at the question category's temperature gives the
probabilities.
- Two option orders. Every
choice question whose options may be reordered is read twice, with its options as
given and rotated by half; the two log-probability vectors are averaged. This cancels the preference for a label
position. Questions marked "permute": false keep their order and are read once.
- Bidirectional attention. See the next section.
- Weights. A full Gemma-4 checkpoint in bf16 (13 safetensors shards), plus
head.pt with the readout, the
attention rule, the serving policy and the temperatures. The stage-2 update is already merged: no adapter is needed.
- Never. It never truncates, drops or reorders options, tunes prompts per benchmark, or sees gold labels.
Table with columns: type, options, returns| type | options | returns |
|---|
choice | the caller's keys, optionally described (2 to 255) | the most likely key, a confidence, a probability per key |
noul | yes / no | P(yes) |
score | an ordered list of 2 to 10 levels | the expected level, a confidence, a probability per level |
Bidirectional attention
Gemma-4-31B-it interleaves 10 global (full-attention) layers with 50 sliding-window layers (1,024-token window). A
text-generation model has to be causal: each token only sees the tokens before it. A decision model generates nothing,
so the global layers can read in both directions.
- One question. The whole prompt is one block: in the global layers every token attends to every other token,
before and after it, so the state is read in the light of the question and its options.
- Several questions. The shared block (system turn, the list of questions, the state) attends only to itself.
Each question's block attends to the shared block and to itself. Questions never see each other's options.
- Sliding-window layers. Causal in every case, as in the base model.
- Trained and served the same way. Both training stages used this attention, and
sieve serves it the same way.
head.pt records the rule, and sieve sets the attention when it loads the model.
- Shared state. In a request with several questions and a shared block of 2,048 tokens or more,
sieve computes
the shared block once and reuses its keys and values for every question (and both option orders). The result is the
same as computing it with each question.
Use
pip install -r https://raw.githubusercontent.com/sthanika-ai/Sieve/main/requirements.txt # the tested versions (torch 2.8.0)pip install "sieve-decisions[serve] @ git+https://github.com/sthanika-ai/Sieve"
from sieve import load_sieve, decide m = load_sieve("sthanika-ai/Sieve-31B-v4")decide(m, {"subject": "Duplicate charge on invoice 4411", "body": "Billed twice. Refund today or we cancel."}, {"department": {"type": "choice", "instructions": "Which team handles this?", "criteria": {"billing": "invoices, payments, refunds", "technical": "bugs and outages"}}, "churn_risk": {"type": "noul", "instructions": "Does the customer threaten to cancel?"}})
- Loading. Load it with
sieve 0.5.1 or later, which reads head.pt and applies the prompt, the attention rule,
the two option orders and the temperatures. Loading the weights with transformers alone gives the language model
without any of these.
- GPU memory. The bf16 weights take 58.3 GiB, and
sieve loads the model on one GPU. The architecture and size
are those of Sieve-31B-v3, whose serving benchmark peaked at 81.4 GiB allocated: one 96 GB GPU runs every public
Decision Index request, and shorter requests fit on an 80 GB GPU. Our own evaluation code splits the layers over two
to four NVIDIA A100-SXM4-40GB GPUs.
- Token limits. None declared. Requests are never truncated; one that does not fit in GPU memory fails with an
error instead of a wrong answer. The model was trained on prompts of up to 16,384 tokens.
- Server.
sieve-serve --model sthanika-ai/Sieve-31B-v4.
- Decision Index.
python -m decision_index run --engine sieve.decision_index_engine:SieveEngine --option model=sthanika-ai/Sieve-31B-v4 --out runs/Sieve-31B-v4
.
- Temperature per category.
head.pt stores a global T = 1.167 and 22 temperatures (0.850 to 1.333), fitted by
NLL on the calibration split (15,972 questions) under the two-order reading. A question's category is its type, its
number of options (2, 3-4, 5-9, 10-25, 26+) and the kind of state (empty, text or JSON). A question takes the
temperature of its most specific category in the table (choice:3-4:text, then choice:3-4, then choice), else
the global T. Temperatures never change an answer, and load_sieve(..., temperature=1.0) gives raw probabilities.
Results
Decision Index
Our run of the public Decision Index 0.3 suite is in progress. This section will be updated with its result.
Calibration
The temperatures were fitted on the calibration split (15,972 questions), which was not used for training or for
choosing the weights. Both rows are measured on that split.
Table with columns: split, questions, NLL, ECE| split | questions | NLL | ECE |
|---|
| calibration, per-category temperatures (shipped) | 15,972 | 0.1741 | 0.0082 |
| calibration, one global T = 1.167 | 15,972 | 0.1736 | 0.0080 |
Training
- Stage 1: full fine-tune.
- Full fine-tune of every linear projection of the 60 decoder layers (29,286,727,680 parameters); the token
embeddings (tied with the output layer) and every norm stay frozen. The 10 global attention layers were
bidirectional during training, as in serving.
- Loss: cross-entropy on the option-label logits + 0.3 × the multi-class Brier score.
- AdamW, lr 2e-6, betas (0.9, 0.95), weight decay 0.01, gradient clipping at 1.0, 5% linear warm-up then cosine decay
to 0.1×, 1 epoch, 128 records per step: 7,914 steps.
- bf16 weights with Kahan-compensated updates; AdamW moments in fp32 in CPU memory; gradient checkpointing.
- A record's questions share one pass over its state under the attention rule above, in packs of up to 16,384
tokens. Longer records are dropped, never truncated (none were).
- Permuted choice options, "none of the above" augmentation (as the answer, as a wrong option and in minimal pairs)
and irrelevant distractor options.
- Two runs with different seeds (0 and 1), each on eight NVIDIA A100-SXM4-40GB GPUs for about 108 hours (about
1,735 training GPU-hours together).
- Stage-1 weights: 0.35 × seed 0 + 0.35 × seed 1 + 0.30 × the backbone, chosen among 21 candidates (each run at 50%
and 100% of training and the average of the two final runs, each blended with the backbone at 0.5, 0.7, 0.85 and
1.0, plus one per-layer blend) on our internal test set. The Decision Index benchmarks were never used to choose
the stage-1 weights.
- Stage 2: targeted improvement.
- Rank-32 LoRA (alpha 32, fp32 adapters, no dropout) on the decoder projections of the stage-1 weights, with the
same loss and attention.
- AdamW, lr 3e-5, 4% linear warm-up then cosine decay to 0.1× over a 750-step schedule, run for 300 steps; 128
records per step (38,400 records).
- 14.5% of those records are new data for selected skills: link-based phishing emails (1,600), stance (VAST train
split, 1,800), BANKING77 intents (900), group rankings from the training cohorts of the Habermas Machine study,
with no overlap with its evaluation cohorts (780), and chord quality (500). The rest replays stage-1 training data;
1,600 replayed records also carry a 0.2-weighted distillation term towards cached predictions of the base model
and the stage-1 weights.
- The stage-2 skills were chosen from a per-benchmark review of the stage-1 weights, including the public Decision
Index 0.3 suite; no Decision Index test item was used for training.
- Six NVIDIA A100-SXM4-40GB GPUs, 6 h 10 min (37 GPU-hours).
- Release weights. Stage-1 weights + 0.75 × (stage-2 weights − stage-1 weights), computed in fp32 and rounded to
bf16 once; the step (300) and the strength (0.75) were fixed before stage 2 was trained. The temperatures were then
fitted on the calibration split.
- Held-out monitor. On a 6,000-question sample of the held-out split (drawn separately for each run), the two
stage-1 runs reached accuracy 0.9203 and 0.9158 and NLL 0.2045 and 0.2097 at step 7,914.
- Data. Stage 1: 1,012,882 training records (1,307,608 questions), with 10,720 records (16,120 questions) for the
stage-1 calibration and 11,041 records (16,509 questions) held out. Stage 2: a 96,000-record mix for the 750-step
schedule (38,400 used), with a calibration split of 15,972 questions (the one the shipped temperatures were fitted
on) and 10,971 records (16,379 questions) held out.
- Sources. Public datasets (never their test or validation splits) and generated decision records.
- Not published. The training files are not part of this release; the SHA-256 of each file is in
training_config.json.
Limitations
score questions. The training data has only choice and noul questions. score questions are answered by
the same readout with the levels as options, but the model was not trained on them.
- More than 255 options. The readout has 255 option labels; a
choice question with more options is refused.
Files
Table with columns: file, contents| file | contents |
|---|
model-*.safetensors, model.safetensors.index.json, config.json, generation_config.json | the full model in bf16 (13 shards) |
head.pt | the readout (labels and prompt format), the attention rule, the serving policy and the calibrated temperatures (global and per category) |
tokenizer.json, tokenizer_config.json, chat_template.jinja | Gemma-4-31B-it's tokenizer and chat template, unchanged |
training_config.json, training_metrics.json, train.log | the recipe of both stages, their metrics and logs |
result.json | the calibration and held-out monitor numbers above (the Decision Index result will be added) |
provenance.json | SHA-256 of every file and of the training data, and library versions |
License
The weights are released under Apache-2.0 (see LICENSE), as is the code at
github.com/sthanika-ai/Sieve. Use of the base model is governed by Gemma's
terms, including Google's prohibited-use policy.