niqun123123 commited on
Commit
11ac032
·
verified ·
1 Parent(s): 8eca78d

Full sync: LemonDecider 4B v3.2 (submit/LemonDecider-4B-v3.2)

Browse files
.gitattributes CHANGED
@@ -1,2 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.safetensors filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
  *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
61
  tokenizer.json filter=lfs diff=lfs merge=lfs -text
QUICKSTART.md DELETED
@@ -1,106 +0,0 @@
1
- # LemonDecider 4B
2
-
3
- **Model ID:** `lemondecider-4b-20261112-v3.1`
4
-
5
- 本目录是完整的本地推理包:复制整个目录即可使用,不需要额外下载基座、adapter 或实验代码。
6
- 只接受文本/JSON 状态,输出 choice、noul、score 三类决策;不生成聊天文本,不支持图片或视频。
7
-
8
- ## 1. 环境
9
-
10
- - 推荐 Python 3.12(已验证);安装与硬件匹配的 PyTorch 和 torchvision(已测 PyTorch 2.9 / torchvision 0.24)。
11
- - 建议至少 16 GB 显存;权重约 8.5 GiB,长输入还需要额外运行内存。CPU 可用但较慢。
12
- - PPU/其他厂商环境须保留厂商 PyTorch,**不要用通用 CUDA wheel 覆盖**。
13
- - 在已有 PyTorch 环境中安装其余依赖:
14
-
15
- ```bash
16
- # 在 lemondecider-4b-20261112-v3.1 目录内运行
17
- python -m pip install -r requirements.txt
18
- python verify.py
19
- ```
20
-
21
- 快速路径可选安装与硬件兼容的 flash-linear-attention;未安装时由 transformers 使用兼容实现。
22
- 依赖安装需要网络,但模型加载和推理仅访问本目录。
23
- 请保留随包 tokenizer,不要根据通用 tokenizer 警告自动替换正则或词表;这会改变输入编码。
24
-
25
- ## 2. 一条命令推理
26
-
27
- ```bash
28
- python model.py --device cuda:0 --input example.json
29
- # 自动选择设备:
30
- python model.py --input example.json
31
- # CPU:
32
- python model.py --device cpu --input example.json
33
- ```
34
-
35
- `example.json` 是可直接运行的中文示例,包含三种题型。任意工作目录也可调用:
36
-
37
- ```bash
38
- python /path/to/model-folder/model.py --device cuda:0 --input /path/to/request.json
39
- ```
40
-
41
- 输入格式:
42
-
43
- ```json
44
- {"state":"客户希望申请退款","questions":{"intent":{"type":"choice","instructions":"判断主要诉求","criteria":{"refund":"退款","delivery":"物流"}}}}
45
- ```
46
-
47
- - `state`:字符串、列表或 JSON 对象。
48
- - `questions`:以问题名为 key 的对象,一次最多 256 个问题;每个问题独立处理。
49
- - `choice`:`criteria` 是 1–255 个选项的对象;返回选项概率、`choice` 和 `confidence`。
50
- - `noul`:返回 `noul`,范围 0–1,表示肯定答案的概率;可选 `criteria={"false":"否的含义","true":"是的含义"}`。
51
- - `score`:`criteria` 是 2–255 个有序描述;返回 **从 0 开始的等级期望值**及分布,不保证为整数。
52
-
53
- 温度和输入渲染由运行配置自动应用,**不要再次除以温度或自行套聊天模板**。
54
- 输入上限 8192 tokens(包含模板);超限会明确报错,不会静默截断。
55
-
56
- ## 3. Python
57
-
58
- 在模型目录中,或将该目录加入 Python 模块搜索路径:
59
-
60
- ```python
61
- import json
62
- from model import DecisionModel
63
-
64
- engine = DecisionModel(device="cuda:0")
65
- request = {"state":"我想退款", "questions":{
66
- "intent":{"type":"choice","criteria":{"refund":"退款","other":"其他"}}
67
- }}
68
- print(json.dumps(engine.predict(request), ensure_ascii=False, indent=2))
69
- ```
70
-
71
- 每进程只初始化一次 `DecisionModel`,随后复用。HF `AutoModel` 仅提供底层前向;
72
- 普通用户应使用此入口,由它完成渲染、marker 位置与类型化答案转换。
73
-
74
- ## 4. HTTP 服务
75
-
76
- 默认只监听本机:
77
-
78
- ```bash
79
- python model.py --serve --device cuda:0 --port 8000
80
- curl -s http://127.0.0.1:8000/health
81
- curl -s http://127.0.0.1:8000/v1/systemone \
82
- -H 'Content-Type: application/json' --data-binary @example.json
83
- ```
84
-
85
- 需要跨机器访问时,先设置自己的 API key,再监听外部地址:
86
-
87
- ```bash
88
- # 在 shell 中设置 LEMONDECIDER_API_KEY;不要把真实密钥写入代码或提交到版本库。
89
- python model.py --serve --host 0.0.0.0 --port 8000 --device cuda:0
90
- curl -s http://127.0.0.1:8000/v1/systemone \
91
- -H "Authorization: Bearer ${LEMONDECIDER_API_KEY}" \
92
- -H 'Content-Type: application/json' --data-binary @example.json
93
- ```
94
-
95
- 设置 API key 后,`/health`、`/v1/models` 和 `/v1/systemone` 均需认证。
96
- 生产环境应置于 HTTPS 反向代理及访问控制之后。响应不会返回本地 checkpoint 路径。
97
- 错误码:401 未授权;413 请求过大;422 输入不合法、不支持或超过容量;500 推理失败。
98
-
99
- ## 5. 常见问题
100
-
101
- - 缺少 `qwen3_5`:按 requirements 安装对应 transformers 版本。
102
- - GPU 内存不足:单进程运行,缩短输入;不要通过截断来改变原始问题。
103
- - 输出不是聊天回复:这是决策模型,请使用上述三种题型。
104
- - 完整性检查失败:重新复制完整目录,勿混用其他版本的配置和代码。
105
-
106
- 许可证与版权归属见 `LICENSE`、`LICENSE.code`、`NOTICE`。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,294 +1,77 @@
1
  ---
