link921 commited on
Commit
4dee0fc
·
verified ·
1 Parent(s): 257d034

Add complete v0.1 Research Preview model card

Browse files

Document MiniCPM5-2B-Base fine-tuning, architecture, evaluation, calibration, intended use, limitations, attribution, and inference.

Files changed (1) hide show
  1. README.md +239 -0
README.md CHANGED
@@ -1,3 +1,242 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ base_model:
4
+ - openbmb/MiniCPM5-2B-Base
5
+ datasets:
6
+ - SargeDev/jev-distill-corpus-v3
7
+ pipeline_tag: text-classification
8
+ tags:
9
+ - minicpm
10
+ - minicpm5
11
+ - system-one
12
+ - decision-model
13
+ - jev-style
14
+ - probability
15
+ - calibration
16
+ - agent
17
+ - routing
18
+ - text-classification
19
  ---
20
+
21
+ # CPM-jev
22
+
23
+ **Version:** `v0.1-research-preview`
24
+
25
+ > An experimental Jev-style / System-One decision model based on MiniCPM5-2B-Base. This is an independent community project and is not affiliated with or endorsed by TypeSafe AI or OpenBMB.
26
+
27
+ CPM-jev is an independently developed **LoRA fine-tune of `openbmb/MiniCPM5-2B-Base`**, with an added decision head for scoring candidate actions. It is a research preview, **not a chat model**, **not production-ready**, and should not use `generate()` as its primary decision interface.
28
+
29
+ ## Model Description
30
+
31
+ Given a state, a question, and candidate options, CPM-jev assigns one scalar score to each option and normalizes those scores into a probability distribution:
32
+
33
+ ```text
34
+ state + question + candidate options
35
+ -> decision scorer
36
+ -> probability distribution
37
+ ```
38
+
39
+ The probabilities are useful for ranking, routing, selective prediction, and confidence-aware escalation. They must not be interpreted as universally calibrated real-world probabilities.
40
+
41
+ Base model weights are not duplicated in this repository. Download `openbmb/MiniCPM5-2B-Base` separately.
42
+
43
+ ## Architecture
44
+
45
+ - Backbone: [`openbmb/MiniCPM5-2B-Base`](https://huggingface.co/openbmb/MiniCPM5-2B-Base)
46
+ - Adaptation: LoRA, rank 16, alpha 32, dropout 0.05
47
+ - LoRA targets: `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`
48
+ - Decision head: FP32 linear scalar head over the last non-padding token
49
+ - Candidate normalization: raw softmax across the options for one question
50
+ - Maximum sequence length: 512 tokens, left truncation
51
+
52
+ Each candidate is encoded independently with the same prompt template. The scalar scores are only comparable among the options supplied in the same call.
53
+
54
+ ## Training Data
55
+
56
+ CPM-jev was trained on the `train` split of [`SargeDev/jev-distill-corpus-v3`](https://huggingface.co/datasets/SargeDev/jev-distill-corpus-v3), using exactly **655,806 samples**. Probability targets in that dataset include data distilled from a Jev teacher.
57
+
58
+ No samples from `validation`, `calibration`, `test`, `test_set_30k`, or `ood` were used for training. Those splits were reserved for model selection, calibration analysis, final evaluation, and OOD evaluation as appropriate.
59
+
60
+ ## Training Procedure
61
+
62
+ - Objective: soft-target cross-entropy over candidate distributions
63
+ - Epochs: 1
64
+ - Optimizer steps: 40,988
65
+ - Effective batch size: 16 (micro-batch 4, gradient accumulation 4)
66
+ - Learning rate: `1e-4`
67
+ - Weight decay: `0.01`
68
+ - Warmup ratio: `0.03`
69
+ - Seed: 42
70
+ - Maximum length: 512
71
+ - Trainable parameters: 25,118,721 (about 1.10% of total)
72
+
73
+ The final weights are the completed Stage 3 run. No evaluation split was mixed into training.
74
+
75
+ ## Evaluation
76
+
77
+ The primary final benchmark is `jev-distill-corpus-v3/test_set_30k`, containing **29,955 samples**. Reported values use raw probabilities.
78
+
79
+ | Metric | Result |
80
+ | --- | ---: |
81
+ | Accuracy | 0.878317 |
82
+ | NLL | 0.727553 |
83
+ | Brier score | 0.011975 |
84
+ | ECE | 0.212610 |
85
+ | Signed ECE | -0.212610 |
86
+ | Correct mean confidence | 0.692363 |
87
+ | Incorrect mean confidence | 0.473300 |
88
+
89
+ Compared with the Stage 2 100k rebaseline on the same benchmark:
90
+
91
+ | Metric | Absolute change |
92
+ | --- | ---: |
93
+ | Accuracy | +4.934 percentage points |
94
+ | NLL | -0.034981 |
95
+ | Brier score | -0.018019 |
96
+ | ECE | +0.034864 |
97
+
98
+ Accuracy improved, but calibration error worsened. This trade-off is important when deciding whether to abstain or escalate.
99
+
100
+ ## Selective Accuracy
101
+
102
+ | Threshold | Coverage | Accuracy | Risk |
103
+ | --------- | -------- | -------- | ----- |
104
+ | >=0.70 | 41.92% | 99.68% | 0.32% |
105
+ | >=0.80 | 27.98% | 99.80% | 0.20% |
106
+ | >=0.90 | 16.03% | 99.90% | 0.10% |
107
+
108
+ These figures come from `jev-distill-corpus-v3/test_set_30k`. They do **not** imply the same accuracy on arbitrary real-world tasks, distributions, prompts, option sets, or deployment environments.
109
+
110
+ ## Calibration
111
+
112
+ Temperature scaling fitted on the calibration split produced `T = 1.008740`. It did not improve overall ECE consistently across `validation`, `calibration`, `test`, and `test_set_30k`, so the release defaults to **raw probabilities** (`use_temperature: false`).
113
+
114
+ The negative signed ECE on the primary in-domain benchmark indicates that the model is substantially under-confident there. High ECE remains a central limitation.
115
+
116
+ ## OOD Evaluation
117
+
118
+ On the held-out `ood` split (13,058 samples), raw probabilities produced:
119
+
120
+ | Metric | Result |
121
+ | --- | ---: |
122
+ | Accuracy | 0.878542 |
123
+ | NLL | 0.881370 |
124
+ | Brier score | 0.196659 |
125
+ | ECE | 0.093474 |
126
+ | Signed ECE | +0.093387 |
127
+
128
+ The positive signed ECE and much larger Brier score show a different, over-confident OOD failure mode. OOD calibration is materially weaker than the in-domain selective-accuracy table suggests.
129
+
130
+ ## Intended Use
131
+
132
+ Research and prototyping uses include:
133
+
134
+ - agent tool routing
135
+ - model routing
136
+ - retry and recovery decisions
137
+ - next-action selection
138
+ - result judging
139
+ - confidence-aware escalation
140
+ - System-1 / System-2 routing
141
+
142
+ The model is intended to compare explicitly supplied options. Applications should define abstention and human-escalation policies and validate them on their own workload.
143
+
144
+ ## Limitations
145
+
146
+ 1. The model is clearly under-confident on the reported in-domain evaluation.
147
+ 2. ECE remains high.
148
+ 3. OOD calibration is materially weaker than in-domain calibration and exhibits over-confidence.
149
+ 4. OOD metrics are accuracy 0.878542, NLL 0.881370, Brier 0.196659, ECE 0.093474, and signed ECE +0.093387.
150
+ 5. The model must not be described as fully calibrated.
151
+ 6. Current evidence supports selective decision and routing use more strongly than treating its probability as an absolute real-world probability.
152
+ 7. Do not directly use its probabilities for automated medical, financial, legal, safety-critical, or other high-risk decisions.
153
+ 8. Results are specific to the released corpus and evaluation procedure; independent external evaluation is still needed.
154
+ 9. The model is not a chat model and `generate()` is not its decision interface.
155
+
156
+ ## Installation
157
+
158
+ ```bash
159
+ git clone https://huggingface.co/link921/CPM-jev
160
+ cd CPM-jev
161
+ python -m venv .venv
162
+ # Windows: .venv\Scripts\activate
163
+ # Linux/macOS: source .venv/bin/activate
164
+ pip install -r requirements.txt
165
+ ```
166
+
167
+ The first load downloads the base model unless it is already cached. You can pass a local base-model directory with `base_model=...` or `--base-model ...`.
168
+
169
+ ## Inference Example
170
+
171
+ ```python
172
+ from inference import DecisionModel
173
+
174
+ model = DecisionModel(".")
175
+ result = model.decide(
176
+ state="The previous tool call failed twice.",
177
+ question="What should the agent do next?",
178
+ options=[
179
+ "retry",
180
+ "switch_tool",
181
+ "ask_user",
182
+ ],
183
+ )
184
+
185
+ print(result)
186
+ ```
187
+
188
+ Output schema (illustrative values):
189
+
190
+ ```json
191
+ {
192
+ "options": [
193
+ "retry",
194
+ "switch_tool",
195
+ "ask_user"
196
+ ],
197
+ "probabilities": [
198
+ 0.08,
199
+ 0.84,
200
+ 0.08
201
+ ],
202
+ "choice": "switch_tool",
203
+ "confidence": 0.84
204
+ }
205
+ ```
206
+
207
+ Run the included example:
208
+
209
+ ```bash
210
+ python example.py
211
+ ```
212
+
213
+ Or use the CLI:
214
+
215
+ ```bash
216
+ python inference.py --model-dir . --state "The previous tool call failed twice." --question "What should the agent do next?" --options retry switch_tool ask_user
217
+ ```
218
+
219
+ Do not call `generate()` to obtain the primary decision. CPM-jev compares candidate scores and applies softmax across the supplied options.
220
+
221
+ ## Citation
222
+
223
+ If this research preview is useful, cite the repository and the upstream model and dataset:
224
+
225
+ ```bibtex
226
+ @software{cpm_jev_2026,
227
+ title = {CPM-jev: A MiniCPM5-2B Jev-style Decision Model},
228
+ year = {2026},
229
+ version = {v0.1-research-preview},
230
+ url = {https://huggingface.co/link921/CPM-jev}
231
+ }
232
+ ```
233
+
234
+ ## License
235
+
236
+ This repository is released under the Apache License 2.0. The upstream base model and dataset are currently marked Apache-2.0 on Hugging Face. Users remain responsible for reviewing upstream licenses, dataset content, and applicable laws for their intended use.
237
+
238
+ ## Acknowledgements
239
+
240
+ - Thanks to [OpenBMB](https://huggingface.co/openbmb) for [`MiniCPM5-2B-Base`](https://huggingface.co/openbmb/MiniCPM5-2B-Base).
241
+ - Thanks to [SargeDev](https://huggingface.co/SargeDev) for [`jev-distill-corpus-v3`](https://huggingface.co/datasets/SargeDev/jev-distill-corpus-v3).
242
+ - The corpus contains probability targets that include data distilled from a Jev teacher. This release is an independent community project and does not claim official status or endorsement from TypeSafe AI, OpenBMB, or the dataset authors.