File size: 7,545 Bytes
003acf8
 
 
0ba707e
 
003acf8
0ba707e
 
 
 
 
 
 
 
003acf8
 
 
 
812a403
003acf8
812a403
 
 
003acf8
07c876f
 
 
 
 
 
 
 
 
 
 
 
 
812a403
 
003acf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812a403
003acf8
 
 
 
 
 
 
 
 
 
 
 
 
80a8cef
 
 
 
 
 
 
ac2c8ee
80a8cef
 
 
 
 
 
 
 
 
2e06d7b
 
 
 
 
 
 
 
 
80a8cef
 
2e06d7b
 
 
 
8acd879
 
 
 
 
 
 
 
 
80a8cef
003acf8
 
 
812a403
003acf8
 
812a403
003acf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70090a6
003acf8
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
base_model: Alibaba-NLP/gte-modernbert-base
library_name: transformers
pipeline_tag: zero-shot-classification
tags:
  - assay
  - decision-model
  - calibrated
  - conformal-prediction
  - text-classification
  - cpu
language:
  - en
---

# assay-compiled-base

A small-tier decision model from the [Assay](https://github.com/bgokden/assay) project:
typed questions (`bool`, `choice`, `score`) over a state produce calibrated probability
distributions with an `evidence` signal, and no text is generated. It is the small, CPU-friendly tier, with no language model at all. The decoder
models ([Berk/assay-4b](https://huggingface.co/Berk/assay-4b),
[Berk/assay-27b](https://huggingface.co/Berk/assay-27b)) are more accurate and larger.

## In one line

**It runs on a CPU, and it abstains.** 149M parameters, ~29 ms per decision without a GPU.
On tasks it has never seen it acts on 8% of bool questions at a 5.0% error rate and hands the
rest over rather than guessing -- a conformal prediction set against a fitted error rate, not
a threshold on a softmax someone eyeballed. It abstains far more than the decoder tiers
because it is far smaller; that is the trade, and it is visible instead of hidden.

Accuracy on those unseen tasks is **0.606**. If you have a GPU, start with
[Berk/assay-4b](https://huggingface.co/Berk/assay-4b) at 0.803 instead.

The rest of the family, and the dataset, are in the [Assay collection](https://huggingface.co/collections/Berk/assay-calibrated-typed-decisions-6ab2fcb2b7eea0b7aaf785ab).

Architecture `compiled` with late interaction on `Alibaba-NLP/gte-modernbert-base` (8 query slots).
The state is encoded once into token embeddings. Each question is compiled once: the instruction becomes a set of query vectors (learned slots plus a projection of its pooled encoding), each option becomes a vector (its pooled encoding) and its token encodings. A decision is cross-attention from the queries over the state tokens, a small reader MLP, a bilinear score against each option vector plus a per-option bias, and a late-interaction term: the mean over option tokens of the best cosine match among state tokens, times a learned scale. Compiled questions can be cached and reused across states; after the state encode, a decision is a few small matrix products.

## Evaluation

| split | n | accuracy | Brier | NLL | ECE | confident errors |
|---|---|---|---|---|---|---|
| seen tasks (dev), scaled | 6113 | 0.668 | 0.442 | 0.806 | 0.037 | 0.019 |
| unseen tasks (holdout), raw | 2020 | 0.606 | 0.522 | 0.895 | 0.133 | 0.035 |
| unseen tasks (holdout), scaled | 2020 | 0.606 | 0.494 | 0.818 | 0.061 | 0.011 |
| kev transfer-v4 dev, raw | 764 | 0.542 | 0.613 | 1.048 | 0.174 | 0.064 |
| kev transfer-v4 dev, scaled | 764 | 0.542 | 0.572 | 0.952 | 0.095 | 0.012 |

"Scaled" applies the temperature 1.485 fitted on the seen-task
calibration split. Unseen tasks are eleven datasets never trained on; the transfer suite is
`jaredpalmer/kev-suites` transfer-v4 dev, whose sources are excluded from training. Single-text
classification (topic, sentiment, spam) is strong; questions that need knowledge (MMLU) or
multi-step reasoning are near chance. See the repository's `docs/roadmap.md` for the full
comparison against the other tiers.

CPU latency (milliseconds; the state is encoded once, questions are compiled once and cached, `decide` runs per state x question set):

```
runs/compiled-late-gte-base on cpu, 8 threads
questions  encode_state_ms  compile_ms  decide_ms  end_to_end_ms
        1            28.95       29.63      1.381          62.25
        3            30.67       61.52      1.753          94.48
        6            30.64       88.46      2.844         122.80
       12            30.51       88.45      4.867         124.75
       24            30.64       88.42     10.694         131.05
```

## The family

| model | size | unseen tasks | transfer-v4 |
|---|---|---|---|
| [assay-0.6b](https://huggingface.co/Berk/assay-0.6b) | 0.6B | 0.704 / 0.397 | 0.636 / 0.499 |
| [assay-1.7b](https://huggingface.co/Berk/assay-1.7b) | 1.7B | 0.752 / 0.334 | 0.670 / 0.436 |
| [assay-4b](https://huggingface.co/Berk/assay-4b) | 4B | 0.803 / 0.271 | 0.784 / 0.302 |
| [assay-8b](https://huggingface.co/Berk/assay-8b) | 8B | 0.808 / 0.256 | 0.818 / 0.267 |
| [assay-27b](https://huggingface.co/Berk/assay-27b) | 27B | 0.842 / 0.221 | 0.842 / 0.229 |
| [assay-compiled-base](https://huggingface.co/Berk/assay-compiled-base) | 149M | 0.606 / 0.494 | 0.542 / 0.572 |

Accuracy / Brier after temperature scaling. Same recipe, same splits, different backbones;
per-tier abstention and latency are in
[docs/models.md](https://github.com/bgokden/assay/blob/main/docs/models.md).

## Serving

```bash
python -m assay.server --model Berk/assay-compiled-base --port 8000
```

`POST /v1/decide` is the native shape; `POST /v1/systemone` and `/v1/systemone/batch` accept
the shape other open decision models use (`criteria` options, `noul` booleans); `POST
/v1/decide_graph` walks a decision tree in one forward pass; `POST /v1/agents` registers an
agent -- a graph plus the actions its outcomes stand for -- and `/v1/agents/<name>/run`
decides a case. Requests arriving together share a pass, and `/health` and `/metrics` are for
operations. `assay.backends.sglang` runs the same model on an SGLang deployment.

Guides: [deployment and the full API](https://github.com/bgokden/assay/blob/main/docs/serving.md),
[agents](https://github.com/bgokden/assay/blob/main/docs/agents.md),
[runnable examples](https://github.com/bgokden/assay/tree/main/examples).

## Train one on your own data

`python -m assay.pipeline --config <your>.json` runs training, temperature calibration,
evaluation and the conformal thresholds over your own records, and writes a directory this
same server and publisher accept. The repository's
[examples/](https://github.com/bgokden/assay/tree/main/examples) has a configuration per tier
and a dataset in the record format; records written for other decision models (`criteria`
options, `noul` booleans) load unchanged.


## Usage

```python
from assay import load_model
from assay.schema import Question

model = load_model("Berk/assay-compiled-base", device="cpu")
answers = model.answer(
    "My card was charged twice for order A-104.",
    {
        "refund": Question(type="bool", instructions="Does the customer ask for money back?"),
        "team": Question(type="choice", instructions="Which team should handle this?",
                         options={"billing": "Charges and refunds", "technical": "Bugs"}),
    },
)
print(answers["team"].probabilities, answers["refund"].p_true)
```

Trained with `assay.train_compiled` (3.0 epochs, lr 5e-05, head lr
0.0005, batch 32) on the Assay data (55 public datasets
rendered as typed questions, synthetic policy and date cases, and 40k generic questions labelled
by assay-27b). Each dataset keeps its own licence; the list is in
[docs/datasets.md](https://github.com/bgokden/assay/blob/main/docs/datasets.md).

## Limitations

English only. No knowledge beyond what the encoder carries, no arithmetic, no multi-hop
reasoning. Calibrated in aggregate on the evaluated distributions, not per answer; check on
your own labels before acting on thresholds.

## Relationship to other work

Assay is an independent project. Jev and System One are names of TypeSafe AI's products and
are mentioned only to describe and compare; kev-suites is Jared Palmer's evaluation data.
Assay is not affiliated with or endorsed by either.