2
- license: apache-2.0
3
- base_model: Qwen/Qwen3.5-4B
4
  library_name: transformers
5
- pipeline_tag: text-classification
6
- language:
7
- - en
8
- - zh
9
  tags:
10
- - lemondecider
11
- - decision-engine
12
- - typed-decision
13
- - classification
14
  ---
15
 
16
- # LemonDecider 4B
17
-
18
- **Model ID:** `lemondecider-4b-20261112-v3.1`
19
- **Base model:** `Qwen/Qwen3.5-4B`
20
-
21
- LemonDecider makes typed decisions from a text or structured-JSON state and named
22
- questions. It returns choice probabilities, yes/no probabilities (`noul`), or ordinal
23
- scores without generating an answer token stream. This release processes questions
24
- independently, retaining the complete state and options for each question. Inputs
25
- are never truncated.
26
-
27
- ## Model description
28
-
29
- | Property | Value |
30
- |---|---|
31
- | Architecture | Qwen3.5-4B hybrid backbone with a 255-option decision readout |
32
- | Loader | `modeling_lemondecider.LemonDeciderForDecisionClassification`, `trust_remote_code=True` |
33
- | Model type | `lemondecider_decision` |
34
- | Attention | Noncausal periodic full-attention layers; hybrid recurrent layers; SDPA |
35
- | Readout | Marker-position decision readout; one question per forward |
36
- | Temperature | **0.835655**, scalar calibrated and applied by the bundled runtime |
37
- | Capacity | **8,192 tokens per question**, including the rendered template; up to 255 options |
38
- | Serving strategy | Independent-question processing; configured short-input rereading within the input sequence |
39
- | Precision | BF16 weights; FP32 probability postprocessing |
40
- | Serialized tensors | 724 |
41
- | Modalities | Text and structured JSON only |
42
- | Runtime | Python 3.12; tested with a PyTorch 2.9.0 accelerator build and Transformers 5.17.0 |
43
-
44
- ## Training
45
-
46
- ### Stage 1: general decision learning
47
-
48
- The initial stage establishes broad typed-decision capabilities through supervised
49
- fine-tuning on approximately **1.20 million decision/QA examples**, covering `choice`,
50
- `noul`, and `score` tasks.
51
-
52
- **Data categories:**
53
-
54
- - Service and action decisions: intent routing, classification, and action selection;
55
- - Language judgment: sentiment, inference, factuality, and paraphrase-style checks;
56
- - Knowledge and reasoning: knowledge QA, commonsense, logic, and arithmetic;
57
- - Retrieval and selection: relevance judgments and candidate selection;
58
- - Preference and quality judgments: response quality and ordered comparisons;
59
- - Probability and ordinal judgments: yes/no probabilities and graded ratings.
60
-
61
- ### Model-aware incremental data construction
62
-
63
- The guiding idea is to build data around what the base model has **not yet mastered**,
64
- rather than blindly accumulating more examples:
65
-
66
- - **Incorrect answers become training candidates directly**, concentrating supervision
67
- on observed weaknesses.
68
- - **Correct answers are followed by one more question or reasoning step**, or an added
69
- condition, to create more challenging variants instead of repeatedly training on easy cases.
70
-
71
- Following this principle, **35,467 incremental decision examples** were assembled
72
- through selection, rewriting, and difficulty enhancement. The emphasis is on the
73
- learning value of each example, not dataset size alone.
74
-
75
- ### Stage 2: targeted decision refinement
76
-
77
- Stage 2 continues supervised fine-tuning of the existing decision model on the
78
- incremental corpus, focusing on difficult decisions and more demanding conditions
79
- while retaining the same three output types. The resulting updates are consolidated
80
- into full weights, with calibrated probability postprocessing. The released package
81
- is self-contained and does not require a separate adapter or base-model download.
82
-
83
- ## Package artifacts
84
-
85
- ### Weight files
86
 
