File size: 15,956 Bytes
191693c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# Running, serving and evaluating the decision model

This guide is self-contained: it assumes a fresh Linux VM with an NVIDIA GPU (e.g. on GCP) and nothing else. It covers getting the model onto the machine, running it from Python, serving it over HTTP, and evaluating it on the public [Decision Index](https://github.com/apolinario/decision-index) (text and vision) the way the leaderboard does.

## 1. What the model is

A fine-tuned Qwen3.5 image-text model that answers *typed decisions*: given a `state` (text or JSON, optionally images) and `questions` (`choice` with named options, or yes/no `noul`), it returns one probability per option. Two models use this code:

| Model | Base model | Size | Temperature |
|---|---|---|---|
| [IVE-4B](https://huggingface.co/illuin/IVE-4B) | Qwen/Qwen3.5-4B | 9.1 GB | 1.5329 |
| [Ivonnet-0.8B](https://huggingface.co/illuin/Ivonnet-0.8B) | Qwen/Qwen3.5-0.8B (distilled from IVE-4B) | 1.7 GB | 1.4467 |

A model repo is self-contained (no base-model download at run time):

```
config.json, model*.safetensors, model.safetensors.index.json   Qwen3_5Model backbone (no LM head), bf16
tokenizer.json, tokenizer_config.json, chat_template.jinja, processor_config.json
readout.safetensors          255-code decision readout [255, hidden], float32
decision_config.json         format_version 1, answer codes and token ids, fitted temperature,
                             attention_mode "noncausal_full_attention", pooling "last"
evaluation/export-verification.json   checks run at export time
release-manifest.json        bytes and sha256 of every file
```

The code is the `decision_model` package (`source/src/decision_model/` in the model repo):

| Module | What it does |
|---|---|
| `model.py` | `DecisionModel`: loading, prompt rendering, batching, inference. Imports only torch, transformers, PIL, safetensors. |
| `server.py` | FastAPI server: `POST /v1/systemone` (text protocol), `POST /v1/decisions` (vision protocol). |
| `engine.py` | Decision Index kit engines: `DecisionModelEngine` (text), `DecisionModelVisionEngine` (vision). |

## 2. Getting the model and code onto the VM

```bash
hf download illuin/IVE-4B --local-dir ~/models/IVE-4B      # or illuin/Ivonnet-0.8B
export M=~/models/IVE-4B   # used below
```

`DecisionModel.from_pretrained("illuin/IVE-4B", revision=...)` and the engines' `--option model=illuin/IVE-4B` also download straight from the Hub.

## 3. VM setup

- **GPU**: any NVIDIA GPU with bf16 (Ampere or newer). The 4B was tested on H100 80 GB and RTX PRO 6000 (96 GB). Smaller GPUs (24 GB) may run out of memory on the longest Decision Index requests (~27k tokens). The leaderboard measures latency on an RTX PRO 6000 (Blackwell). If you can get one (on GCP, the G4 machine series, quota permitting; on Hugging Face Jobs, the `rtx-pro-6000` flavor), it gives the most representative latency.
- **Disk**: about 100 GB covers the model, both suites and run outputs.
- **Software**: an NVIDIA driver recent enough for CUDA 12.8 (Blackwell needs it), and Python 3.12.

```bash
python3.12 -m venv ~/venv && source ~/venv/bin/activate
pip install --upgrade pip
pip install torch==2.11.0 --index-url https://download.pytorch.org/whl/cu128   # tested version
pip install -e "$M/source[fast,server]"   # decision_model + flash-linear-attention + fastapi/uvicorn
pip install "transformers==5.22.1"        # newest tested; 5.7.0 is the training stack
git clone https://github.com/apolinario/decision-index ~/decision-index
pip install -e "$HOME/decision-index[rebuild,vision]"   # the evaluation kit
```

Tested combinations: torch 2.11.0 with transformers 5.7.0, 5.13.1 and 5.22.1, flash-linear-attention 0.5.2, without `causal-conv1d`. `flash-linear-attention` matters for speed: without it, the Gated DeltaNet layers (3 of every 4) run on a slow PyTorch fallback.

## 4. Quick check from Python

```python
from decision_model import DecisionModel

import os
model = DecisionModel.from_pretrained(os.path.expanduser("~/models/IVE-4B"), device="cuda")
print(model.attention_check)
model.warmup()   # compiles/tunes kernels once (seconds); servers and engines do this themselves
print(model.decide(
    "My integration keeps failing with a 401.",
    {"team": {"type": "choice", "instructions": "Which team should handle this request?",
              "criteria": {"billing": "Charges and refunds",
                           "support": "Technical integration errors",
                           "sales": "Questions about buying a product"}},
     "urgent": {"type": "noul", "instructions": "Is the customer blocked?"}}))
```

`attention_check` must show `padded_first_token_sees_last: True`, `padding_keys_masked: True` and `unpadded_first_token_sees_last: True`. The mechanism is `mask_mapping` on transformers ≥ 5.13 and `causal_mask_builder` on 5.7 to 5.12. Loading raises `RuntimeError` instead of running with the wrong attention.

Answers look like `{"type": "choice", "choice": "support", "probabilities": {...}}` and `{"type": "noul", "noul": P(true)}`. Images go in `decide(state, questions, images=[...])` as paths, bytes, PIL images or `data:` URLs.

## 5. Serving over HTTP

```bash
python -m decision_model.server --model "$M" --host 127.0.0.1 --port 8000
# startup = load + warm-up; ready when this says "ready":
curl -s localhost:8000/health
curl -s localhost:8000/v1/systemone -H 'content-type: application/json' -d '{
  "model": "default", "state": "My integration keeps failing.",
  "questions": {"team": {"type": "choice", "instructions": "Which team?",
                         "criteria": {"billing": "Charges and refunds", "support": "Technical errors"}}}}'
```

- **`POST /v1/systemone`**: `{"model", "state", "questions", "images"?}`. This is the Decision Index text protocol (the kit's `http` engine).
- **`POST /v1/decisions`**: the same body, for the vision protocol (the kit's `decide` engine with `protocol=decisions`). Choice options are shown as their descriptions alone, since their keys are already the answer letters.
- **Images** are base64 `data:` URLs. The server never opens a file path from a request, and caps images at 1,638,400 px (the board's rule).
- **Requests run one at a time**; the others wait their turn.
- **Response headers**: `server-timing` gives prepare (tokenization, images) and forward (GPU) milliseconds.
- **Refusals**: HTTP 413 "maximum context length" (over 32,768 tokens) and 422 "options per choice" (over 255 options). The kit records both as *unsupported*, not as errors.
- **Exposing beyond localhost**: set `DECISION_MODEL_API_KEY` (bearer token) before binding to `0.0.0.0`, or keep `127.0.0.1` and use an SSH tunnel.

## 6. Evaluating on the Decision Index

The public suites are not redistributed: you build them once from pinned public sources. Some sources are gated: accept the terms of [cais/hle](https://huggingface.co/datasets/cais/hle) (text) and [facebook/winoground](https://huggingface.co/datasets/facebook/winoground) (vision) with the Hub account you are logged in with. Without them the run is not `complete` (the leaderboard requires complete runs).

Keep both suites private: several sources forbid redistribution.

### 6.1 Build the suites (once)

```bash
cd ~/decision-index
export HF_HUB_DISABLE_XET=1
# text: ~7 GB of downloads, 17 GB of working space; staged into ./suite-0.3
python -m decision_index suite rebuild --work work
python -m decision_index suite import \
    --rows work/artifacts/benchmark-suite/release-v2-rebuilt/selected-rows.jsonl.gz \
    --added-rows work/artifacts/benchmark-suite/release-v2-rebuilt/added-rows.jsonl.gz \
    --gsm8k-rows work/artifacts/benchmark-suite/release-v3-rebuilt/gsm8k-rows.jsonl.gz
# vision: ~5.7 GB of downloads into ./work/vision. The Mind2Web box labels are drawn in Arial Bold:
sudo apt-get install -y ttf-mscorefonts-installer
export DECISION_INDEX_FONT=/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf
python -m decision_index suite rebuild --vision --work work
python -m decision_index vision verify --dir work/vision
```

`suite import` and `vision verify` check hashes against the board's own files: they must pass.

### 6.2 Text, one GPU

```bash
cd ~/decision-index
python -m decision_index pipeline --engine decision_model.engine:DecisionModelEngine \
    --option model="$M" --out runs/4b-text
```

This runs about 140k requests, then scores them. Expect about 3 h on one H100 for the 4B; slower GPUs take proportionally longer. The run checkpoints to `results.jsonl` and resumes when the same command is re-run (rows that errored are retried).

### 6.3 Text, several GPUs

Split the suite by run id, run one process per GPU, merge the results, then score:

```bash
cd ~/decision-index && mkdir -p shards runs/4b-text
python - <<'EOF'
import gzip, hashlib, json
from decision_index.suite.io import Suite
N = 4                                          # number of GPUs
out = [gzip.open(f"shards/rows-{i}.jsonl.gz", "wt", encoding="utf-8") for i in range(N)]
for row in Suite("suite-0.3", "0.3").rows():
    i = int(hashlib.sha256(row["_evaluation"]["run_id"].encode()).hexdigest(), 16) % N
    out[i].write(json.dumps(row, ensure_ascii=False) + "\n")
for f in out:
    f.close()
EOF
for i in 0 1 2 3; do
  CUDA_VISIBLE_DEVICES=$i python -m decision_index run \
      --engine decision_model.engine:DecisionModelEngine --option model="$M" \
      --rows shards/rows-$i.jsonl.gz --out runs/4b-text/shard-$i > runs/4b-text/shard-$i.log 2>&1 &
done; wait
cat runs/4b-text/shard-*/results.jsonl > runs/4b-text/results.jsonl   # after every shard has finished
python -m decision_index score --suite-dir suite-0.3 --edition 0.3 \
    --results runs/4b-text/results.jsonl --engine decision-model --out runs/4b-text
```

### 6.4 Vision

```bash
python -m decision_index vision pipeline --dir work/vision \
    --engine decision_model.engine:DecisionModelVisionEngine --option model="$M" --out runs/4b-vision
```

This covers 12,210 rows (one question over 1 to 4 images), at native resolution capped at 1.6 MP (the board's rule, the engine default). It takes well under an hour on an H100.

### 6.5 Through the server instead

With the server running (section 5):

```bash
python -m decision_index pipeline --engine http --option base_url=http://127.0.0.1:8000 --out runs/4b-text-http
python -m decision_index vision pipeline --dir work/vision --engine decide \
    --option base_url=http://127.0.0.1:8000 --option protocol=decisions --out runs/4b-vision-http
```

Answers are the same as in-process for text. For vision, the kit's `decide` engine itself downscales images over 1.6 MP (LANCZOS) before sending them, so a few large images differ slightly from the in-process path. The in-process engines (6.2 to 6.4) are the evaluated path.

### 6.6 Outputs

**Text** (`runs/<name>/`) holds:
- `results.jsonl`: one row per request: status, answers, `model_request_wall_ms`.
- `benchmark-summary.json`
- `index.json`
- `scores.json`:
  - `decision_index` is the public index;
  - `areas` and `index_benchmarks` hold per-area and per-benchmark chance-corrected `skill`;
  - `complete` is true only when every scoreable request (140,178) was answered, which needs HLE.

**Vision** (`runs/<name>/`) holds:
- `results.jsonl`
- `vision-scores.json`:
  - `public_vision_index`;
  - per-benchmark `skill`;
  - `complete`, which needs all 11 benchmarks, Winoground included.

Do not edit result files: the leaderboard re-scores them on review.

## 7. Latency

The leaderboard's rule: on one RTX PRO 6000, in a single process, one request at a time, with the fastest path the model's code supports, the median, mean and 80th-percentile time per request must each be at most 1,000 ms.

To measure, run the text suite (or part of it, `--limit N`) with **one process per GPU**; sharing a GPU skews the timings. Then:

```bash
python - runs/4b-text/results.jsonl <<'EOF'
import json, statistics, sys
ms = sorted(r["model_request_wall_ms"] for r in map(json.loads, open(sys.argv[1])) if r["status"] == "ok")
print(f"n={len(ms)} median={statistics.median(ms):.1f} mean={statistics.mean(ms):.1f} "
      f"p80={ms[int(.8 * (len(ms) - 1))]:.1f} max={ms[-1]:.1f} ms")
EOF
```

Loading and warm-up happen when the engine is created, so they are not counted.

Reference numbers, one request at a time after warm-up, over the complete public text suite (140,620 requests) on one RTX PRO 6000 (torch 2.11.0, transformers 5.22.1):

| Model | Median | Mean | p80 | p95 |
|---|---:|---:|---:|---:|
| IVE-4B | 51 ms | 99 ms | 63 ms | 245 ms |
| Ivonnet-0.8B | 38 ms | 49 ms | 40 ms | 72 ms |

On one H100 (80 GB), over 800 random public-suite requests, IVE-4B gave a median of 46 ms, mean 77 ms and p80 53 ms.

## 8. Reference results to compare against

**Parity.** `model.py` gave the same answer as the training code on every question of a 523-question Decision Index sample (text and vision). Its logits stay within one or two bf16 rounding steps across transformers 5.7.0, 5.13.1 and 5.22.1.

**Complete public suites.** Decision Index 0.3, every text request (140,620, HLE included) and every vision row (12,210, Winoground included) answered, on one RTX PRO 6000 with transformers 5.22.1:

| Model | Public text index | Public vision index |
|---|---:|---:|
| IVE-4B | 58.51 | 71.90 |
| Ivonnet-0.8B | 41.27 | 55.99 |

Under transformers 5.7.0 the indices move by at most 0.15; the answers that change are near-ties.

To compare two runs answer by answer: both `results.jsonl` files key rows by `run_id`; compare each question's `choice` (or `noul`) and probabilities.

## 9. Settings that must not change (they define the evaluated model)

- **Non-causal full attention** (from `decision_config.json`), with SDPA. The load-time check enforces it.
- **The fitted temperature** in `decision_config.json`. Do not re-fit or override it for leaderboard runs.
- **bf16 with autocast on CUDA**, and cuDNN SDPA disabled, as in training. The model sets both itself.
- **No truncation.** A request over 32,768 tokens is refused (kit status *unsupported*), never cut.
- **Prompt rendering.** The text protocol shows a choice option as `<key>: <description>`. The vision protocol shows it as `<description>` and leaves an empty state empty. Use the matching engine or endpoint.
- **Images** keep their aspect ratio, with sides rounded to multiples of 32 px (bicubic). Areas are capped at 1,638,400 px for the board; training saw up to 2,073,600 px.
- **Batching.** A request's questions are grouped by length under 32,768 padded tokens (`batching=padded`, the default). One question at a time is about 30% slower on average.

## 10. Troubleshooting

| Symptom | Cause / fix |
|---|---|
| "The fast path is not available…" (5.7) or "`chunk_gated_delta_rule` is falling back to its reference PyTorch implementation" (≥ 5.17) | `flash-linear-attention` is missing: `pip install flash-linear-attention==0.5.2`. On 5.7 the first warning also appears when only `causal-conv1d` is missing. That is expected: the model was evaluated that way. |
| `RuntimeError: the full attention that runs is not …` | A transformers version outside the tested range changed how masks are built. Install `transformers==5.22.1` (or 5.7.0). |
| CUDA out of memory | The longest requests (~27k tokens) on a small GPU. Use a larger GPU. `--option max_length=N` makes longer requests *unsupported*, which is fine for testing but not for a leaderboard run. |
| First request or start-up is slow | Triton kernels compile on first use. The warm-up at load covers it; on a new GPU type the first start takes longer. |
| `ModuleNotFoundError: decision_index` | Install the kit (section 3). |
| Suite build fails on HLE or Winoground | Accept their terms on the Hub with the account behind your token, then re-run the rebuild. |
| `vision verify` flags `full_mind2web` | The Arial Bold font was not found: install it and set `DECISION_INDEX_FONT`, then rebuild that set (`--sets full_mind2web`). |