Zero-Shot Classification
Transformers
Safetensors
qwen3_5
feature-extraction
decision-model
classification
system-one
multimodal
vision
maincode
matilda
custom_code
Instructions to use Maincode/Matilda-Decision-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Maincode/Matilda-Decision-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-classification", model="Maincode/Matilda-Decision-v1", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("Maincode/Matilda-Decision-v1", trust_remote_code=True) model = AutoModel.from_pretrained("Maincode/Matilda-Decision-v1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 5,927 Bytes
be49542 | 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 | ---
pipeline_tag: zero-shot-classification
license: apache-2.0
base_model: Qwen/Qwen3.8-27B
library_name: transformers
tags:
- decision-model
- classification
- system-one
- multimodal
- vision
- maincode
- matilda
---
# Matilda Decision v1
**Matilda Decision** is a 27B multimodal decision model from Maincode. You give it an input (text or JSON,
optionally with images) and the questions you need answered: pick one of several options, say yes or no, or rate
on a scale. It answers them all in one call and returns a probability for every answer, without generating text.
| | |
| --- | --- |
| **Parameters** | 26.1B, including the vision encoder |
| **Inputs** | Text or JSON, plus images (several per request, up to 1.6 MP each) |
| **Decision types** | Choice (up to 255 options) · Yes / No · Score |
| **License** | Apache-2.0 |
## Evaluation
These are results on the **public sets only, for now**.
### Text: Jev Decision Index 0.3, public suite
All 140,178 public requests answered, none unsupported.
| Model | Public index ↑ | Knowledge & Reasoning | Language | Retrieval & Classification | Tools & Automation | Arts & Taste |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| **Matilda Decision v1 (27B)** | **65.38** | 51.1 | 71.3 | 67.6 | 84.6 | 47.4 |
| Torchcast Decision 27B | 65.10 | 46.7 | 72.0 | 67.5 | 84.6 | 54.4 |
| Perplexity Decider v1.1 (27B) | 62.25 | 52.0 | 67.5 | 61.3 | 78.9 | 47.0 |
| Jev | 57.96 | 53.9 | 59.2 | 55.4 | 75.1 | 39.1 |
<sub>Matilda Decision: our run with the official 0.3 kit. Others: Decision Index 0.3 board, public results
(area scores computed from the board's per-benchmark results with the kit's own scoring).</sub>
## Quickstart
```bash
pip install "transformers==5.17.0" torch torchvision pillow safetensors
pip install flash-linear-attention # optional: fast GPU kernels for the linear-attention layers
```
```python
import json
from transformers import AutoModel
model = AutoModel.from_pretrained("Maincode/matilda-decision-v1", trust_remote_code=True)
# Text
result = model.system_one(
state="The order arrived damaged yesterday. The customer has a receipt and asks for a replacement today.",
questions={
"route": {
"type": "choice",
"instructions": "Which team should handle this request?",
"criteria": {
"returns": "Refunds, replacements and damaged deliveries",
"billing": "Payments, invoices and charges",
"technical": "Product setup and faults",
},
},
"receipt": {"type": "noul", "instructions": "Does the customer have a receipt?"},
"urgency": {
"type": "score",
"instructions": "How urgent is this request?",
"criteria": ["Routine", "Soon", "Today"],
},
},
)
print(json.dumps(result["answers"], indent=2))
# Text and images
result = model.system_one(
state="The customer says the blender arrived cracked and attached the receipt.",
images=["receipt.png"], # local paths, http(s) URLs, PIL images or base64 data URLs
questions={
"on_receipt": {"type": "noul", "instructions": "Does the receipt list the blender?"},
"payment": {
"type": "choice",
"instructions": "How was the order paid?",
"criteria": {"card": None, "cash": None, "gift card": None},
},
},
)
print(json.dumps(result["answers"], indent=2))
```
`from_pretrained` takes `device` (default `cuda:0` when a GPU is visible) and `max_image_pixels` (see
[Images](#images)).
## Requests and answers
`system_one(state=..., questions={id: question, ...}, images=[...])` returns
`{"model", "answers": {id: answer}, "usage"}`. Every question sees the same state and images.
| `type` | `criteria` | answer |
| --- | --- | --- |
| `choice` | `{option: description or None}`, 1–255 options | `choice`, `probabilities` per option, `confidence` |
| `noul` | optional `{"true": ..., "false": ...}` descriptions | `noul`: the probability of yes / true |
| `score` | level descriptions, lowest first | `score` (expected level), `probabilities`, `legend`, `confidence` |
`instructions` is the question text. `state` can be a string or any JSON value. It is read as data, not as
instructions. Inputs are never truncated: a request over 131,072 tokens raises an error.
## Images
- **Size:** each image is resized, keeping its aspect ratio, to at most **1,638,400 pixels (1.6 MP, about
1280 × 1280)** and at least 65,536. All the results above were measured at this setting, which is the default
in the runtime and in `processor_config.json`.
- **Tokens:** one input token per 32 × 32 pixel patch, so about 1,600 for a 1.6 MP image and about 260 for
512 × 512.
- **Order:** images go before the text, in the order given.
- **Lower cap:** for speed or memory, use `AutoModel.from_pretrained(..., max_image_pixels=...)`. Expect lower
accuracy on fine detail such as charts, documents and small text. Caps above 1.6 MP are not validated.
## Architecture
Qwen3.8-27B vision-language backbone with a 255-option decision readout. Each question takes one forward pass, and its answer is read from the final prompt position.
**Training:** post-trained from Qwen3.8-27B in several stages: supervised fine-tuning on decisions across text and images, then reinforcement learning.
The model was trained with **bidirectional attention**: its full-attention layers see the whole prompt at once,
rather than only the tokens before each position. **It must be served the same way.** `trust_remote_code=True`
loads the bundled runtime (`matilda_decision_runtime.py`), which sets this up. Loading the weights as a plain causal backbone, or serving them in a causal engine, gives different and worse answers.
## License
Apache-2.0 ([LICENSE](LICENSE)). Built on [Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B) (Apache-2.0).
|