87
- | File | Bytes | SHA-256 |
88
- |---|---:|---|
89
- | `model-00001-of-00002.safetensors` | 4,973,336,472 | `a88cb411fb417c49f2ed4444d17f93f9c7c1e8af5fcde81768c00022c8c87499` |
90
- | `model-00002-of-00002.safetensors` | 4,106,591,800 | `dd8090bb59e0b6bcca04b4966e249a69de5f697bfd4bb9f4ad99a92b2e34aef6` |
91
- | `tokenizer.json` | 19,989,492 | `6f32ce20dc35f57a7f9ad1eac03525bd7d30f9df8cea6507e958279cc3657706` |
92
- | `model.safetensors.index.json` | 68,427 | `cdc57ae81f5d72a44461bdbb9949139319294b25ce35734646fb0c7b074f52f8` |
93
 
94
- The package keeps the HF model/processor/tokenizer layout. The root `model.py` is the
95
- recommended Python, CLI, and HTTP entry point. `decision_runtime.py` implements input
96
- preparation and typed answers; `example.json` demonstrates all three question types.
97
- Run `python verify.py` to check the complete `SHA256SUMS` manifest.
98
 
99
- The distribution does not include training data, raw predictions, benchmark inputs,
100
- or internal experiment logs. Required copyright and license notices are retained.
101
 
102
- ## Evaluation results
103
 
104
- ### Decision Index, edition 0.3 — complete public scoreable suite
105
 
106
- The completed **2026-11-16** local development run covered **140,178 scoreable requests**
107
- across **43 benchmarks**. The suite contains 140,620 requests in total, of which 442
108
- are officially excluded from scoring. The recorded scorer reported `complete: true`,
109
- with **140,099 ok**, **79 unsupported**, and **0 errors**. Unsupported requests remain
110
- in index coverage.
111
 
112
- | Headline | Value |
113
- |---|---:|
114
- | **Decision Index (balanced skill)** | **63.78** |
115
- | Raw index | 72.09 |
116
- | Breadth skill | 62.87 |
117
- | Recorded request wall time: median / mean / p95 | 102.6 / 342.5 / 1121.6 ms |
118
 
