Text Generation
PEFT
Safetensors
English
decision-model
classification
calibration
reasoning
routing
lora
minicpm
conversational

Decision Model 2B (MiniCPM5-2B LoRA)

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 20 ms on an A100). This repo is a LoRA adapter for openbmb/MiniCPM5-2B.

Use it as one model in two states:

  • adapter on for fast answers;
  • adapter off for thinking.

Fine-tuning damaged MiniCPM5-2B's step-by-step reasoning, so the untouched base model does the thinking. Switching the adapter off costs nothing.

Base model openbmb/MiniCPM5-2B (Llama architecture)
Adapter LoRA rank 32, alpha 64, on all attention and MLP projections (201 MB)
Training readout-only: 42K decision questions, no reasoning chains
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.

MiniCPM5-2B (untrained) This adapter (fast) + base (thinking)
Fast readout accuracy 50.2% 66.0%
Thinking-mode accuracy (adapter off) 79.4% 79.4%
Routed: 30% of questions to thinking 75.6% at 253 thinking tokens/question
Routed: 50% of questions to thinking 78.0% at 411 thinking tokens/question
S1MB Task Avg, fast readout (137 tasks) 18.1 37.3
  • Among published ~2B models on S1MB, only two score higher on Task Avg: KnowLine-2B-Gen1 (44.8) and unee-2b (44.4).
  • With the adapter left on for thinking, thinking accuracy drops to 70.8%. Training on the 4B's reasoning chains instead drops it to 71.7%.
  • On Jevals (suite 0.1.0, Decision Score), the fast readout scores 44.6 on PubMedQA, 53.9 on Banking77 and -0.4 on HelpSteer2.

How it works

  • Fast readout (adapter on). 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 (in calibration.json) and passed through a softmax. Nothing is generated.
  • Thinking mode (adapter off). The same prompt with thinking on. Base MiniCPM5-2B writes a chain inside <think>...</think>, and its answer is the letter after the chain.
  • 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.

Usage

Requires transformers, peft, torch and accelerate. 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 peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "Mercity/decision-model-minicpm5-2b-lora"
tok = AutoTokenizer.from_pretrained(repo)
base = AutoModelForCausalLM.from_pretrained("openbmb/MiniCPM5-2B", dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, repo).eval()
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 (adapter on): 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 with the adapter, thinking without it):

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])
    fast = max(range(len(probs)), key=probs.__getitem__)
    if D.margin(probs) >= cutoff:
        return {"answer": fast, "probs": probs, "mode": "fast"}
    with model.disable_adapter():                               # thinking runs on the untouched base model
        rec = D.think(model, tok, evidence, criterion, options, max_new_tokens=8192,
                      temperature=1.0, top_p=0.95, top_k=0)     # MiniCPM5-2B's sampling settings
    if rec["answer"] is None:                                   # chain did not finish: keep the fast answer
        return {"answer": fast, "probs": probs, "mode": "fast"}
    return {"answer": rec["answer"], "probs": probs, "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.
  • In thinking mode, the returned probs are still the fast readout's. Base MiniCPM5-2B's readout after a chain was not calibrated.

Our numbers come from vLLM serving a merged copy of this adapter (run3_2b/checkpoints/v2b_ro_merged in the bucket linked below) for the fast readout, and the base model for thinking.

Training

  • Base model choice. MiniCPM5-2B was picked over Qwen3.5-2B by a rule fixed before the probe. The rule combined fast-readout accuracy and first-chain accuracy.
  • Readout-only training. Cross-entropy of the option-letter softmax against the target distribution, on 41,994 questions (Mercity/decision-model-data, config readout):
  • Run. Learning rate 2e-4, 549 steps, 20.8M tokens, 41 minutes on one A100 80GB. Held-out dev accuracy 76.0%.
  • 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.py or reproduce its format exactly.
  • Thinking only with the adapter off. Do not use thinking mode with the adapter on.
  • Behind the 4B model. It is 4-6 points less accurate at the same routing share, and out-of-distribution gains are smaller than in-distribution ones.
  • Limited validation. Results are from a single training run. We scored S1MB and Jevals with our own reimplementations of their published scoring rules, checked against their published numbers.

More

Downloads last month
28
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Mercity/decision-model-minicpm5-2b-lora

Adapter
(45)
this model

Datasets used to train Mercity/decision-model-minicpm5-2b-lora