Instructions to use Xylolabs/clairic-flash-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Xylolabs/clairic-flash-MLX-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("Xylolabs/clairic-flash-MLX-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use Xylolabs/clairic-flash-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/clairic-flash-MLX-8bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Xylolabs/clairic-flash-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Xylolabs/clairic-flash-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Xylolabs/clairic-flash-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Xylolabs/clairic-flash-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Xylolabs/clairic-flash-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Xylolabs/clairic-flash-MLX-8bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/clairic-flash-MLX-8bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Xylolabs/clairic-flash-MLX-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Xylolabs/clairic-flash-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/clairic-flash-MLX-8bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "Xylolabs/clairic-flash-MLX-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
docs(card): 📝 cut disclaimers and the copied upstream description
Browse files
README.md
CHANGED
|
@@ -40,7 +40,7 @@ mlx_lm.chat --model Xylolabs/clairic-flash-MLX-8bit
|
|
| 40 |
|
| 41 |
## Accuracy
|
| 42 |
|
| 43 |
-
|
| 44 |
|
| 45 |
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|
| 46 |
|---|---:|---:|---:|---:|---:|---:|---:|
|
|
@@ -72,183 +72,9 @@ A file fits when its size plus the KV cache at that context (f16) plus 2 GB for
|
|
| 72 |
|
| 73 |
## License and notices
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
## Updates
|
| 78 |
|
| 79 |
- 2026-11-22: Added a hardware recommendation table.
|
| 80 |
- 2026-11-22: First release.
|
| 81 |
-
|
| 82 |
-
## Cloudflare's original model description
|
| 83 |
-
|
| 84 |
-
Below is the model card of [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (Apache-2.0), without its metadata header and unchanged.
|
| 85 |
-
|
| 86 |
-
# Clairic Flash
|
| 87 |
-
|
| 88 |
-
Clairic Flash is a 9B multimodal model that turns a state and a schema of typed fields
|
| 89 |
-
into structured answers. It supports text and image inputs, extraction, numerical
|
| 90 |
-
estimation, and forecasting. Each field has its own value and scoring information;
|
| 91 |
-
the response also reports input truncation and token usage.
|
| 92 |
-
|
| 93 |
-
See [Clairic](https://huggingface.co/Cloudflare/clairic) for the other model
|
| 94 |
-
in the Clairic family.
|
| 95 |
-
|
| 96 |
-
## Model
|
| 97 |
-
|
| 98 |
-
- **Base model:** [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B).
|
| 99 |
-
- **Inputs:** a text or JSON state, optional images, and a mapping of field names to specifications.
|
| 100 |
-
- **Outputs:** typed values, lists, nulls, estimates, and forecast paths.
|
| 101 |
-
- **Scoring:** extraction confidence and null probabilities, plus optional quantiles for estimates.
|
| 102 |
-
- **Runtime:** PyTorch and Transformers, with local Python request helpers.
|
| 103 |
-
|
| 104 |
-
## Usage
|
| 105 |
-
|
| 106 |
-
Use Python 3.11 or later and install the packages listed in `requirements.txt`. Inference uses PyTorch and
|
| 107 |
-
Transformers; `xgrammar` supplies schema constraints through a Transformers logits
|
| 108 |
-
processor.
|
| 109 |
-
|
| 110 |
-
Download the repository, load the model and processor, and call `systemone` with a
|
| 111 |
-
System One: Extract request.
|
| 112 |
-
|
| 113 |
-
```python
|
| 114 |
-
import sys
|
| 115 |
-
|
| 116 |
-
from huggingface_hub import snapshot_download
|
| 117 |
-
|
| 118 |
-
path = snapshot_download("Cloudflare/clairic-flash")
|
| 119 |
-
sys.path.insert(0, path)
|
| 120 |
-
from clairic_model import load_release_model, systemone
|
| 121 |
-
|
| 122 |
-
model, processor = load_release_model(path, device="cuda")
|
| 123 |
-
|
| 124 |
-
response = systemone(
|
| 125 |
-
model,
|
| 126 |
-
processor,
|
| 127 |
-
{
|
| 128 |
-
"state": (
|
| 129 |
-
"Invoice from Northwind Supply. Issued 2026-09-02. "
|
| 130 |
-
"Items: Pens; Paper. Total: $1080.00."
|
| 131 |
-
),
|
| 132 |
-
"fields": {
|
| 133 |
-
"vendor": {"type": "text", "instructions": "The invoice vendor."},
|
| 134 |
-
"total": {"type": "number", "decimals": 2},
|
| 135 |
-
"issued": {"type": "date"},
|
| 136 |
-
"items": {
|
| 137 |
-
"type": "list",
|
| 138 |
-
"items": "text",
|
| 139 |
-
"instructions": "The purchased item names, in order.",
|
| 140 |
-
},
|
| 141 |
-
},
|
| 142 |
-
},
|
| 143 |
-
)
|
| 144 |
-
print(response["answers"])
|
| 145 |
-
```
|
| 146 |
-
|
| 147 |
-
### Images
|
| 148 |
-
|
| 149 |
-
Pass PIL images alongside the state. Embedded base64 image inputs are also accepted.
|
| 150 |
-
|
| 151 |
-
```python
|
| 152 |
-
from PIL import Image
|
| 153 |
-
|
| 154 |
-
response = systemone(
|
| 155 |
-
model,
|
| 156 |
-
processor,
|
| 157 |
-
{
|
| 158 |
-
"state": "Read the attached receipt.",
|
| 159 |
-
"images": [Image.open("receipt.png")],
|
| 160 |
-
"fields": {
|
| 161 |
-
"merchant": {"type": "text", "instructions": "The merchant name."},
|
| 162 |
-
"total": {"type": "number", "decimals": 2},
|
| 163 |
-
},
|
| 164 |
-
},
|
| 165 |
-
)
|
| 166 |
-
print(response["answers"])
|
| 167 |
-
```
|
| 168 |
-
|
| 169 |
-
### Estimates and forecasts
|
| 170 |
-
|
| 171 |
-
Declare a range for estimated values. Forecasts also specify a horizon and interval.
|
| 172 |
-
Set `include_quantiles` to return the available quantiles.
|
| 173 |
-
|
| 174 |
-
```python
|
| 175 |
-
response = systemone(
|
| 176 |
-
model,
|
| 177 |
-
processor,
|
| 178 |
-
{
|
| 179 |
-
"state": "Daily demand for the last seven days: 41, 45, 43, 47, 49, 46, 48.",
|
| 180 |
-
"fields": {
|
| 181 |
-
"next_day": {"type": "estimate", "min": 0, "max": 100},
|
| 182 |
-
"next_three_days": {
|
| 183 |
-
"type": "forecast",
|
| 184 |
-
"min": 0,
|
| 185 |
-
"max": 100,
|
| 186 |
-
"horizon": 3,
|
| 187 |
-
"interval": "day",
|
| 188 |
-
},
|
| 189 |
-
},
|
| 190 |
-
"options": {"include_quantiles": True},
|
| 191 |
-
},
|
| 192 |
-
)
|
| 193 |
-
print(response["answers"])
|
| 194 |
-
```
|
| 195 |
-
|
| 196 |
-
## Input format
|
| 197 |
-
|
| 198 |
-
| Field | Description |
|
| 199 |
-
|---|---|
|
| 200 |
-
| `model` | Optional `clairic-flash` or `@cf/cloudflare/clairic-flash` |
|
| 201 |
-
| `state` | Source text; the Python helper serializes JSON values to text |
|
| 202 |
-
| `images` | Optional PIL images or embedded base64 images |
|
| 203 |
-
| `documents` | Optional embedded PDF data URIs or `content_type` / `base64` objects |
|
| 204 |
-
| `fields` | Mapping of output field names to typed specifications |
|
| 205 |
-
| `reference_date` | Optional ISO date for relative date instructions |
|
| 206 |
-
| `options.include_quantiles` | Include available estimate and forecast quantiles |
|
| 207 |
-
| `options.return_state_text` | Include the retained source text in the response |
|
| 208 |
-
|
| 209 |
-
Field specifications support `text`, `number`, `date`, `time`, `datetime`, `duration`,
|
| 210 |
-
`boolean`, `enum`, `object`, `list`, `compute`, `estimate`, and `forecast`.
|
| 211 |
-
`instructions` describes what to return. Numeric fields can specify units and
|
| 212 |
-
rounding; lists declare their item schema; estimates and forecasts require bounds.
|
| 213 |
-
`nullable` defaults to true. `source_only: true` selects literal printed numbers,
|
| 214 |
-
dates, times, datetimes, or number/date lists. `knowledge: true` permits knowledge
|
| 215 |
-
answers for text, numbers, and supported list children. `compute` selects the typed
|
| 216 |
-
numeric head. Unsupported options and invalid combinations are rejected.
|
| 217 |
-
|
| 218 |
-
Embedded inputs are limited to 4 MiB each and 8 MiB combined. Images and rendered
|
| 219 |
-
PDF pages share a four-image/page limit. Image `rotation` accepts 0, 90, 180, or 270
|
| 220 |
-
clockwise degrees after EXIF orientation. Remote media URLs are not accepted.
|
| 221 |
-
|
| 222 |
-
## Response
|
| 223 |
-
|
| 224 |
-
`systemone` returns a dictionary with `model`, `answers`, `truncated`, and `usage`.
|
| 225 |
-
Answers are keyed by the requested field names. Generated scalar extraction answers
|
| 226 |
-
retain `valid`, `complete`, full-sequence `confidence`, and independently scored `p_null`.
|
| 227 |
-
Uniquely matched text evidence includes character spans in `state`; image-only or
|
| 228 |
-
ambiguous evidence has null spans. Lists preserve item order and duplicates.
|
| 229 |
-
Estimates and forecasts include their typed values and, when requested, quantiles.
|
| 230 |
-
|
| 231 |
-
Scores are model probabilities and should be evaluated for the application's own
|
| 232 |
-
acceptance thresholds. Inspect `truncated` and any answer completeness indicators
|
| 233 |
-
before relying on a result.
|
| 234 |
-
|
| 235 |
-
Usage includes retries and supplemental work. The response model ID is `clairic-flash`.
|
| 236 |
-
The Python API raises validation or request errors for invalid inputs, a queue-full
|
| 237 |
-
error for simultaneous requests, and an inference error for failed generation.
|
| 238 |
-
Use `await model.predict_async(request)` in an async application; cancellation
|
| 239 |
-
drains owned work before admitting another request.
|
| 240 |
-
|
| 241 |
-
## Files
|
| 242 |
-
|
| 243 |
-
| File | Purpose |
|
| 244 |
-
|---|---|
|
| 245 |
-
| `model*.safetensors`, `model.safetensors.index.json`, `config.json` | Model weights and configuration |
|
| 246 |
-
| `clair_head.safetensors`, `clair_head_config.json` | Typed output components |
|
| 247 |
-
| `clairic_model.py` and supporting Python modules | Transformers loading and request handling |
|
| 248 |
-
| Tokenizer and processor files | Text and image preprocessing |
|
| 249 |
-
| `requirements.txt` | Python dependencies |
|
| 250 |
-
| `LICENSE` | Apache-2.0 license |
|
| 251 |
-
|
| 252 |
-
## License
|
| 253 |
-
|
| 254 |
-
Released under the Apache-2.0 license.
|
|
|
|
| 40 |
|
| 41 |
## Accuracy
|
| 42 |
|
| 43 |
+
Against BF16.
|
| 44 |
|
| 45 |
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|
| 46 |
|---|---:|---:|---:|---:|---:|---:|---:|
|
|
|
|
| 72 |
|
| 73 |
## License and notices
|
| 74 |
|
| 75 |
+
Apache License 2.0, copied in `LICENSE`. We quantized the language-model weights to MLX 8-bit; the vision tower, scoring head and Python runtime are left out.
|
| 76 |
|
| 77 |
## Updates
|
| 78 |
|
| 79 |
- 2026-11-22: Added a hardware recommendation table.
|
| 80 |
- 2026-11-22: First release.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|