119
- These are previously recorded local development results, not an official leaderboard
120
- acceptance or a fresh full evaluation of the BF16-fused publication package. Recorded
121
- latencies are from the in-process evaluation run, not an HTTP deployment benchmark
122
- or a single-GPU latency certification.
123
-
124
- #### Per-area scores
125
-
126
- Headline scores use a 0–100 scale. Area and benchmark values below use 0–1.
127
-
128
- | Area | Raw | Skill | Coverage | Benchmarks |
129
- |---|---:|---:|---:|---:|
130
- | Knowledge & Reasoning | 0.5797 | 0.4639 | 0.9992 | 11 |
131
- | Language Understanding | 0.7866 | 0.7004 | 1.0000 | 9 |
132
- | Retrieval & Classification | 0.7883 | 0.7314 | 0.9926 | 6 |
133
- | Tools & Automation | 0.7516 | 0.7299 | 0.9926 | 5 |
134
- | Arts & Human Taste | 0.7253 | 0.5701 | 0.9967 | 6 |
135
-
136
- #### Per-benchmark native scores (★ = included in the public index)
137
-
138
- The Score column uses each benchmark's native headline metric on supported cases;
139
- Skill and Coverage come from the index report. Chance correction, track aggregation,
140
- and coverage adjustment can make these columns differ. For iSarcasmEval, Score is
141
- the English track-A headline, not a combined score across subtasks.
142
-
143
- | # | Benchmark | Metric | Requests | Score | Skill | Cov. |
144
- |---:|---|---|---:|---:|---:|---:|
145
- | 1 | BFCL ★ | case exact accuracy | 1,694 | 0.9728 | 0.9633 | 1.0000 |
146
- | 2 | ToolRet ★ | nDCG@10 | 685 | 0.6678 | 0.5894 | 0.9650 |
147
- | 3 | API-Bank ★ | accuracy | 508 | 0.5158 | 0.5044 | 0.9961 |
148
- | 4 | BANKING77 ★ | macro-F1 | 3,080 | 0.9313 | 0.9304 | 1.0000 |
149
- | 5 | CLINC150+OOS ★ | macro-F1 | 5,500 | 0.9543 | 0.9540 | 1.0000 |
150
- | 6 | RouterBench | selected quality (quality objective) | 10,000 | 0.7995 | 0.5299 | 1.0000 |
151
- | 9 | Home appliance simulator ★ | case exact accuracy | 88 | 0.7500 | 0.7500 | 1.0000 |
152
- | 10 | SGD/SGD-X | macro-F1 | 2,500 | 0.5553 | 0.2601 | 1.0000 |
153
- | 11 | ContractNLI ★ | macro-F1 | 123 | 0.8618 | 0.8002 | 1.0000 |
154
- | 12 | ANLI ★ | macro-F1 | 3,200 | 0.7586 | 0.6384 | 1.0000 |
155
- | 20 | BPoMP ★ | accuracy | 5,000 | 0.9802 | 0.9600 | 1.0000 |
156
- | 21 | Humicroedit ★ | accuracy | 2,628 | 0.6130 | 0.2260 | 1.0000 |
157
- | 22 | POP909-CL ★ | accuracy | 2,000 | 0.7434 | 0.7181 | 0.9800 |
158
- | 23 | cfcolor ★ | accuracy | 5,000 | 0.7230 | 0.4535 | 1.0000 |
159
- | 24 | MMLU | accuracy | 14,033 | 0.8164 | 0.7552 | 1.0000 |
160
- | 25 | GPQA Diamond ★ | accuracy | 196 | 0.5153 | 0.3537 | 1.0000 |
161
- | 26 | ARC-Easy | accuracy | 2,376 | 0.9895 | 0.9860 | 1.0000 |
162
- | 27 | ARC-Challenge | accuracy | 1,172 | 0.9556 | 0.9408 | 1.0000 |
163
- | 28 | WinoGrande ★ | accuracy | 1,267 | 0.9092 | 0.8184 | 1.0000 |
164
- | 29 | HellaSwag ★ | accuracy | 10,042 | 0.9556 | 0.9408 | 1.0000 |
165
- | 30 | GSM8K ★ | accuracy | 2,638 | 0.6630 | 0.5963 | 1.0000 |
166
- | 31 | ChessBench ★ | accuracy | 5,000 | 0.2048 | 0.1339 | 1.0000 |
167
- | 32 | MuSR ★ | accuracy | 752 | 0.6436 | 0.4334 | 1.0000 |
168
- | 33 | SATA-Bench ★ | case exact accuracy | 1,650 | 0.3327 | 0.3238 | 1.0000 |
169
- | 34 | SimpleBench | accuracy | 10 | 0.2000 | 0.0400 | 1.0000 |
170
- | 36 | BRIGHT ★ | nDCG@10 | 220 | 0.4447 | 0.3512 | 0.9591 |
171
- | 37 | Amazon ESCI ★ | macro-F1 | 5,000 | 0.6131 | 0.5147 | 1.0000 |
172
- | 38 | ACOS ★ | per-review F1 | 1,565 | 0.4130 | 0.3942 | 1.0000 |
173
- | 39 | FinEntity ★ | macro-F1 | 979 | 0.9323 | 0.9004 | 1.0000 |
174
- | 40 | iSarcasmEval ★ | Sarcasm F1 (track A, English) | 4,600 | 0.6684 | 0.5734 | 1.0000 |
175
- | 41 | VAST ★ | macro-F1 | 3,006 | 0.8025 | 0.7038 | 1.0000 |
176
- | 42 | NLI4CT ★ | macro-F1 | 5,500 | 0.8221 | 0.6539 | 1.0000 |
177
- | 43 | CRUXEval ★ | accuracy | 570 | 0.6825 | 0.4962 | 1.0000 |
178
- | 44 | CLadder ★ | accuracy | 5,000 | 0.8076 | 0.6152 | 1.0000 |
179
- | 45 | HLE ★ | accuracy | 501 | 0.1549 | 0.0000 | 0.9920 |
180
- | 50 | Habermas Machine ★ | accuracy | 1,676 | 0.6187 | 0.4467 | 1.0000 |
181
- | 56 | PhishNChips phishing decisions ★ | accuracy | 2,000 | 0.9275 | 0.8550 | 1.0000 |
182
- | 57 | MMLU-Pro ★ | accuracy | 12,032 | 0.6541 | 0.6110 | 1.0000 |
183
- | 58 | BBH fixed-option tasks ★ | accuracy | 5,507 | 0.7863 | 0.6902 | 1.0000 |
184
- | 59 | RAGTruth response-level hallucination ★ | F1 on hallucinated class | 2,700 | 0.8373 | 0.6627 | 1.0000 |
185
- | 61 | HoVer claim verification ★ | accuracy | 4,000 | 0.8875 | 0.7750 | 1.0000 |
186
- | 62 | When2Call MCQ ★ | accuracy | 3,652 | 0.8806 | 0.8408 | 1.0000 |
187
- | 64 | New Yorker caption matching ★ | accuracy | 528 | 0.6932 | 0.6165 | 1.0000 |
188
-
189
- The publication runtime was separately checked on **91 requests / 444 questions**
190
- covering all 43 benchmark categories and all three output types. Outputs matched
191
- a reference implementation using the **same fused weights**. This validates runtime
192
- integration on that sample; it is not a substitute for a new complete benchmark run.
193
 
