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"
File size: 10,734 Bytes
c09c091 40eec2b c09c091 40eec2b c09c091 f942684 c09c091 6122722 f942684 6122722 c09c091 5a53894 6122722 5a53894 c09c091 40eec2b c09c091 | 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 | ---
license: apache-2.0
license_link: LICENSE
base_model:
- Cloudflare/clairic-flash
base_model_relation: quantized
library_name: mlx
pipeline_tag: text-generation
tags:
- mlx
- quantized
- clairic
- qwen3_5
---
<div align="center">
<img class="block dark:hidden mx-auto" src="https://raw.githubusercontent.com/XylolabsInc/tensix-bfp-gptq/main/assets/xylolabs-lockup.svg" alt="Xylolabs" width="256" height="40">
<img class="hidden dark:block mx-auto" src="https://raw.githubusercontent.com/XylolabsInc/tensix-bfp-gptq/main/assets/xylolabs-lockup-dark.svg" alt="Xylolabs" width="256" height="40">
<h1>Clairic Flash MLX 8-bit</h1>
[](https://huggingface.co/Cloudflare/clairic-flash)
[](#accuracy)
[](https://huggingface.co/Xylolabs/clairic-flash-MLX-8bit/blob/main/LICENSE)
[](https://github.com/ml-explore/mlx-lm)
</div>
The language model of [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (9B, Qwen3.5 architecture) converted to 8-bit [MLX](https://github.com/ml-explore/mlx) for `mlx-lm`; the vision tower and the scoring head of the original are not included.
## How to run
```sh
pip install mlx-lm==0.32.2
mlx_lm.generate --model Xylolabs/clairic-flash-MLX-8bit --prompt 'Summarize the invoice: Northwind Supply, 2026-09-02, pens and paper, total $1080.00.'
mlx_lm.chat --model Xylolabs/clairic-flash-MLX-8bit
```
## Accuracy
Mean KL divergence from BF16 (lower is better) and top-1 agreement with BF16.
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|---|---:|---:|---:|---:|---:|---:|---:|
| MLX 8-bit | 9.51 GB | 0.001655 | 98.848% | 0.004075 | 98.461% | 0.000569 | 99.039% |
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/Xylolabs/clairic-flash-MLX-8bit/resolve/main/accuracy-kl-dark.png">
<img src="https://huggingface.co/Xylolabs/clairic-flash-MLX-8bit/resolve/main/accuracy-kl.png" alt="Mean KL divergence by file size">
</picture>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/Xylolabs/clairic-flash-MLX-8bit/resolve/main/accuracy-top1-dark.png">
<img src="https://huggingface.co/Xylolabs/clairic-flash-MLX-8bit/resolve/main/accuracy-top1.png" alt="Top-1 agreement by file size">
</picture>
## Which file for your hardware
A file fits when its size plus the KV cache at that context (f16) plus 2 GB for the runtime is under 75% of the memory, the default macOS GPU limit.
| Hardware | Memory | File | Context |
|---|---|---|---:|
| Mac Studio M5 Max, 32-core GPU | 36 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Max, 40-core GPU | 48 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Max, 40-core GPU | 64 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Ultra | 96 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Max, 40-core GPU | 128 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Ultra | 256 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
| Mac Studio M5 Ultra, 80-core GPU | 512 GB unified | `Xylolabs/clairic-flash-MLX-8bit` (8-bit, 9.5 GB) | 256K |
## License and notices
These files are under the Apache License 2.0, copied in `LICENSE` (Cloudflare's text); the original model is Cloudflare's, itself built on Qwen/Qwen3.5-9B (Apache-2.0). We quantized the language-model weights to MLX 8-bit with mlx-lm and left out the vision tower, the scoring head and the Python runtime. The source revision and what was changed are in `ORIGINS.md` and `NOTICE`. Not affiliated with or endorsed by Cloudflare.
## Updates
- 2026-11-22: Added a hardware recommendation table.
- 2026-11-22: First release.
## Cloudflare's original model description
Below is the model card of [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (Apache-2.0), without its metadata header and unchanged.
# Clairic Flash
Clairic Flash is a 9B multimodal model that turns a state and a schema of typed fields
into structured answers. It supports text and image inputs, extraction, numerical
estimation, and forecasting. Each field has its own value and scoring information;
the response also reports input truncation and token usage.
See [Clairic](https://huggingface.co/Cloudflare/clairic) for the other model
in the Clairic family.
## Model
- **Base model:** [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B).
- **Inputs:** a text or JSON state, optional images, and a mapping of field names to specifications.
- **Outputs:** typed values, lists, nulls, estimates, and forecast paths.
- **Scoring:** extraction confidence and null probabilities, plus optional quantiles for estimates.
- **Runtime:** PyTorch and Transformers, with local Python request helpers.
## Usage
Use Python 3.11 or later and install the packages listed in `requirements.txt`. Inference uses PyTorch and
Transformers; `xgrammar` supplies schema constraints through a Transformers logits
processor.
Download the repository, load the model and processor, and call `systemone` with a
System One: Extract request.
```python
import sys
from huggingface_hub import snapshot_download
path = snapshot_download("Cloudflare/clairic-flash")
sys.path.insert(0, path)
from clairic_model import load_release_model, systemone
model, processor = load_release_model(path, device="cuda")
response = systemone(
model,
processor,
{
"state": (
"Invoice from Northwind Supply. Issued 2026-09-02. "
"Items: Pens; Paper. Total: $1080.00."
),
"fields": {
"vendor": {"type": "text", "instructions": "The invoice vendor."},
"total": {"type": "number", "decimals": 2},
"issued": {"type": "date"},
"items": {
"type": "list",
"items": "text",
"instructions": "The purchased item names, in order.",
},
},
},
)
print(response["answers"])
```
### Images
Pass PIL images alongside the state. Embedded base64 image inputs are also accepted.
```python
from PIL import Image
response = systemone(
model,
processor,
{
"state": "Read the attached receipt.",
"images": [Image.open("receipt.png")],
"fields": {
"merchant": {"type": "text", "instructions": "The merchant name."},
"total": {"type": "number", "decimals": 2},
},
},
)
print(response["answers"])
```
### Estimates and forecasts
Declare a range for estimated values. Forecasts also specify a horizon and interval.
Set `include_quantiles` to return the available quantiles.
```python
response = systemone(
model,
processor,
{
"state": "Daily demand for the last seven days: 41, 45, 43, 47, 49, 46, 48.",
"fields": {
"next_day": {"type": "estimate", "min": 0, "max": 100},
"next_three_days": {
"type": "forecast",
"min": 0,
"max": 100,
"horizon": 3,
"interval": "day",
},
},
"options": {"include_quantiles": True},
},
)
print(response["answers"])
```
## Input format
| Field | Description |
|---|---|
| `model` | Optional `clairic-flash` or `@cf/cloudflare/clairic-flash` |
| `state` | Source text; the Python helper serializes JSON values to text |
| `images` | Optional PIL images or embedded base64 images |
| `documents` | Optional embedded PDF data URIs or `content_type` / `base64` objects |
| `fields` | Mapping of output field names to typed specifications |
| `reference_date` | Optional ISO date for relative date instructions |
| `options.include_quantiles` | Include available estimate and forecast quantiles |
| `options.return_state_text` | Include the retained source text in the response |
Field specifications support `text`, `number`, `date`, `time`, `datetime`, `duration`,
`boolean`, `enum`, `object`, `list`, `compute`, `estimate`, and `forecast`.
`instructions` describes what to return. Numeric fields can specify units and
rounding; lists declare their item schema; estimates and forecasts require bounds.
`nullable` defaults to true. `source_only: true` selects literal printed numbers,
dates, times, datetimes, or number/date lists. `knowledge: true` permits knowledge
answers for text, numbers, and supported list children. `compute` selects the typed
numeric head. Unsupported options and invalid combinations are rejected.
Embedded inputs are limited to 4 MiB each and 8 MiB combined. Images and rendered
PDF pages share a four-image/page limit. Image `rotation` accepts 0, 90, 180, or 270
clockwise degrees after EXIF orientation. Remote media URLs are not accepted.
## Response
`systemone` returns a dictionary with `model`, `answers`, `truncated`, and `usage`.
Answers are keyed by the requested field names. Generated scalar extraction answers
retain `valid`, `complete`, full-sequence `confidence`, and independently scored `p_null`.
Uniquely matched text evidence includes character spans in `state`; image-only or
ambiguous evidence has null spans. Lists preserve item order and duplicates.
Estimates and forecasts include their typed values and, when requested, quantiles.
Scores are model probabilities and should be evaluated for the application's own
acceptance thresholds. Inspect `truncated` and any answer completeness indicators
before relying on a result.
Usage includes retries and supplemental work. The response model ID is `clairic-flash`.
The Python API raises validation or request errors for invalid inputs, a queue-full
error for simultaneous requests, and an inference error for failed generation.
Use `await model.predict_async(request)` in an async application; cancellation
drains owned work before admitting another request.
## Files
| File | Purpose |
|---|---|
| `model*.safetensors`, `model.safetensors.index.json`, `config.json` | Model weights and configuration |
| `clair_head.safetensors`, `clair_head_config.json` | Typed output components |
| `clairic_model.py` and supporting Python modules | Transformers loading and request handling |
| Tokenizer and processor files | Text and image preprocessing |
| `requirements.txt` | Python dependencies |
| `LICENSE` | Apache-2.0 license |
## License
Released under the Apache-2.0 license.
|