Decision Model 4B (Qwen3.5-4B)
- 📖 Blog: How to Train Your Own Decision Model With Minimal Changes to an LLM
- 📊 Training data: Mercity/decision-model-data
- 🤗 Smaller sibling: Mercity/decision-model-minicpm5-2b-lora
- 🪣 Code, logs, checkpoints and technical report: Mercity/Desicion-Model-Custom (Hugging Face bucket)
A decision model: give it a piece of evidence, a criterion and a list of options, and it returns a calibrated probability for every option in one forward pass (about 40 ms on an A100). For questions it is unsure about, the same model can think first, writing a reasoning chain and then answering.
| Base model | Qwen/Qwen3.5-4B, text-only |
| Training | LoRA (rank 32), supervised on 42K decision questions and 11K reasoning chains, then 60 steps of GRPO on thinking mode; merged into the weights |
| Format | bf16 safetensors, Qwen3_5ForCausalLM |
| Question types | choice (pick 1 of 2-26 options), yes/no, score (a level on an ordered scale) |
| Language | English |
| License | Apache 2.0 |
Results
Our evaluation set has 5,442 questions from four sources. Thinking-mode and routed numbers use a fixed 1,498-question subset of it.
| Qwen3.5-4B (untrained) | This model | |
|---|---|---|
| Fast readout accuracy | 62.7% | 72.5% |
| Thinking-mode accuracy | 84.0% | 83.1% |
| Chains that never finish (loops) | 0.9% | 0.2% |
| Routed: 30% of questions to thinking | 73.0% at 1,069 thinking tokens/question | 81.8% at 729 thinking tokens/question |
| Fast-readout calibration error (ECE) | 0.030 | |
| S1MB Task Avg, fast readout (137 tasks) | 32.8 | 47.9 |
| S1MB Task Avg, routed 30% | 55.2 |
Fast-readout accuracy by evaluation set (untrained → this model): procedural 46.8 → 89.5%, tasksource 60.4 → 72.3%, OpenDecisions 66.5 → 73.9%, LocalLLaMA 63.0 → 66.3%. Sources least like the training data gained the least.
On Jevals (suite 0.1.0, Decision Score), the fast readout scores 58.6 on PubMedQA, 61.3 on Banking77 and 2.4 on HelpSteer2. That puts it mid-pack, 6-10 points behind Jev, but among the best-calibrated entries on the board.
How it works
- Fast readout. The prompt (thinking off) ends where the answer letter goes. The model's next-token logits for the
option letters
A,B, ... are divided by a per-question-type temperature (incalibration.json) and passed through a softmax. Nothing is generated. - Thinking mode. The same prompt with thinking on. The model writes a chain inside
<think>...</think>, then the letter. Reading the letter probabilities right after the chain gives calibrated probabilities for this mode too. - Routing. Every question gets the fast readout. Questions whose margin is small go to thinking. The margin is the log-probability gap between the top two options. Routing the least certain 30% recovers 79% of the accuracy gap between fast and thinking mode, at a fraction of the cost.
Usage
Requires transformers>=5.19 (the version the checkpoint was saved with), torch and accelerate. Qwen3.5 uses
Gated DeltaNet layers: install flash-linear-attention and causal-conv1d for fast kernels, or transformers falls
back to a slow PyTorch path.
The prompt format matters: the model was trained on one fixed format, and decision.py in this repo builds it.
import json, os, sys
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Mercity/decision-model-qwen3.5-4b"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16, device_map="auto")
calib = json.load(open(hf_hub_download(repo, "calibration.json")))
sys.path.insert(0, os.path.dirname(hf_hub_download(repo, "decision.py")))
import decision as D
# Fast readout: one forward pass, a probability per option
evidence = "Order #1182: 3 x USB-C dock at $79 each, shipping $12."
criterion = "Does the order fit within a budget of $250?"
options = D.yes_no_options() # A = true, B = false
probs = D.fast_readout(model, tok, evidence, criterion, options, temperature=calib["readout"]["noul"])
print(probs) # [p(true), p(false)]
Options are written as id: description, whichever parts exist. Use the helpers to build them:
choice = [D.option("refund", "Issue a refund."), D.option("replace", "Send a replacement."),
D.option("escalate", "Hand the ticket to a human agent.")] # qtype "choice"
score = D.score_options(["Benign: read-only actions.", "Low: routine writes.",
"Moderate: irreversible actions.", "High: destructive actions."]) # qtype "score"
Routed system (fast by default, thinking for low-margin questions):
def decide(evidence, criterion, options, qtype, cutoff=calib["routing"]["cutoff_route_30pct"]):
probs = D.fast_readout(model, tok, evidence, criterion, options, temperature=calib["readout"][qtype])
if D.margin(probs) >= cutoff:
return {"answer": max(range(len(probs)), key=probs.__getitem__), "probs": probs, "mode": "fast"}
rec = D.think(model, tok, evidence, criterion, options, max_new_tokens=8192,
temperature=0.6, top_p=0.95, top_k=20) # Qwen3.5's recommended thinking settings
post = D.post_chain_readout(model, tok, rec, len(options), temperature=calib["thinking"][qtype])
if post is None: # chain did not finish: keep the fast answer
return {"answer": max(range(len(probs)), key=probs.__getitem__), "probs": probs, "mode": "fast"}
return {"answer": max(range(len(post)), key=post.__getitem__), "probs": post, "mode": "thinking",
"chain": rec["text"]}
qtype is "choice", "noul" (yes/no) or "score". The cutoff in calibration.json sent 30% of our evaluation
questions to thinking; the share on your traffic will differ, so set the cutoff from a sample of your own questions.
Our evaluation allowed chains up to the 32K context. The RL stage capped chains at 8,192 tokens, and 0.2% of chains
did not finish.
Serving with vLLM. Our numbers come from vLLM. For the fast readout, request one token restricted to the option letters and read their log-probabilities:
from vllm import LLM, SamplingParams
llm = LLM(repo, dtype="bfloat16", max_model_len=32768, max_logprobs=26, logprobs_mode="processed_logprobs")
ids = D.letter_ids(tok, len(options))
prompt = tok.apply_chat_template(D.messages(evidence, criterion, options), tokenize=False,
add_generation_prompt=True, enable_thinking=False)
out = llm.generate(prompt, SamplingParams(max_tokens=1, temperature=1.0, allowed_token_ids=ids, logprobs=len(ids)))
lp = out[0].outputs[0].logprobs[0]
logprobs = [lp[i].logprob for i in ids] # then softmax(logprobs / temperature)
Training
-
Supervised (V2). One LoRA (rank 32, alpha 64) on every linear layer, including the Gated DeltaNet projections. It was trained jointly on two losses:
- a readout loss: cross-entropy of the option-letter softmax against the target distribution;
- a chain loss: next-token loss on reasoning chains.
The data was 41,994 readout questions (Mercity/decision-model-data, configs
readoutandchains): 18,000 generated procedural decisions (tasksource/procedural-typed-decisions) and 23,994 converted from 717 tasksource datasets. Half were shown in shuffled option order. It also used 10,974 filtered chains: the model's own shortest correct chains, plus chains from Qwen3.5-35B-A3B for 662 hard questions. Learning rate 2e-4 (from a 3-rate sweep), 1,309 steps, 47.8M tokens, 2 h 46 min on one A100 80GB. -
GRPO on thinking mode. Supervised chain training had made 5.1% of chains loop. RL fixed that (questions: config
rlof the dataset):- 60 steps on 240 questions (63% never seen in training), 8 chains per question, chains capped at 8,192 tokens;
- reward +1 right / -1 wrong, -1.5 for no answer, and a length penalty past 4,096 tokens;
- DAPO-style token-level loss with no KL term;
- learning rate 1e-5 for steps 1-40, then 2.5e-5 for steps 41-60.
Loops fell to 0.2%, thinking accuracy recovered by 1.9 points, and thinking tokens roughly halved.
-
Calibration. Per-type temperatures fitted on 515 held-out questions, never on evaluation data (
calibration.json).
Limitations
- Built for one prompt format. It is not a chat model. Use
decision.pyor reproduce its format exactly. - Out-of-distribution gains are smaller. On LocalLLaMA (real-world agent traces with panel votes) it gains 3 points over the base model, against 43 on procedural tasks.
- Yes bias on yes/no questions. It answers yes on 62% of our yes/no questions, where the gold rate is 50%.
- Overconfident after thinking. Probabilities read after a chain are overconfident. Thinking raises accuracy but can lower Brier-type scores (Jevals HelpSteer2: 2.4 fast vs -20.1 thinking).
- Limited validation. Results are from single training runs, and the RL stage was short (60 steps). We scored S1MB and Jevals with our own reimplementations of their published scoring rules, checked against their published numbers.
More
- Write-up: How to Train Your Own Decision Model With Minimal Changes to an LLM
- Training and evaluation data: Mercity/decision-model-data
- Code, data, logs, every checkpoint and the full 23-page technical report (
report/decision_model_report.pdf): Mercity/Desicion-Model-Custom (Hugging Face bucket) - This model is
run2_v2/checkpoints/rl60_mergedin that bucket.