194
  ## Usage
195
 
196
- Install a hardware-compatible PyTorch/torchvision build in a Python 3.12 environment,
197
- then install the remaining dependencies. Do not overwrite an accelerator vendor's
198
- PyTorch build with a generic CUDA wheel. The tested runtime used PyTorch 2.9.0 and
199
- Transformers 5.17.0; other hardware/software combinations should be smoke-tested locally.
200
- Download the entire model directory before loading. Custom code executes during
201
- loading, so review the packaged Python files first.
202
 
203
  ```bash
204
  python -m pip install -r requirements.txt
205
- python verify.py
206
  ```
207
 
208
- ### Python: typed decisions
209
-
210
  ```python
211
- import json
212
- import sys
213
- from pathlib import Path
214
-
215
- checkpoint = Path("./LemonDecider").resolve()
216
- sys.path.insert(0, str(checkpoint))
217
  from model import DecisionModel
218
 
219
- model = DecisionModel(checkpoint, device="cuda:0")
220
- request = {
221
- "state": "The customer wants to return a damaged package.",
 
222
  "questions": {
223
- "action": {
224
  "type": "choice",
225
- "instructions": "Choose the next action.",
226
- "criteria": {
227
- "refund": "Offer a refund",
228
- "tracking": "Check tracking"
229
- }
 
 
 
230
  },
231
- "damaged": {
232
- "type": "noul",
233
- "instructions": "Is the package damaged?"
234
- }
235
- }
236
- }
237
- print(json.dumps(model.predict(request), indent=2))
238
  ```
239
 
240
- ### CLI and HTTP
241
-
242
- From the model directory:
243
 
