helmo commited on
Commit
b411df4
·
verified ·
1 Parent(s): dc7e232

DecidaBERT-large: weights, config and model card

Browse files
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ DecidaBERT-large
2
+ Copyright 2026 Helder (heldernoid) and Decida contributors.
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This model is a fine-tune of tasksource/ModernBERT-large-nli (Apache-2.0, Damien Sileo), which is a fine-tune of ModernBERT-large
7
+ (Apache-2.0, Answer.AI and LightOn). It is trained on data that includes LocalLLaMA/typed-decisions (Apache-2.0) and the synthetic set
8
+ helmo/synthetic-typed-decisions (MIT, generated with deepseek-ai/DeepSeek-V4-Flash-0731). The input layout follows Laya (Apache-2.0, Nandakishor M, Convai Innovations).
README.md ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ base_model: tasksource/ModernBERT-large-nli
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - decision-model
9
+ - system-one
10
+ - typed-decisions
11
+ - modernbert
12
+ - calibrated-probabilities
13
+ datasets:
14
+ - LocalLLaMA/typed-decisions
15
+ - helmo/synthetic-typed-decisions
16
+ ---
17
+
18
+ # DecidaBERT-large
19
+
20
+ DecidaBERT-large reads a **state** and a set of typed **questions** and answers all of them in **one forward pass**, with no generated tokens. Every answer is a probability distribution, not a sentence. It is a 421M parameter ModernBERT encoder that runs on a laptop GPU in tens of milliseconds, and it is built to be served by [Decida](https://github.com/heldernoid/decida).
21
+
22
+ The three question types:
23
+
24
+ | type | you give | you get back |
25
+ |---|---|---|
26
+ | `choice` | 2 to 255 options, each with a description | a probability for every option |
27
+ | `score` | an ordered list of levels, lowest first | a probability for every level and the expected level |
28
+ | `noul` | a yes/no question about the state | the probability that the statement is true |
29
+
30
+ ## Quick start
31
+
32
+ ```bash
33
+ git clone https://github.com/heldernoid/decida && cd decida && uv sync
34
+ uv run decida serve --model decidabert=helmo/DecidaBERT-large --max-len 2048
35
+ ```
36
+
37
+ ```bash
38
+ curl -s localhost:8000/v1/systemone -H 'content-type: application/json' -d '{
39
+ "model": "decidabert",
40
+ "state": "Customer: I was billed twice for March and want my money back.",
41
+ "questions": {
42
+ "team": {"type": "choice", "instructions": "Which team should handle this?",
43
+ "criteria": {"billing": "Charges, invoices, refunds",
44
+ "technical": "Bugs and outages",
45
+ "sales": "Pricing, demos, new seats"}},
46
+ "urgent": {"type": "noul", "instructions": "Is this urgent?"}
47
+ }}'
48
+ ```
49
+
50
+ The response holds `answers.team.probabilities`, `answers.urgent.noul` and the latency. Many independent requests can be sent in one call to `POST /v1/systemone/batch`.
51
+
52
+ The weights use the same layout as [Laya](https://huggingface.co/convaiinnovations/laya): the instructions and all option descriptions are packed after the state, and one marker per option is read out. They do not load with plain `AutoModel`, because the scoring head is custom. Use Decida, or read the loader in the Decida repository (`src/decida/model/enc.py`).
53
+
54
+ ## Results
55
+
56
+ ### The typed-decisions test set
57
+
58
+ Held-out test split of [LocalLLaMA/typed-decisions](https://huggingface.co/datasets/LocalLLaMA/typed-decisions): 400 cases, 2,000 questions. A prediction is right when its top answer equals the gold label. Intervals are 95% Wilson intervals. This model was trained on the train split of the same benchmark, so this is **specialist mode**.
59
+
60
+ | question type | questions | DecidaBERT-large | 95% interval | random guess | Qwen3-0.6B, zero-shot |
61
+ |---|---|---|---|---|---|
62
+ | choice | 600 | **0.722** | 0.685 to 0.756 | 0.233 | 0.350 |
63
+ | score | 800 | **0.694** | 0.661 to 0.725 | 0.244 | 0.281 |
64
+ | yes/no (`noul`) | 600 | **0.830** | 0.798 to 0.858 | 0.500 | 0.550 |
65
+ | **all** | 2,000 | **0.743** | 0.723 to 0.762 | | 0.383 |
66
+
67
+ For `score` questions the model is within one level of the gold level 95.5% of the time.
68
+
69
+ **Calibration.** Expected calibration error (10 bins, on the top answer) is 0.130 overall: 0.128 for choice, 0.137 for score and 0.122 for yes/no. The model is **under-confident**: its mean confidence (0.59 on choice, 0.56 on score, 0.71 on yes/no) is below its accuracy. No temperature scaling is applied (`rl_agent_config.json` records temperature 1.0). Qwen3-0.6B, read zero-shot through option letters, is the opposite: mean confidence 0.92 on choice at 0.35 accuracy.
70
+
71
+ **How to read these numbers**
72
+
73
+ - The gold labels are the average of three samples from a teacher model, so they are noisy. An earlier check put the teacher's agreement with itself at about 0.735, which means scores near 0.75 are close to the ceiling the labels allow.
74
+ - We make **no claim that this model beats another one**. For context only: on the same file and with the same scoring we measured Laya's typed-decisions checkpoint at 0.766 overall (choice 0.733, score 0.723, yes/no 0.855), which is higher than this model. The dataset author published 0.727 accuracy for TypeSafe Jev 1.13.0 on this test set, in generalist mode and with an aggregation we cannot confirm, so it is not a like-for-like number.
75
+ - Reproduce with `eval_typed_decisions.py` in this repository. It needs a running Decida server and the test file.
76
+
77
+ ### In the Decida testbench
78
+
79
+ Single runs, meant as behaviour examples and not as benchmarks. All of them show the same thing: the model does well when the state describes the situation in words, and badly when it is given raw numbers.
80
+
81
+ | task | result |
82
+ |---|---|
83
+ | Candies sorter: sort each candy into one of five bowls, 256 questions per request | 96.5% of candies in the right bowl when each candy is described in words, 19.2% when given raw RGB numbers |
84
+ | Tetris: pick the landing spot for each piece, every spot described in a sentence (3 games of 40 pieces) | 13.3 lines per game; its top choice matched an exact oracle's 83% of the time, and the oracle's answer was in its top three 99% of the time |
85
+ | Flappy: bird height put into words, 30 seconds | 22 pillars passed with no crash; with the height given as numbers, 13 crashes |
86
+ | Wikispeedia: click through real articles to a goal page (20 pairs, at most 20 clicks) | reached the goal in 13 of 20, where random clicking reaches it in 1 of 100; a larger hosted model reached all 20, so world knowledge is the limit here |
87
+
88
+ Speed on an Apple-silicon GPU: about 25 ms per single-question request (median, one request at a time), and about 2 seconds for 50 three-question requests sent in one batch call.
89
+
90
+ ## Writing questions that work
91
+
92
+ These come from what the model did well and badly in the testbench:
93
+
94
+ 1. **Put the state in words, never in raw numbers.** "The bird is far below the gap" works; "y=212, gap=140" does not.
95
+ 2. **Ask what the text says, not what to do.** "Which team does this ticket belong to?" beats "What should we do?".
96
+ 3. **Describe every option.** The option text is what the model matches the state against. A bare label is much weaker than a short description.
97
+ 4. **Keep option lists short and only offer reachable options.** It works up to 255 options, but 5 to 15 well described options is where it is strongest.
98
+ 5. **Let your code do the measuring and choosing.** Ask a perception question ("how far is the bird from the gap?") and apply your own threshold, rather than asking the model to decide everything.
99
+ 6. **Watch the token budget.** The model was trained on sequences of up to 512 tokens and runs up to 2,048. If you use long option descriptions, serve with `--head-tokens 1400 --option-tokens 160` and check `x_decida.truncation` in the response to see whether anything was cut.
100
+
101
+ ## Model details
102
+
103
+ | | |
104
+ |---|---|
105
+ | Architecture | ModernBERT-large encoder (28 layers, hidden size 1024) with a per-option scoring head, 421M parameters, stored in float32 (1.7 GB) |
106
+ | Base model | [tasksource/ModernBERT-large-nli](https://huggingface.co/tasksource/ModernBERT-large-nli) (Apache-2.0), itself a fine-tune of ModernBERT-large |
107
+ | Context | trained at 512 tokens, supported up to 2,048 |
108
+ | Language | English. Rows in non-Latin scripts were removed from the synthetic training data, so other scripts are untested |
109
+ | Input | one state, up to 256 questions per request |
110
+
111
+ ## Training
112
+
113
+ - **Objective:** supervised fine-tuning for 1,500 steps on target distributions (one hard label per synthetic record, soft distributions for typed-decisions), with cross-entropy plus 0.5 times a Brier term to keep the distributions calibrated.
114
+ - **Data:** 11,079 records, expanded to 15,879 training examples by using every question of each case.
115
+ - 9,879 synthetic records (3,282 choice, 3,304 score, 3,293 yes/no, one question each), published under the MIT licence as [helmo/synthetic-typed-decisions](https://huggingface.co/datasets/helmo/synthetic-typed-decisions). They cover 207 topic domains and were written by [deepseek-ai/DeepSeek-V4-Flash-0731](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731) through OpenRouter. Each output was parsed with a strict schema and rejected if a label was invalid, and rows in non-Latin scripts were dropped. **The labels are written by that model, not by people.** An earlier, larger version of this set contained corrupted labels and was discarded before this model was trained.
116
+ - 1,200 training cases (five questions each) from LocalLLaMA/typed-decisions (Apache-2.0).
117
+ - **Held out:** the 400 test cases of LocalLLaMA/typed-decisions were never used for training, calibration or choosing a checkpoint.
118
+ - **Hosted decision models:** we did not call TypeSafe Jev, or use its outputs, to build the synthetic data or to train this model. The benchmark's gold labels come from its authors' teacher model, as described on the dataset card.
119
+
120
+ ## Limitations
121
+
122
+ - **Little world knowledge.** It matches the state against the options you give it. It does not know which Wikipedia page mentions another, or what a colour phrase like "tomato" looks like unless the options say so.
123
+ - **Labels are noisy and model-written**, both in the synthetic training data and in the benchmark's gold answers. Treat small differences between models on this benchmark with care.
124
+ - **Specialist, not generalist.** It was tuned on the typed-decisions distribution. Results on unrelated tasks can be much lower, especially with terse or unlabelled options.
125
+ - **Under-confident** on the benchmark. If you need probabilities to be calibrated on your own data, fit a temperature on a few hundred labelled examples of your own.
126
+ - **Not for high-stakes decisions on its own.** Use the probabilities, set a threshold that reflects the cost of being wrong, and send low-confidence cases to a person or a stronger model.
127
+
128
+ ## Files
129
+
130
+ | file | purpose |
131
+ |---|---|
132
+ | `model.safetensors` | the weights |
133
+ | `encoder/config.json` | the ModernBERT configuration |
134
+ | `tokenizer.json`, `tokenizer_config.json` | the tokenizer |
135
+ | `rl_agent_config.json` | calibration record (temperature 1.0, no scaling applied) |
136
+ | `eval_typed_decisions.py` | reproduces the results table |
137
+
138
+ ## License
139
+
140
+ Apache-2.0. The base model ([tasksource/ModernBERT-large-nli](https://huggingface.co/tasksource/ModernBERT-large-nli)), the benchmark and the source ModernBERT release are also Apache-2.0. See `LICENSE` and `NOTICE`.
141
+
142
+ ## Credits
143
+
144
+ Built on ModernBERT (Warner et al., Answer.AI and LightOn), the multi-task NLI fine-tune by tasksource (Sileo), and the typed-decisions benchmark by LocalLLaMA. The input layout follows Laya (Nandakishor M, Convai Innovations, Apache-2.0). Decida is not affiliated with TypeSafe AI, and the name Jev is used only to describe a published comparison.
encoder/config.json ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "ModernBertForSequenceClassification"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 50281,
8
+ "classifier_activation": "gelu",
9
+ "classifier_bias": false,
10
+ "classifier_dropout": 0.0,
11
+ "classifier_pooling": "mean",
12
+ "classifiers_size": [
13
+ 3,
14
+ 2,
15
+ 2,
16
+ 2,
17
+ 2,
18
+ 2,
19
+ 1,
20
+ 2,
21
+ 3,
22
+ 2,
23
+ 2,
24
+ 2,
25
+ 3,
26
+ 3,
27
+ 3,
28
+ 3,
29
+ 3,
30
+ 3,
31
+ 2,
32
+ 2,
33
+ 3,
34
+ 2,
35
+ 2,
36
+ 2,
37
+ 2,
38
+ 2,
39
+ 6,
40
+ 2,
41
+ 2,
42
+ 2,
43
+ 2,
44
+ 2,
45
+ 3,
46
+ 3,
47
+ 3,
48
+ 3,
49
+ 3,
50
+ 3,
51
+ 3,
52
+ 2,
53
+ 2,
54
+ 2,
55
+ 2,
56
+ 3,
57
+ 3,
58
+ 3,
59
+ 3,
60
+ 3,
61
+ 3,
62
+ 3,
63
+ 3,
64
+ 2,
65
+ 2,
66
+ 2,
67
+ 2,
68
+ 2,
69
+ 2,
70
+ 16,
71
+ 100,
72
+ 13,
73
+ 100,
74
+ 8,
75
+ 3,
76
+ 3,
77
+ 2,
78
+ 3,
79
+ 2,
80
+ 4,
81
+ 3,
82
+ 2,
83
+ 3,
84
+ 2,
85
+ 2,
86
+ 2,
87
+ 2,
88
+ 2,
89
+ 3,
90
+ 2,
91
+ 3,
92
+ 2,
93
+ 4,
94
+ 3,
95
+ 3,
96
+ 3,
97
+ 2,
98
+ 3,
99
+ 1,
100
+ 2,
101
+ 2,
102
+ 3,
103
+ 13,
104
+ 2,
105
+ 2,
106
+ 3,
107
+ 2,
108
+ 2,
109
+ 3,
110
+ 3,
111
+ 3,
112
+ 3,
113
+ 2,
114
+ 3,
115
+ 2,
116
+ 3,
117
+ 2,
118
+ 3,
119
+ 2,
120
+ 2,
121
+ 2,
122
+ 2,
123
+ 2,
124
+ 3,
125
+ 4,
126
+ 3,
127
+ 3,
128
+ 2,
129
+ 2,
130
+ 3,
131
+ 3,
132
+ 2,
133
+ 2,
134
+ 2,
135
+ 2,
136
+ 2,
137
+ 4,
138
+ 3,
139
+ 2,
140
+ 2,
141
+ 2,
142
+ 3,
143
+ 3,
144
+ 3,
145
+ 2,
146
+ 3
147
+ ],
148
+ "cls_token_id": 50281,
149
+ "decoder_bias": true,
150
+ "deterministic_flash_attn": false,
151
+ "dtype": "float32",
152
+ "embedding_dropout": 0.0,
153
+ "eos_token_id": 50282,
154
+ "global_attn_every_n_layers": 3,
155
+ "gradient_checkpointing": false,
156
+ "hidden_activation": "gelu",
157
+ "hidden_size": 1024,
158
+ "id2label": {
159
+ "0": "entailment",
160
+ "1": "neutral",
161
+ "2": "contradiction"
162
+ },
163
+ "initializer_cutoff_factor": 2.0,
164
+ "initializer_range": 0.02,
165
+ "intermediate_size": 2624,
166
+ "label2id": {
167
+ "contradiction": 2,
168
+ "entailment": 0,
169
+ "neutral": 1
170
+ },
171
+ "layer_norm_eps": 1e-05,
172
+ "layer_types": [
173
+ "full_attention",
174
+ "sliding_attention",
175
+ "sliding_attention",
176
+ "full_attention",
177
+ "sliding_attention",
178
+ "sliding_attention",
179
+ "full_attention",
180
+ "sliding_attention",
181
+ "sliding_attention",
182
+ "full_attention",
183
+ "sliding_attention",
184
+ "sliding_attention",
185
+ "full_attention",
186
+ "sliding_attention",
187
+ "sliding_attention",
188
+ "full_attention",
189
+ "sliding_attention",
190
+ "sliding_attention",
191
+ "full_attention",
192
+ "sliding_attention",
193
+ "sliding_attention",
194
+ "full_attention",
195
+ "sliding_attention",
196
+ "sliding_attention",
197
+ "full_attention",
198
+ "sliding_attention",
199
+ "sliding_attention",
200
+ "full_attention"
201
+ ],
202
+ "local_attention": 128,
203
+ "max_position_embeddings": 2048,
204
+ "mlp_bias": false,
205
+ "mlp_dropout": 0.0,
206
+ "model_type": "modernbert",
207
+ "norm_bias": false,
208
+ "norm_eps": 1e-05,
209
+ "num_attention_heads": 16,
210
+ "num_hidden_layers": 28,
211
+ "pad_token_id": 50283,
212
+ "position_embedding_type": "absolute",
213
+ "problem_type": "single_label_classification",
214
+ "rope_parameters": {
215
+ "full_attention": {
216
+ "rope_theta": 160000.0,
217
+ "rope_type": "default"
218
+ },
219
+ "sliding_attention": {
220
+ "rope_theta": 10000.0,
221
+ "rope_type": "default"
222
+ }
223
+ },
224
+ "sep_token_id": 50282,
225
+ "sparse_pred_ignore_index": -100,
226
+ "sparse_prediction": false,
227
+ "tasks": [
228
+ "glue/mnli",
229
+ "glue/qnli",
230
+ "glue/rte",
231
+ "glue/wnli",
232
+ "glue/mrpc",
233
+ "glue/qqp",
234
+ "glue/stsb",
235
+ "super_glue/boolq",
236
+ "super_glue/cb",
237
+ "super_glue/multirc",
238
+ "super_glue/wic",
239
+ "super_glue/axg",
240
+ "anli/a1",
241
+ "anli/a2",
242
+ "anli/a3",
243
+ "sick/label",
244
+ "sick/entailment_AB",
245
+ "snli",
246
+ "scitail/snli_format",
247
+ "hans",
248
+ "WANLI",
249
+ "recast/recast_ner",
250
+ "recast/recast_sentiment",
251
+ "recast/recast_verbnet",
252
+ "recast/recast_megaveridicality",
253
+ "recast/recast_verbcorner",
254
+ "recast/recast_kg_relations",
255
+ "recast/recast_factuality",
256
+ "recast/recast_puns",
257
+ "probability_words_nli/reasoning_1hop",
258
+ "probability_words_nli/usnli",
259
+ "probability_words_nli/reasoning_2hop",
260
+ "nan-nli",
261
+ "nli_fever",
262
+ "breaking_nli",
263
+ "conj_nli",
264
+ "fracas",
265
+ "dialogue_nli",
266
+ "mpe",
267
+ "dnc",
268
+ "recast_white/fnplus",
269
+ "recast_white/sprl",
270
+ "recast_white/dpr",
271
+ "robust_nli/IS_CS",
272
+ "robust_nli/LI_LI",
273
+ "robust_nli/ST_WO",
274
+ "robust_nli/PI_SP",
275
+ "robust_nli/PI_CD",
276
+ "robust_nli/ST_SE",
277
+ "robust_nli/ST_NE",
278
+ "robust_nli/ST_LM",
279
+ "robust_nli_is_sd",
280
+ "robust_nli_li_ts",
281
+ "add_one_rte",
282
+ "paws/labeled_final",
283
+ "glue/cola",
284
+ "glue/sst2",
285
+ "pragmeval/pdtb",
286
+ "lex_glue/eurlex",
287
+ "lex_glue/scotus",
288
+ "lex_glue/ledgar",
289
+ "lex_glue/unfair_tos",
290
+ "dynasent/dynabench.dynasent.r1.all/r1",
291
+ "dynasent/dynabench.dynasent.r2.all/r2",
292
+ "cycic_classification",
293
+ "lingnli",
294
+ "monotonicity-entailment",
295
+ "scinli",
296
+ "naturallogic",
297
+ "dynahate",
298
+ "syntactic-augmentation-nli",
299
+ "autotnli",
300
+ "defeasible-nli/atomic",
301
+ "defeasible-nli/snli",
302
+ "help-nli",
303
+ "nli-veridicality-transitivity",
304
+ "lonli",
305
+ "dadc-limit-nli",
306
+ "folio",
307
+ "tomi-nli",
308
+ "puzzte",
309
+ "temporal-nli",
310
+ "counterfactually-augmented-snli",
311
+ "cnli",
312
+ "boolq-natural-perturbations",
313
+ "equate",
314
+ "chaos-mnli-ambiguity",
315
+ "logiqa-2.0-nli",
316
+ "mindgames",
317
+ "ConTRoL-nli",
318
+ "logical-fallacy",
319
+ "cladder",
320
+ "conceptrules_v2",
321
+ "zero-shot-label-nli",
322
+ "scone",
323
+ "monli",
324
+ "SpaceNLI",
325
+ "propsegment/nli",
326
+ "FLD.v2/default",
327
+ "FLD.v2/star",
328
+ "SDOH-NLI",
329
+ "scifact_entailment",
330
+ "feasibilityQA",
331
+ "AdjectiveScaleProbe-nli",
332
+ "resnli",
333
+ "semantic_fragments_nli",
334
+ "dataset_train_nli",
335
+ "nlgraph",
336
+ "ruletaker",
337
+ "PARARULE-Plus",
338
+ "logical-entailment",
339
+ "nope",
340
+ "LogicNLI",
341
+ "contract-nli/contractnli_a/seg",
342
+ "contract-nli/contractnli_b/full",
343
+ "nli4ct_semeval2024",
344
+ "biosift-nli",
345
+ "SIGA-nli",
346
+ "FOL-nli",
347
+ "doc-nli",
348
+ "mctest-nli",
349
+ "natural-language-satisfiability",
350
+ "idioms-nli",
351
+ "lifecycle-entailment",
352
+ "MSciNLI",
353
+ "hover-3way/nli",
354
+ "seahorse_summarization_evaluation",
355
+ "missing-item-prediction/contrastive",
356
+ "Pol_NLI",
357
+ "synthetic-retrieval-NLI/count",
358
+ "synthetic-retrieval-NLI/position",
359
+ "synthetic-retrieval-NLI/binary",
360
+ "babi_nli",
361
+ "gen_debiased_nli"
362
+ ],
363
+ "tie_word_embeddings": true,
364
+ "transformers_version": "5.17.0",
365
+ "vocab_size": 50368
366
+ }
eval_typed_decisions.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Score a model served by `decida serve` on a typed-decisions test file. Standard library only.
2
+
3
+ decida serve -m decidabert=helmo/DecidaBERT-large --max-len 2048 &
4
+ python eval_typed_decisions.py --model decidabert --data benchmark_test.jsonl
5
+
6
+ The file has one case per line: {"state", "questions": "<json>", "gold": "<json>"}. Each gold answer is a label plus a soft distribution
7
+ (the average of three samples from a teacher model). A prediction counts as right when its top answer equals the gold label.
8
+ Prints one JSON object: accuracy per question type with a 95% Wilson interval, mean confidence, expected calibration error (10 bins),
9
+ and the accuracy a random guesser would get.
10
+ """
11
+ import argparse
12
+ import json
13
+ import math
14
+ import urllib.request
15
+
16
+ BATCH = 256
17
+
18
+
19
+ def post(url: str, body: dict) -> dict:
20
+ req = urllib.request.Request(url, json.dumps(body).encode(), {"content-type": "application/json"})
21
+ with urllib.request.urlopen(req, timeout=600) as r:
22
+ return json.load(r)
23
+
24
+
25
+ def wilson(k: int, n: int, z: float = 1.96) -> list[float]:
26
+ if n == 0:
27
+ return [0.0, 0.0]
28
+ p = k / n
29
+ d = 1 + z * z / n
30
+ c = (p + z * z / (2 * n)) / d
31
+ h = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
32
+ return [round(c - h, 4), round(c + h, 4)]
33
+
34
+
35
+ def top(kind: str, ans: dict) -> tuple[str, float, dict]:
36
+ """The model's top answer as a label string, its probability, and the full distribution over labels."""
37
+ if kind == "noul":
38
+ p = float(ans["noul"])
39
+ dist = {"true": p, "false": 1 - p}
40
+ else:
41
+ dist = {str(k): float(v) for k, v in ans["probabilities"].items()}
42
+ label = max(dist, key=dist.get)
43
+ return label, dist[label], dist
44
+
45
+
46
+ def ece(pairs: list[tuple[float, bool]], bins: int = 10) -> float:
47
+ total = len(pairs)
48
+ err = 0.0
49
+ for b in range(bins):
50
+ lo, hi = b / bins, (b + 1) / bins
51
+ cell = [(c, ok) for c, ok in pairs if lo < c <= hi or (b == 0 and c == 0)]
52
+ if cell:
53
+ err += len(cell) / total * abs(sum(ok for _, ok in cell) / len(cell) - sum(c for c, _ in cell) / len(cell))
54
+ return err
55
+
56
+
57
+ def main() -> None:
58
+ ap = argparse.ArgumentParser()
59
+ ap.add_argument("--model", required=True)
60
+ ap.add_argument("--data", required=True)
61
+ ap.add_argument("--url", default="http://127.0.0.1:8000")
62
+ a = ap.parse_args()
63
+ with open(a.data, encoding="utf-8") as f:
64
+ cases = [json.loads(line) for line in f]
65
+ questions = [json.loads(c["questions"]) for c in cases]
66
+ golds = [json.loads(c["gold"]) for c in cases]
67
+ responses: list[dict] = []
68
+ for lo in range(0, len(cases), BATCH):
69
+ chunk = [{"state": c["state"], "questions": q} for c, q in zip(cases[lo:lo + BATCH], questions[lo:lo + BATCH], strict=True)]
70
+ responses += post(f"{a.url}/v1/systemone/batch", {"model": a.model, "requests": chunk})["responses"]
71
+ stats: dict[str, dict] = {}
72
+ for resp, qs, gold in zip(responses, questions, golds, strict=True):
73
+ for qid, q in qs.items():
74
+ kind = q["type"]
75
+ s = stats.setdefault(kind, {"n": 0, "right": 0, "near": 0, "failed": 0, "pairs": [], "chance": 0.0})
76
+ s["n"] += 1
77
+ k = len(q.get("criteria") or {"true": 1, "false": 1})
78
+ s["chance"] += 1 / k
79
+ if "answers" not in resp:
80
+ s["failed"] += 1
81
+ continue
82
+ label, conf, _ = top(kind, resp["answers"][qid])
83
+ ok = label == str(gold[qid]["label"])
84
+ s["right"] += ok
85
+ s["pairs"].append((conf, ok))
86
+ if kind == "score":
87
+ s["near"] += abs(int(label) - int(gold[qid]["label"])) <= 1
88
+ out = {"model": a.model, "cases": len(cases), "types": {}}
89
+ allpairs, right, n = [], 0, 0
90
+ for kind, s in sorted(stats.items()):
91
+ row = {"questions": s["n"], "accuracy": round(s["right"] / s["n"], 4), "ci95": wilson(s["right"], s["n"]),
92
+ "chance": round(s["chance"] / s["n"], 4), "mean_confidence": round(sum(c for c, _ in s["pairs"]) / max(1, len(s["pairs"])), 4),
93
+ "ece": round(ece(s["pairs"]), 4)}
94
+ if kind == "score":
95
+ row["within_one_level"] = round(s["near"] / s["n"], 4)
96
+ if s["failed"]:
97
+ row["failed"] = s["failed"]
98
+ out["types"][kind] = row
99
+ allpairs += s["pairs"]
100
+ right += s["right"]
101
+ n += s["n"]
102
+ out["overall"] = {"questions": n, "accuracy": round(right / n, 4), "ci95": wilson(right, n), "ece": round(ece(allpairs), 4)}
103
+ print(json.dumps(out, indent=1))
104
+
105
+
106
+ if __name__ == "__main__":
107
+ main()
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:beff05403066ea528b9c93d16ea0eaaf26e32e79575d3e3360ccb37ea6f6733b
3
+ size 1685199284
rl_agent_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"temperature": [1.0, 1.0, 1.0], "calibrated": true}
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "[CLS]",
5
+ "is_local": false,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "max_length": 2048,
9
+ "model_input_names": [
10
+ "input_ids",
11
+ "attention_mask"
12
+ ],
13
+ "model_max_length": 1000000000000000019884624838656,
14
+ "pad_to_multiple_of": null,
15
+ "pad_token": "[PAD]",
16
+ "pad_token_type_id": 0,
17
+ "padding_side": "right",
18
+ "sep_token": "[SEP]",
19
+ "stride": 0,
20
+ "tokenizer_class": "TokenizersBackend",
21
+ "truncation_side": "right",
22
+ "truncation_strategy": "longest_first",
23
+ "unk_token": "[UNK]"
24
+ }