Qwen3.5-Medical-Decision
A decision model for Chinese medical multiple-choice items, built by turning a 4B chat model into something that scores options instead of writing text.
Given a state (the question stem) and a typed question (choice / noul), it runs one
forward pass, reads a marker position for every option, and returns a calibrated
probability for each option. It never generates a token of prose, so it cannot hallucinate
an explanation — and it costs the same whichever option set you hand it.
Trained on FreedomIntelligence/CMB (CMB-Exam). Research artifact, not a medical device.
Headline numbers
| Setting | Metric | Result |
|---|---|---|
| Held-out CMB rows (190 single-choice items) | accuracy | 73.2% (chance 20%) |
| Cross-corpus CMExam (400 items, never trained on) | accuracy | 84.5% |
| Option-permutation test (same items, options shuffled, scored by content) | Δ accuracy | −3.7 pp (holdout) / −4.0 pp (CMExam) |
| Randomly initialised head, same data | accuracy | 45.75% (≈ the 46.0% chance level of the mixed task) |
The permutation result matters: shuffling the option texts barely hurts, so the model is reading option content, not memorising "the answer is D".
How it works
state + questions ──▶ tokenizer ──▶ Qwen3.5-4B (frozen 4-bit) + LoRA r=16
│
▼
Clef joint-schema head
(scores every option's marker)
│
▼
softmax(logits / T) → P(option) for each question
- Backbone:
unsloth/Qwen3.5-4B, 4-bit quantised; LoRA r=16, α=16, dropout 0 (64.5M trainable / 3.07B, 2.10%). - Head: Cloudflare-Clef-style joint schema head, trained from scratch; it reads hidden states at each option's marker position and emits one logit per option.
- Calibration: a single temperature
Tis fitted on held-out rows and folded into the head weights at save time, so no side-car calibration file is needed.
Because the option set lives in the prompt rather than in a fixed classifier head, the number and the wording of options can change at inference time without retraining.
Training data
FreedomIntelligence/CMB, config CMB-Exam (Apache-2.0). Cleaned to:
| rows | decisions | |
|---|---|---|
| full train | 227,586 | 542,562 |
| this checkpoint | 10,000 (shuffled subset) | ≈24,000 |
Three decision types were built from the official answer key — no LLM labelling anywhere:
| question | type | gold |
|---|---|---|
answer |
choice, 4–6 options per row, options differ every row |
official letter |
question_type |
choice (single / multiple / other) |
normalised from the item metadata |
opt_A…opt_F |
noul, one per option, multi-answer items only |
option ∈ answer set |
Gold labels are one-hot (no soft labels): there is a single official answer per item.
Training recipe
| steps | 300 (≈1 epoch over the 10k subset) |
| batch | 8 × grad-accum 4 = 32 |
| lr | 2e-4, cosine, warmup 10 |
| seq len | 2048 |
| hardware | 1× Tesla T4 (float32 path — Qwen3.5 has no bf16 on T4), ≈3 h |
| loss | label-smoothed cross-entropy over options; ordinal_weight unused (no ordered labels here) |
Training loss fell 0.46 → 0.35 and validation loss 0.41 → 0.35, plateauing after ≈200 steps. The model is saturated on this corpus: 100 steps and 300 steps give the identical 139/190 on the held-out rows.
Usage
from unsloth import FastDecisionModel
model, tokenizer = FastDecisionModel.from_pretrained(
"lastmass/Qwen3.5-Medical-Decision",
max_seq_length = 2048, # matches training; 512 also works, the prompts are ~150 tokens
load_in_4bit = True,
)
FastDecisionModel.for_inference(model)
QT = {"single": "单项选择题(只有一个选项正确)",
"multiple": "多项选择题(有多个选项正确)",
"other": "其他题型"}
def ask_single(state, options):
"""Single-answer item: exactly the two questions seen in training."""
qs = {
"answer": {"type": "choice", "instructions": "选出唯一正确的选项。", "criteria": options},
"question_type": {"type": "choice", "instructions": "该题属于哪种题型?", "criteria": QT},
}
ans = FastDecisionModel.predict(model, tokenizer, state, qs)
a = ans["answer"]
print("题干:", state)
for k, v in options.items():
print(" %s. %s" % (k, v))
print(" → 答案 %s (p=%.3f) | 题型 %s (p=%.3f)"
% (a["answer"], a["probabilities"][a["answer"]],
ans["question_type"]["answer"],
ans["question_type"]["probabilities"][ans["question_type"]["answer"]]))
print(" 全部概率:", {k: round(v, 3) for k, v in a["probabilities"].items()}, "\n")
def ask_multi(state, options):
"""Multi-answer item: one noul per option, as in training."""
qs = {"question_type": {"type": "choice", "instructions": "该题属于哪种题型?", "criteria": QT}}
for k, v in options.items():
qs["opt_" + k] = {"type": "noul",
"instructions": "选项 %s:%s —— 它是否为正确答案之一?" % (k, v)}
ans = FastDecisionModel.predict(model, tokenizer, state, qs)
print("题干:", state)
chosen = []
for k, v in options.items():
p = ans["opt_" + k]["probabilities"]["true"]
if p > 0.5:
chosen.append(k)
print(" %s. %-28s p(true)=%.3f %s" % (k, v, p, "✓" if p > 0.5 else ""))
print(" → 判为正确: %s | 题型 %s\n" % ("".join(chosen) or "(无)", ans["question_type"]["answer"]))
ask_single(
"患者,男,58岁。突发胸骨后压榨性疼痛3小时,向左肩放射,伴大汗、恶心。"
"心电图示 V1–V4 导联 ST 段抬高。最可能的诊断是",
{"A": "急性心包炎", "B": "急性心肌梗死", "C": "不稳定型心绞痛",
"D": "主动脉夹层", "E": "肺栓塞"},
)
ask_single(
"下列药物中最容易引起干咳不良反应的是",
{"A": "卡托普利", "B": "硝苯地平", "C": "美托洛尔",
"D": "氢氯噻嗪", "E": "阿司匹林"},
)
ask_multi(
"关于急性心肌梗死的治疗,下列正确的有",
{"A": "尽早行再灌注治疗", "B": "所有患者常规使用糖皮质激素",
"C": "双联抗血小板治疗", "D": "无禁忌证时使用β受体阻滞剂",
"E": "常规静脉补钾至血钾 6.0 mmol/L"},
)
Output on this checkpoint:
题干: 患者,男,58岁。突发胸骨后压榨性疼痛3小时…
→ 答案 B (p=0.997) | 题型 single (p=1.000)
全部概率: {'A': 0.001, 'B': 0.997, 'C': 0.002, 'D': 0.001, 'E': 0.0}
题干: 下列药物中最容易引起干咳不良反应的是
→ 答案 A (p=0.991) | 题型 single (p=1.000)
全部概率: {'A': 0.991, 'B': 0.001, 'C': 0.001, 'D': 0.001, 'E': 0.007}
题干: 关于急性心肌梗死的治疗,下列正确的有
A. 尽早行再灌注治疗 p(true)=0.998 ✓
B. 所有患者常规使用糖皮质激素 p(true)=0.006
C. 双联抗血小板治疗 p(true)=0.981 ✓
D. 无禁忌证时使用β受体阻滞剂 p(true)=0.996 ✓
E. 常规静脉补钾至血钾 6.0 p(true)=0.243
→ 判为正确: ACD | 题型 multiple
Schema must match training verbatim
The head was trained with the exact instruction strings above, in this order
(answer → question_type → opt_*). Paraphrasing an instruction, translating it, or
attaching opt_* questions to a single-answer item puts the input off-distribution and
will quietly degrade the probabilities. Single-answer items carry two questions;
multi-answer items carry question_type plus one noul per option.
Intended use
- Research on decision models: one backbone serving many heterogeneous, typed questions in a single forward pass, with option sets that change per row.
- A drop-in scoring baseline for Chinese medical MCQ pipelines where you want calibrated per-option probabilities rather than generated letters.
- Distillation/annotation experiments where you need
P(option)from a small local model.
Out-of-scope / limitations
- Not for clinical use. No regulatory clearance, no prospective validation, no patient-level safety data. Do not use it to triage, diagnose, or route real patients.
- Knowledge ceiling, not schema ceiling. In a manual review of 10 of the 51 held-out errors, 5 were straightforward textbook gaps (radiosensitivity of dysgerminoma, storiform pattern → fibrous histiocytoma, first-line imaging for adrenal lesions, …), 4 were ambiguous items, and 1 had a wrong answer key. The decision head and data format held up; the 4B backbone is what limits accuracy.
- Possible pretraining overlap. Both CMB and the cross-corpus CMExam set are Chinese medical licensing-exam material and are likely present in Qwen3.5's pretraining. The permutation test rules out letter/position shortcuts and the no-regression on CMExam rules out per-question memorisation of CMB, but neither rules out exam-level familiarity.
- Label noise. The answer keys are not perfect (≈10% in the reviewed sample). 73.2% is therefore a lower bound on what the pipeline can express, not a ceiling on ability.
- Metadata question.
question_typeis derivable from stem wording ("下列哪些") and hits 100%; it exists to keep the model in a multi-schema regime. Do not read it as capability. - Multi-answer subset is small (10.3% of rows) and 71% of its per-option labels are
true, so use TPR/TNR or exact-set match — not accuracy — when evaluating it. - Trained on a 10,000-row subset (4.4% of the cleaned data); a full-data run was not done because held-out accuracy saturated at 100 steps.
Files
| file | contents |
|---|---|
adapter_model.safetensors, adapter_config.json |
LoRA adapters (r=16) |
joint_head.safetensors, joint_head_config.json |
decision head (temperature folded in) |
unsloth_decision_config.json |
base model, max length, calibration record |
| tokenizer files | Qwen3.5 tokenizer |
Load with FastDecisionModel.from_pretrained(...) from Unsloth (it restores the adapter, the
head and the calibration together). A plain AutoModelForCausalLM will not reproduce
these probabilities — the decision head is a separate module.
Data & licensing
- Base model:
unsloth/Qwen3.5-4B— see its license. - Training data:
FreedomIntelligence/CMB(CMB-Exam, Apache-2.0). Items were filtered (duplicates removed, answers not present in the option list dropped) and labels were taken from the official answer key; no synthetic labels were added. - Adapters: Apache-2.0.
Citation
If you use this checkpoint, please cite the underlying dataset and toolkit:
@misc{cmb2024,
title = {CMB: A Comprehensive Medical Benchmark in Chinese},
author = {FreedomIntelligence},
year = {2024},
url = {https://huggingface.co/datasets/FreedomIntelligence/CMB}
}
@misc{unsloth,
title = {Unsloth: 2x faster LLM finetuning},
author = {Unsloth AI},
url = {https://github.com/unslothai/unsloth}
}