244
  ```bash
245
- python model.py --device cuda:0 --input example.json
246
- # Alternatively, start the local HTTP service:
247
- python model.py --serve --device cuda:0 --port 8000
248
- # In another terminal, when API-key authentication is unset:
249
- curl -s http://127.0.0.1:8000/health
250
- curl -s http://127.0.0.1:8000/v1/systemone \
251
- -H 'Content-Type: application/json' --data-binary @example.json
252
  ```
253
 
254
- HTTP endpoints are `GET /health`, `GET /v1/models`, and `POST /v1/systemone`.
255
- The service binds to localhost by default. Set `LEMONDECIDER_API_KEY` to require
256
- bearer authentication on all endpoints; binding to a non-loopback address requires
257
- that key to be set. Use HTTPS and appropriate access controls in production.
258
- Health responses do not expose local checkpoint paths.
259
-
260
- Requests may contain multiple named questions. Each is processed independently;
261
- short inputs use the package's configured second reading within the input sequence.
262
- Oversized structured states may fall back to plain JSON without optional index
263
- annotations, but original content and options are not truncated. If a question still
264
- exceeds capacity, the request fails with HTTP 422. Do not apply another chat template
265
- or temperature transformation outside the supplied runtime.
266
-
267
- For installation details, input schemas and additional examples, see
268
- [QUICKSTART.md](QUICKSTART.md).
269
-
270
- ## Intended use & limitations
271
-
272
- - Designed for routing, classification, structured choices and ordinal judgments,
273
- not open-ended text generation.
274
- - A probability output is not a correctness or calibration guarantee.
275
- - `noul` is the probability of the affirmative answer. `score` is the expected
276
- zero-based ordinal level and need not be an integer.
277
- - Capacity is 8,192 tokens per rendered question, not the backbone's positional limit.
278
- - The serving API is text-only; serialized vision tensors do not imply image support.
279
- - The bundled renderer and postprocessing are part of the inference contract.
280
- - Local development results do not establish independent generalization, performance
281
- on private tests, or reliability on real deployment traffic.
282
- - The model is not a safety system. Validate it for the intended domain and population
283
- before deployment.
284
-
285
- ## License
286
-
287
- `LICENSE` contains the Apache-2.0 license and `LICENSE.code` contains the MIT license.
288
- Applicable upstream copyright, license and notice obligations remain in effect;
289
- see `NOTICE`. This release does not expand rights over training or evaluation data.
290
 
291
- ## Acknowledgements
292
 
293
- LemonDecider builds on the Qwen backbone and the open-source model/runtime ecosystem.
294
- Required attribution is preserved in the packaged license and notice files.
 
1
  ---
 
 
2
  library_name: transformers
3
+ base_model: Qwen/Qwen3.5-4B
 
 
 
4
  tags:
5
+ - decision-model
6
+ - typed-decisions
7
+ - multimodal
8
+ - safetensors
9
  ---
10
 
11
+ # LemonDecider 4B v3.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ LemonDecider 4B v3.2 is a typed decision model built on Qwen3.5-4B. It answers named questions over text or JSON and returns normalized probabilities instead of generated text.
 
 
 
 
 
14
 
15
+ - **Choice** selects an option and returns a probability for each candidate.
16
+ - **Noul** returns the probability that a yes/no proposition is true.
17
+ - **Score** rates the input against 2–10 ordered levels and returns the probability of each level plus the expected level.
 
18
 
19
+ ## Model lineage
 
20
 
21
+ The base-model lineage is [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B). This lineage is approved for release.
22
 
23
+ ## Public Decision Index 0.3
24
 
25
+ LemonDecider 4B v3.2 scored **64.25** on Text (140,178 requests) and **72.35** on Vision (12,210 requests) across the Decision Index 0.3 public suites. The Text result has a raw index of 72.64 and a breadth skill of 63.1.
 
 
 
 
26
 
27
+ | Panel | LemonDecider 4B v3.2 | Requests |
28
+ | :---: | ---: | ---: |
29
+ | Text | **64.25** | 140,178 |
30
+ | Vision | **72.35** | 12,210 |
 
 
31
 
32
+ The Vision evaluation used a 1,638,400-pixel cap per image. The bundled `model.py` entrypoint demonstrates the text and structured-JSON protocol.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ## Usage
35
 
36
+ Use Python 3.12 with the versions in `requirements.txt`.
 
 
 
 
 
