File size: 8,446 Bytes
3265ba1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
---
license: apache-2.0
language:
  - en
  - pt
base_model: Tropic-AI/moBERTo
library_name: transformers
pipeline_tag: text-classification
tags:
  - modernbert
  - encoder
  - typed-decisions
  - decision-index
  - onnx
  - cpu
  - decision-model
---

# Dinah-0 Apache

**The same Dinah-0, retrained without non-commercial data and released under Apache-2.0: a 150M-parameter encoder that makes typed decisions, in English and Portuguese, on a CPU.**

This is not a new version. It is [Dinah-0](https://huggingface.co/Lukitaduarte/dinah-0) rebuilt for commercial use. Dinah-0 was trained on a few thousand items from RACE and MCTest and is therefore released under CC BY-NC 4.0. Dinah-0 Apache starts from a lineage with no non-commercial source and drops those items. Same architecture, same question format (`choice`, `noul`, `score`, with probabilities and confidence), same 8,192-token context. It scores about 0.2 points lower on the Decision Index than Dinah-0, which is the price of the clean license. Not affiliated with TypeSafe.

- Apache-2.0 weights, ONNX files (int8 and 8-bit) and inference code
- Decision Index 0.3 public index **25.86** (official kit run), against 26.06 for Dinah-0
- On par with Dinah-0 on English, Portuguese and chess guard sets

## What it does

It reads a question (instructions, state and a set of options) and returns a probability distribution over the options. The same model answers three question types:

| Type | Output |
|---|---|
| `choice` | the chosen label, a confidence and the probability of every label |
| `noul` | the probability that a statement is true |
| `score` | the expected value on an ordered rubric, plus confidence and probabilities |

It does not generate text. It is built for classification, routing, tool selection, extraction checks and similar decisions where a small, fast and cheap model is enough.

## Results

### Decision Index 0.3

Official run of the [Decision Index](https://github.com/apolinario/decision-index) kit with the engine in this repository (`decision_index_engine.py`), edition 0.3, on one NVIDIA RTX 5090, one process per variant. 140,620 requests run; 140,178 are scoreable after the kit's exclusions, all with a result except 8 refused as unsupported. In total 324 requests do not fit in 8,192 tokens and are refused (nothing is truncated).

| | Public index (balanced skill) | Raw index |
|---|---:|---:|
| **Dinah-0 Apache** | **25.86** | 44.50 |
| Dinah-0 (CC BY-NC 4.0, from the live board) | 26.06 | n/d |

The calibration described below changes probabilities and confidence but not a single chosen option, so the index is identical with and without it (25.86 both ways, checked on all 314,940 answers).

The raw results of this run are published for auditing in [Lukitaduarte/dinah-0-decision-index-results](https://huggingface.co/datasets/Lukitaduarte/dinah-0-decision-index-results) under `runs/dinah-0-apache/`.

### Guard sets

Held-out sets of 1,000 items each, accuracy:

| Set | Dinah-0 | Dinah-0 Apache |
|---|---:|---:|
| Typed decisions, English | 0.78 | 0.789 |
| Typed decisions, Portuguese | 0.784 | 0.786 |
| Chess puzzles | 0.59 | 0.587 |

Dinah-0 Apache is a weight average (50/50) of two checkpoints trained in sequence from the same starting point, one favoring tools and new domains and one restoring Portuguese. No benchmark test row was used for training.

## Calibration

Two numbers come out of each answer and they mean different things:

- **`probabilities`** estimate the distribution of the label. The typed-decision labels are distributions (the mean mass of the top option is about 0.66), so the top probability is not the chance of being right and is usually lower than the accuracy.
- **`confidence`** estimates the chance that the chosen option is right.

Both are calibrated inside `dinah.py` (settings in `config.json`, key `dinah.calibration`): one temperature per question type and number of options (2 to 9) for the probabilities, and a Platt map for the confidence. They were fit on the even-indexed half of the English and Portuguese typed-decision test sets. On the other half, which was not used for fitting, the expected calibration error of `confidence` is 0.069 (English) and 0.060 (Portuguese). Treat that as the figure for in-distribution questions and measure again on your own domain before relying on it.

## Usage

```python
from dinah import Dinah, DinahONNX

model = Dinah.from_pretrained("Lukitaduarte/dinah-0-apache")       # PyTorch, fp32 weights
model = DinahONNX.from_pretrained("Lukitaduarte/dinah-0-apache")   # onnxruntime, int8, CPU

model.choice(state="The package arrived broken.",
             criteria={"refund": "Customer wants money back", "replace": "Customer wants a new unit"},
             instructions="What does the customer want?")
```

Files:

| File | What it is |
|---|---|
| `model.safetensors` | fp32 weights for the PyTorch backend |
| `onnx/model_int8.onnx` | int8, 151 MB, the default CPU backend of `dinah.py` |
| `onnx/model_8bit.onnx` | 8-bit weights, 165 MB, listed in `decision_ai.json` |
| `dinah.py` | minimal inference code (PyTorch and ONNX backends) |
| `decision_index_engine.py` | engine used to run the Decision Index kit |
| `decision_ai.json` | manifest for the Decision AI runtime |

ONNX parity with PyTorch on real items: identical argmax in 100% of 64 items, maximum probability difference 2e-5.

## Training data and licenses

Dinah-0 Apache was trained in stages from [Tropic-AI/moBERTo](https://huggingface.co/Tropic-AI/moBERTo) (Apache-2.0). Each dataset is listed with the license its own card declares.

| Source | License |
|---|---|
| ZefanCai/Open-Jev | CC0-1.0 |
| LocalLLaMA/typed-decisions | Apache-2.0 |
| typed-decisions-pt (translated with Qwen3-4B, Apache-2.0) | Apache-2.0 |
| Lichess puzzles | CC0-1.0 |
| google-deepmind/searchless_chess (ChessBench) | Apache-2.0 |
| AmazonScience/massive | CC BY 4.0 |
| Bitext customer support | CDLA-Sharing-1.0 |
| ESCI | Apache-2.0 |
| WANLI | CC BY 4.0 |
| SNLI | CC BY-SA 4.0 |
| HoVer | CC BY-SA 4.0 |
| CommonsenseQA | MIT |
| Cosmos QA | CC BY 4.0 |
| BoolQ | CC BY-SA 3.0 |
| HellaSwag | MIT |
| WinoGrande | Apache-2.0 |
| ARC (train split) | CC BY-SA 4.0 |
| QASC | CC BY 4.0 |
| StrategyQA | MIT |
| bAbI-NLI | BSD |
| BIG-bench tasks (tasksource, BBH tasks excluded) | Apache-2.0 |
| MMLU auxiliary train (ARC and OpenBookQA parts only) | MIT |
| PubMedQA | MIT |
| MedMCQA | Apache-2.0 |
| GoEmotions | Apache-2.0 |
| Civil Comments | CC0-1.0 |
| twitter-financial-news-sentiment | MIT |
| financial-tweets-sentiment | MIT |
| NOSIBLE financial-sentiment | ODC-By |
| FinQA hallucination detection | MIT |
| CUAD | CC BY 4.0 |
| BANKING77 | CC BY 4.0 |
| CLINC150 | CC BY 3.0 |
| ContractNLI | CC BY 4.0 |
| IBM Claim Stance | CC BY 3.0 |
| HaluEval | Apache-2.0 |
| GSM8K | MIT |
| CLadder | MIT |
| iSarcasmEval | MIT |
| B2W-Reviews01 | CC BY 4.0 |
| multilingual-sentiments (pt) | Apache-2.0 |
| jurisprudencias_br | CC BY 4.0 |
| FaQuAD-NLI | CC BY 4.0 |
| FAQ_BACEN | Apache-2.0 |
| ExtraGLUE (RTE and COPA, pt) | MIT |
| glaiveai/glaive-function-calling-v2 | Apache-2.0 |
| Team-ACE/ToolACE | Apache-2.0 |
| NousResearch/hermes-function-calling-v1 | Apache-2.0 |
| nvidia/When2Call | CC BY 4.0 |
| Dizzzy0x00/LLMGen-Phishing-Email-Dataset | Apache-2.0 |
| kudzaiprichard/aura-phishing-email-corpus (SpamAssassin part) | CC BY 4.0 |
| Synthetic phishing emails, written with openai/gpt-oss-120b (signals and labels set by code) | Apache-2.0 |
| English to Portuguese translations of NLI, HellaSwag, Cosmos QA, CommonsenseQA and BoolQ items, made with Helsinki-NLP/opus-mt-tc-big-en-pt | CC BY 4.0 |
| Programmatic skills (arithmetic, dates, units, sorting, graphs, code output): generated by our own scripts | Apache-2.0 |

Datasets under CC BY-SA and CDLA-Sharing are used for training only and are not redistributed here.

## Limits

- 8,192-token context. Nothing is truncated: a longer request raises `RequestTooLong`.
- English and Portuguese only. Other languages work to the extent the base model saw them, and were not evaluated.
- It does not generate text and it does not know facts beyond its training: on knowledge-heavy benchmarks (MMLU, GPQA, HLE) it is far behind decoder models with billions of parameters.
- Confidence is calibrated on the training distribution. On a new domain, measure it before trusting it.

## License

Apache-2.0. See `LICENSE`.