File size: 5,910 Bytes
b480919
 
aefea79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b480919
aefea79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
---
license: bsd-3-clause
language:
- en
library_name: transformers
pipeline_tag: text-classification
tags:
- bert
- bert-mini
- classification
- decision-model
- dynamic-classification
- calibrated-classification
- option-scoring
- oryn
datasets:
- zefang-liu/phishing-email-dataset
- fancyzhx/ag_news
- google/boolq
- SetFit/sst5
metrics:
- accuracy
- brier_score
- expected_calibration_error
base_model:
- boltuix/bert-mini
---

# Oryn

Oryn is a compact, low-latency decision model built on
[`boltuix/bert-mini`](https://huggingface.co/boltuix/bert-mini).

Unlike a conventional classifier with a fixed output layer, Oryn receives the
classification question and candidate answers at inference time. This allows
the same model to handle binary decisions, multiclass classification, ordinal
scoring, and other option-based tasks.

Oryn is inspired by the publicly described architecture and training ideas
behind Laya.

## Highlights

- Approximately 21 MB of trained weights
- Approximately 3 ms warmed-up single-request latency in the author's local test
- Dynamically supplied classification options
- Supports binary, categorical, and ordinal questions
- Uses one `[MASK]` marker for each candidate answer
- Scores all supplied options relative to one another
- Trained on phishing detection, BoolQ, AG News, and SST-5
- Designed for local and CPU-friendly inference

Latency depends on the device, runtime, input length, and measurement method.
The reported 3 ms result should not be treated as a universal benchmark.

## Architecture

Oryn consists of:

1. A pretrained BERT Mini encoder
2. Two additional Transformer encoder layers
3. One `[MASK]` marker for each candidate answer
4. A learned linear option scorer
5. A softmax over the options provided with the request

A request is represented approximately as:

```text
question: Which category best describes this text?
state: The company reported record quarterly revenue.
options: business [MASK], sports [MASK], technology [MASK], politics [MASK]
```

The contextual representation at each option's `[MASK]` token is passed through
the shared scoring layer. The resulting logits are normalized across the
candidate options.

Because the answer space is supplied at request time, it is not permanently
encoded into a fixed classification head.

## Evaluation

Oryn was evaluated on a random sample of 1,000 held-out examples from its
multitask validation set.

| Metric | Result |
|---|---:|
| Overall accuracy | 71.7% |
| Brier score | 0.3468 |
| Negative log-likelihood | 0.6228 |
| Expected calibration error | 0.0381 |
| Average confidence | 0.7518 |
| Batched throughput | 129.9 examples/second |

### Results by question type

| Question type | Examples | Accuracy | Brier score |
|---|---:|---:|---:|
| Binary / `noul` | 591 | 85.62% | 0.2083 |
| Categorical / `choice` | 196 | 79.59% | 0.2793 |
| Ordinal / `score` | 213 | 25.82% | 0.7933 |

The ordinal sentiment task is currently the model's main weakness. The model is
substantially stronger on binary and categorical decisions.

The benchmark was performed with batched GPU inference. Batched latency is not
equivalent to end-to-end single-request latency.

## Training data

Oryn was trained on a mixture of:

- `zefang-liu/phishing-email-dataset`
- `fancyzhx/ag_news`
- `google/boolq`
- `SetFit/sst5`

These datasets expose the model to:

- Phishing and fraud detection
- Binary reading comprehension
- News topic classification
- Five-level ordinal sentiment classification

## Training method

Training used two phases:

1. Supervised cross-entropy warmup
2. Calibration-oriented optimization using differentiable proper-scoring
   objectives

For nominal decisions, the calibration objective combines cross-entropy with a
spherical scoring term. For ordinal decisions, cross-entropy is combined with
ranked probability score.

This training procedure is Laya-inspired, but it does not reproduce the
original RLCD/REINFORCE procedure exactly.

## Intended uses

Oryn is suitable for experimentation with:

- Message triage
- Phishing detection
- Topic classification
- Sentiment classification
- Support-request routing
- Urgency classification
- Small local decision systems
- Dynamic classification research
- Low-latency edge or local inference

## General classification

Oryn can technically receive any question and any set of options:

```python
result = predict(
    text="The company reported record quarterly revenue.",
    question="Which category best describes this text?",
    options=[
        "business",
        "sports",
        "technology",
        "politics",
    ],
)
```

However, architectural support for arbitrary options does not guarantee
reliable knowledge of arbitrary domains.

Oryn is most reliable on tasks similar to its training mixture. New domains
should be evaluated and usually fine-tuned before production use.

## Example output

```python
{
    "prediction": "business",
    "confidence": 0.8421,
    "probabilities": {
        "business": 0.8421,
        "sports": 0.0314,
        "technology": 0.0987,
        "politics": 0.0278
    }
}
```

## Files


The custom `inference.py` implementation is required because Oryn uses a custom
option-scoring head rather than a standard Transformers sequence-classification
head.

## Installation

```bash
pip install torch transformers
```

## Inference

```bash
python inference.py \
  --text "The company reported record quarterly revenue." \
  --question "Which category best describes this text?" \
  --options business sports technology politics
```

## Citation

If you use Oryn, cite this model repository:

```bibtex
@misc{oryn_bert_mini,
  title        = {Oryn: A compact low-latency BERT Mini option-scoring model},
  author       = {Timo Sarkar},
  year         = {2026},
  howpublished = {Hugging Face},
  note         = {A compact low-latency BERT Mini option-scoring model}
}
```