37
 
38
  ```bash
39
  python -m pip install -r requirements.txt
40
+ python model.py --input example.json
41
  ```
42
 
 
 
43
  ```python
 
 
 
 
 
 
44
  from model import DecisionModel
45
 
46
+ model = DecisionModel(".", device="cuda:0")
47
+
48
+ result = model.predict({
49
+ "state": "The order arrived damaged. The customer wants a refund.",
50
  "questions": {
51
+ "intent": {
52
  "type": "choice",
53
+ "instructions": "What does the customer want?",
54
+ "criteria": {"refund": "A refund", "delivery": "Delivery status"},
55
+ },
56
+ "damaged": {"type": "noul", "instructions": "Does the customer mention damage?"},
57
+ "urgency": {
58
+ "type": "score",
59
+ "instructions": "How urgent is the request?",
60
+ "criteria": ["Low", "Medium", "High"],
61
  },
62
+ },
63
+ })
64
+ print(result["answers"])
 
 
 
 
65
  ```
66
 
67
+ To serve the same protocol over HTTP:
 
 
68
 
69
  ```bash
70
+ python model.py --serve --port 8000
 
 
 
 
 
 
71
  ```
72
 
73
+ Requests are sent to `POST /v1/systemone`; health is available at `GET /health`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ ## Decision Index compatibility
76
 
77
+ The model accepts the standard named-question request schema (`state` plus `questions`) with `choice`, `noul`, and `score` question types. Answers contain normalized probabilities and, for score questions, the expected level.
 
SHA256SUMS DELETED
@@ -1,21 +0,0 @@
1
- 50cbab8a892c5f2993b8c7351a99182507472def3b1374558308605d99b86b32 LICENSE
2
- bdb5d45a5736702104f43f47f0d7dd2fbdd52295e81d20951131b06a319c693b LICENSE.code
3
- 61a69898cc3f4e717a0ce90df5020f6c796cdddaad88ed748c8b1aa792a2452d NOTICE
4
- c66685e6cbea6a675f98c4fdddd31f734bb3bf9c9232a8f3c9311d4ac373b064 QUICKSTART.md
5
- 29312dcec8f6284b4470f8b60c8e00669ffee1322d7972ad83ad38db145442f8 README.md
6
- a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715 chat_template.jinja
7
- 867e26bfa9f8ad3861be0649ecfcdb7cd549d93eb808b29877132bb6a5bde139 config.json
8
- 40ca09361becd76cb3ebc8fb3218adb0eb583e33c0b0a327f49e52029b02de22 configuration_lemondecider.py
9
- 93e9ea1cfe764c5c0eddc39ccd6e841dd46768aba89d52393e9dfc6122faf30f decision_config.json
10
- 1c1c22278506169a9fbfb58afe41b53b22dbe624845ddda68a990996b1af8062 decision_runtime.py
11
- 0268abc8d3f9eb4758174480631e85e680683339e431c4097bac9ea0126c7eb9 example.json
12
- a88cb411fb417c49f2ed4444d17f93f9c7c1e8af5fcde81768c00022c8c87499 model-00001-of-00002.safetensors
13
- dd8090bb59e0b6bcca04b4966e249a69de5f697bfd4bb9f4ad99a92b2e34aef6 model-00002-of-00002.safetensors
14
- ecb8ffce8149a5d58cab50aaca54dfc3430c1166db88efcb9d3cff9b62569b03 model.py
15
- cdc57ae81f5d72a44461bdbb9949139319294b25ce35734646fb0c7b074f52f8 model.safetensors.index.json
16
- 5f8789931653efd387e105b15535f8374e4e708159c034d6c9894ae6a1011758 modeling_lemondecider.py
17
- abb488b9a03a53407dc9c8e43c0a2caec9142e5fc7a1203807fdf54b2149cc8f processor_config.json
18
- d38fbf18a71c79d679e1e469db5fe474403a56834c5ef7ba2e059bfcda539d82 requirements.txt
19
- 6f32ce20dc35f57a7f9ad1eac03525bd7d30f9df8cea6507e958279cc3657706 tokenizer.json
20
- 7488550a894dcf741616126e322ea31d66cf9457b59ec5825f4c7efdced421f8 tokenizer_config.json
21
- 009270d52185d96d7705419edefa3a0e97facea8b5c5f194af497f7beb490d7c verify.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
config.json CHANGED
@@ -637,7 +637,7 @@
637
  "tie_word_embeddings": true,
638
  "vision_end_token_id": 248054,
639
  "vision_start_token_id": 248053,
640
- "model_id": "lemondecider-4b-20261112-v3.1",
641
  "project_name": "LemonDecider",
642
  "temperature": 0.835655,
643
  "inference_protocol": {
 
637
  "tie_word_embeddings": true,
638
  "vision_end_token_id": 248054,
639
  "vision_start_token_id": 248053,
640
+ "model_id": "LemonDecider-4B-v3.2",
641
  "project_name": "LemonDecider",
642
  "temperature": 0.835655,
643
  "inference_protocol": {
configuration_lemondecider.py CHANGED
@@ -8,7 +8,7 @@ class LemonDeciderConfig(Qwen3_5Config):
8
 
9
  def __init__(self, codes=None, token_ids=None, max_options=255, temperature=0.835655,
10
  max_input_length=8192, attention_mode='noncausal_full_attention',
11
- pooling='last', model_id='lemondecider-4b-20261112-v3.1',
12
  inference_protocol=None, **kwargs):
13
  auto_map = kwargs.pop('auto_map', None)
14
  super().__init__(**kwargs)
 
8
 
9
  def __init__(self, codes=None, token_ids=None, max_options=255, temperature=0.835655,
10
  max_input_length=8192, attention_mode='noncausal_full_attention',
11
+ pooling='last', model_id='LemonDecider-4B-v3.2',
12
  inference_protocol=None, **kwargs):
13
  auto_map = kwargs.pop('auto_map', None)
14
  super().__init__(**kwargs)
decision_config.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "format": "lemondecider-text-v2",
3
- "model_id": "lemondecider-4b-20261112-v3.1",
4
  "modalities": [
5
  "text"
6
  ],
 
1
  {
2
  "format": "lemondecider-text-v2",
3
+ "model_id": "LemonDecider-4B-v3.2",
4
  "modalities": [
5
  "text"
6
  ],
model-00001-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a88cb411fb417c49f2ed4444d17f93f9c7c1e8af5fcde81768c00022c8c87499
3
  size 4973336472
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e39b1c393baec5594655aa2953a7dc2bbc55ca5c41c7e4fa5d53464d8533a2c1
3
  size 4973336472
model-00002-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dd8090bb59e0b6bcca04b4966e249a69de5f697bfd4bb9f4ad99a92b2e34aef6
3
  size 4106591800
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:801a3c3b5fa6f88123fe240dc886019c4befc90f1a2c760529049ac1d565e42f
3
  size 4106591800
model.safetensors.index.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "metadata": {
 
3
  "total_size": 9079836672
4
  },
5
  "weight_map": {
 
1
  {
2
  "metadata": {
3
+ "total_parameters": 4539918336,
4
  "total_size": 9079836672
5
  },
6
  "weight_map": {
verify.py DELETED
@@ -1,28 +0,0 @@
1
- """Verify release files using only the Python standard library."""
2
- from pathlib import Path
3
- import hashlib
4
-
5
-
6
- def main():
7
- root=Path(__file__).resolve().parent
8
- rows=(root/'SHA256SUMS').read_text().splitlines()
9
- seen=set()
10
- for line in rows:
11
- digest,name=line.split(' ',1)
12
- if not name or Path(name).name!=name or name in seen:
13
- raise ValueError('Invalid checksum manifest')
14
- seen.add(name)
15
- p=root/name
16
- if p.is_symlink() or not p.is_file():
17
- raise ValueError('Missing or linked release file: '+name)
18
- h=hashlib.sha256()
19
- with p.open('rb') as f:
20
- for b in iter(lambda:f.read(4<<20),b''):h.update(b)
21
- if h.hexdigest()!=digest:
22
- raise ValueError('Checksum mismatch: '+name)
23
- extras={p.name for p in root.iterdir() if p.is_file()}-seen-{'SHA256SUMS'}
24
- if extras:raise ValueError('Unlisted files: '+', '.join(sorted(extras)))
25
- print(f'OK: {len(seen)} release files verified')
26
-
27
-
28
- if __name__=='__main__': main()