Image-Text-to-Text
Transformers
Safetensors
English
qwen3_5
physics
science
reasoning
math
qwen3.5
conversational
Instructions to use FirstPrinciplesLabs/quark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FirstPrinciplesLabs/quark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="FirstPrinciplesLabs/quark") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("FirstPrinciplesLabs/quark") model = AutoModelForMultimodalLM.from_pretrained("FirstPrinciplesLabs/quark", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FirstPrinciplesLabs/quark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FirstPrinciplesLabs/quark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FirstPrinciplesLabs/quark", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/FirstPrinciplesLabs/quark
- SGLang
How to use FirstPrinciplesLabs/quark with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "FirstPrinciplesLabs/quark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FirstPrinciplesLabs/quark", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "FirstPrinciplesLabs/quark" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FirstPrinciplesLabs/quark", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use FirstPrinciplesLabs/quark with Docker Model Runner:
docker model run hf.co/FirstPrinciplesLabs/quark
Matthew Tchouikine commited on
Commit Β·
b373146
1
Parent(s): ee399ef
clean up model card
Browse files
README.md
CHANGED
|
@@ -30,105 +30,79 @@ Quark is the first in a series of small, powerful scientific reasoning models. Y
|
|
| 30 |
|
| 31 |
## Results
|
| 32 |
|
| 33 |
-
Accuracy (%), measured with [EvalScope](https://github.com/modelscope/evalscope) and vLLM (the
|
| 34 |
-
llama.cpp): thinking mode, up to 131,072 output tokens, and following the Qwen3.5 model card's sampling
|
| 35 |
settings. AIME 2025 is averaged over 16 samples per problem and GPQA Diamond over 8. HLE (text-only, 2,158
|
| 36 |
questions) is graded by Qwen3.5-27B as judge.
|
| 37 |
|
| 38 |
-
| Benchmark | Qwen3.5-9B |
|
| 39 |
-
|---|---|---|---|
|
| 40 |
-
| GPQA Diamond | 81.6 |
|
| 41 |
-
| AIME 2025 | 86.9 |
|
| 42 |
-
| MMLU-Pro Physics | 90.7 | 91.0 | 91.6 |
|
| 43 |
| Humanity's Last Exam (HLE), text | 15.9 | **22.7** | 22.3 |
|
| 44 |
-
| HLE, physics subset | 8.4 |
|
| 45 |
|
| 46 |
-
All were measured by us with the same setup. The
|
| 47 |
run-to-run variation.
|
| 48 |
|
| 49 |
**Compared with other open models** (scores as reported by each developer):
|
| 50 |
|
| 51 |
| Model | Size | GPQA Diamond | AIME 2025 | HLE |
|
| 52 |
-
|---|---|---|---|---|
|
| 53 |
-
|
|
| 54 |
-
| Quark
|
| 55 |
| Qwen3-8B | 8B | 59.6 | 69.3 | 4.4 |
|
| 56 |
| NVIDIA Nemotron Nano 9B v2 | 9B | 64.0 | 72.1 | 6.5 |
|
| 57 |
| gpt-oss-20b | 21B | 71.5 | 91.7 | 10.9 |
|
| 58 |
| Qwen3.5-27B | 27B | 85.5 | β | 24.3 |
|
| 59 |
-
| Qwen3.8-27B | 27B | 89.2 | β | 30.8 |
|
| 60 |
| gpt-oss-120b | 117B | 80.1 | 92.5 | 14.9 |
|
| 61 |
| DeepSeek-R1-0528 | 671B | 81.0 | 87.5 | 17.7 |
|
| 62 |
-
| Kimi K2 Thinking | 1T | 84.5 | 94.5 | 23.9 |
|
| 63 |
|
| 64 |
-
β = not reported. Sources: each model's official model card; Quark and its
|
| 65 |
-
above), with the
|
| 66 |
|
| 67 |
-
##
|
| 68 |
|
| 69 |
-
An
|
| 70 |
-
[FirstPrinciplesLabs/quark-GGUF](https://huggingface.co/FirstPrinciplesLabs/quark-GGUF)
|
| 71 |
-
|
| 72 |
-
benchmarks.
|
| 73 |
|
| 74 |
-
##
|
| 75 |
|
| 76 |
-
Tokens per second on an NVIDIA H200 and a MacBook Pro, for the original bf16 weights and the
|
| 77 |
-
[
|
| 78 |
|
| 79 |
### llama.cpp
|
| 80 |
|
| 81 |
-
|
| 82 |
|
| 83 |
-
|
| 84 |
|
| 85 |
-
| Hardware | Context |
|
| 86 |
-
|---|---|---|---|
|
| 87 |
-
| NVIDIA H200 | empty | 216 | 185 |
|
| 88 |
-
| NVIDIA H200 | 32K | 191 | 167 |
|
| 89 |
-
| NVIDIA H200 | 100K | 156 | 139 |
|
| 90 |
-
| MacBook Pro, M4, 16 GB | empty | 11.2 | does not fit (18.4 GB) |
|
| 91 |
-
| MacBook Pro, M4, 16 GB | 32K | 8.7 | does not fit |
|
| 92 |
-
|
| 93 |
-
Prompt reading (a 512-token prompt), tokens per second:
|
| 94 |
-
|
| 95 |
-
| Hardware | Context | Q8_0 | bf16 |
|
| 96 |
-
|---|---|---|---|
|
| 97 |
-
| NVIDIA H200 | empty | 9,106 | 16,587 |
|
| 98 |
-
| NVIDIA H200 | 32K | 7,677 | 12,200 |
|
| 99 |
-
| NVIDIA H200 | 100K | 5,544 | 7,800 |
|
| 100 |
-
| MacBook Pro, M4, 16 GB | empty | 208 | does not fit |
|
| 101 |
-
| MacBook Pro, M4, 16 GB | 32K | 139 | does not fit |
|
| 102 |
-
|
| 103 |
-
Generation is limited by memory speed, where the smaller Q8_0 file is faster. Prompt reading is limited
|
| 104 |
-
by compute, where llama.cpp runs bf16 faster on NVIDIA GPUs. For thinking-mode answers, generation
|
| 105 |
-
takes most of the time.
|
| 106 |
-
|
| 107 |
-
On Apple Silicon, speed scales with memory bandwidth (about 90% of it is used), so Macs with faster
|
| 108 |
-
memory run proportionally faster. The model needs about 10 GB of memory plus room for the context;
|
| 109 |
-
16 GB Macs can run it with shorter contexts.
|
| 110 |
|
| 111 |
### vLLM
|
| 112 |
|
| 113 |
vLLM targets NVIDIA and AMD GPUs; on Macs, use llama.cpp or tools built on it.
|
| 114 |
|
| 115 |
-
With vLLM on one NVIDIA H200, 512-token prompts and 4,096-token answers in thinking mode,
|
| 116 |
-
request, tokens per second:
|
| 117 |
-
|
| 118 |
-
| Concurrent requests | bf16 | Q8_0 GGUF |
|
| 119 |
-
|---|---|---|
|
| 120 |
-
| 1 | 184 | 66 |
|
| 121 |
-
| 8 | 162 | 32 |
|
| 122 |
-
| 24 | 145 | 16 |
|
| 123 |
-
| 64 | 104 | 6.4 |
|
| 124 |
-
| 128 | 71 | 3.3 |
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
|
|
|
| 132 |
|
| 133 |
## Training data
|
| 134 |
|
|
@@ -154,7 +128,7 @@ ollama run firstprinciples/quark
|
|
| 154 |
Recommended sampling (from the Qwen3.5 model card):
|
| 155 |
|
| 156 |
| | Thinking (default) | Non-thinking |
|
| 157 |
-
|---|---|---|
|
| 158 |
| `chat_template_kwargs` | `{"enable_thinking": true}` | `{"enable_thinking": false}` |
|
| 159 |
| temperature / top_p / top_k | 1.0 / 0.95 / 20 | 1.0 / 1.0 / 40 |
|
| 160 |
| presence penalty | 1.5 | 2.0 |
|
|
@@ -168,7 +142,7 @@ A hard problem from AIME 2025 (II, problem 15), in thinking mode with the recomm
|
|
| 168 |
> There exist exactly three positive real values of \\(k\\) such that \\(f\\) has a minimum at exactly two real values of \\(x\\). Find the sum of these three values of \\(k\\).
|
| 169 |
|
| 170 |
| | Qwen3.5-9B | **Quark** |
|
| 171 |
-
|---|---|---|
|
| 172 |
| Correct, out of 16 attempts | 1 | **10** |
|
| 173 |
| Most common answer | 188 β (14 of 16 attempts) | **240 β** |
|
| 174 |
| Approach | Finds no way in and guesses that k must be one of the existing roots: 18 + 72 + 98 = 188 | Turns "a minimum at two points" into an equation for k and solves it |
|
|
@@ -176,22 +150,25 @@ A hard problem from AIME 2025 (II, problem 15), in thinking mode with the recomm
|
|
| 176 |
**How Quark solves it** (summarised from its answer):
|
| 177 |
|
| 178 |
1. If the minimum value \\(m\\) is reached at two points \\(u\\) and \\(v\\), the numerator minus \\(mx\\) must be a perfect square:
|
|
|
|
| 179 |
$$
|
| 180 |
(x-18)(x-72)(x-98)(x-k)-mx=(x-u)^2(x-v)^2 .
|
| 181 |
$$
|
| 182 |
-
|
|
|
|
|
|
|
| 183 |
$$
|
| 184 |
(k^2-376k-5120)^2 = 8128512\,k .
|
| 185 |
$$
|
| 186 |
-
|
| 187 |
-
|
|
|
|
| 188 |
|
| 189 |
Both models' full written answers (each follows several thousand tokens of reasoning, not shown):
|
| 190 |
|
| 191 |
<details>
|
| 192 |
<summary><b>Quark</b>: 240 (correct)</summary>
|
| 193 |
|
| 194 |
-
|
| 195 |
We interpret β \\(f\\) has a minimum at exactly two real values of \\(x\\)β as meaning that the minimum value is attained at exactly two distinct \\(x\\)-values (the intended interpretation; otherwise \\(f\\) has no global minimum on all real \\(x\neq0\\)).
|
| 196 |
|
| 197 |
Let
|
|
@@ -341,13 +318,11 @@ $$
|
|
| 341 |
\boxed{240}
|
| 342 |
$$
|
| 343 |
|
| 344 |
-
|
| 345 |
</details>
|
| 346 |
|
| 347 |
<details>
|
| 348 |
<summary><b>Qwen3.5-9B</b>: 188 (incorrect)</summary>
|
| 349 |
|
| 350 |
-
|
| 351 |
The function is given by \\(f(x)=\frac{(x-18)(x-72)(x-98)(x-k)}{x}\\).
|
| 352 |
|
| 353 |
We are looking for the number of local minima.
|
|
|
|
| 30 |
|
| 31 |
## Results
|
| 32 |
|
| 33 |
+
Accuracy (%), measured with [EvalScope](https://github.com/modelscope/evalscope) and vLLM (the int8 version
|
| 34 |
+
with llama.cpp): thinking mode, up to 131,072 output tokens, and following the Qwen3.5 model card's sampling
|
| 35 |
settings. AIME 2025 is averaged over 16 samples per problem and GPQA Diamond over 8. HLE (text-only, 2,158
|
| 36 |
questions) is graded by Qwen3.5-27B as judge.
|
| 37 |
|
| 38 |
+
| Benchmark | Qwen3.5-9B | Quark (bf16) | Quark ([int8](#int8-version)) |
|
| 39 |
+
| --- | --- | --- | --- |
|
| 40 |
+
| GPQA Diamond | 81.6 | 87.4 | **87.8** |
|
| 41 |
+
| AIME 2025 | 86.9 | 91.7 | **94.0** |
|
| 42 |
+
| MMLU-Pro Physics | 90.7 | 91.0 | **91.6** |
|
| 43 |
| Humanity's Last Exam (HLE), text | 15.9 | **22.7** | 22.3 |
|
| 44 |
+
| HLE, physics subset | 8.4 | 15.8 | **16.3** |
|
| 45 |
|
| 46 |
+
All were measured by us with the same setup. The int8 version matches Quark: the differences are within
|
| 47 |
run-to-run variation.
|
| 48 |
|
| 49 |
**Compared with other open models** (scores as reported by each developer):
|
| 50 |
|
| 51 |
| Model | Size | GPQA Diamond | AIME 2025 | HLE |
|
| 52 |
+
| --- | --- | --- | --- | --- |
|
| 53 |
+
| Quark (fp16) | 9B | 87.4 | 91.7 | 22.7 |
|
| 54 |
+
| Quark (int8) | 9B | 87.8 | 94.0 | 22.3 |
|
| 55 |
| Qwen3-8B | 8B | 59.6 | 69.3 | 4.4 |
|
| 56 |
| NVIDIA Nemotron Nano 9B v2 | 9B | 64.0 | 72.1 | 6.5 |
|
| 57 |
| gpt-oss-20b | 21B | 71.5 | 91.7 | 10.9 |
|
| 58 |
| Qwen3.5-27B | 27B | 85.5 | β | 24.3 |
|
| 59 |
+
| Qwen3.8-27B | 27B | **89.2** | β | **30.8** |
|
| 60 |
| gpt-oss-120b | 117B | 80.1 | 92.5 | 14.9 |
|
| 61 |
| DeepSeek-R1-0528 | 671B | 81.0 | 87.5 | 17.7 |
|
| 62 |
+
| Kimi K2 Thinking | 1T | 84.5 | **94.5** | 23.9 |
|
| 63 |
|
| 64 |
+
β = not reported. Sources: each model's official model card; Quark (bf16) and its int8 version measured by us
|
| 65 |
+
(see above), with the int8 version's differences from Quark within run-to-run variation.
|
| 66 |
|
| 67 |
+
## int8 version
|
| 68 |
|
| 69 |
+
An int8 version for llama.cpp, Ollama and LM Studio (in their GGUF format) is available at
|
| 70 |
+
[FirstPrinciplesLabs/quark-GGUF](https://huggingface.co/FirstPrinciplesLabs/quark-GGUF). Its accuracy is
|
| 71 |
+
in the [Results](#results) table: it matches Quark on all benchmarks.
|
|
|
|
| 72 |
|
| 73 |
+
## Throughput
|
| 74 |
|
| 75 |
+
Tokens per second on an NVIDIA H200 and a MacBook Pro, for the original bf16 weights and the
|
| 76 |
+
[int8 version](#int8-version).
|
| 77 |
|
| 78 |
### llama.cpp
|
| 79 |
|
| 80 |
+
Throughput for a single user with llama.cpp, by how much context is already filled.
|
| 81 |
|
| 82 |
+
Output generation, tokens per second:
|
| 83 |
|
| 84 |
+
| Hardware | Context | int8 | bf16 |
|
| 85 |
+
| --- | --- | --- | --- |
|
| 86 |
+
| NVIDIA H200 | empty | **216** | 185 |
|
| 87 |
+
| NVIDIA H200 | 32K | **191** | 167 |
|
| 88 |
+
| NVIDIA H200 | 100K | **156** | 139 |
|
| 89 |
+
| MacBook Pro, M4, 16 GB | empty | **11.2** | does not fit (18.4 GB) |
|
| 90 |
+
| MacBook Pro, M4, 16 GB | 32K | **8.7** | does not fit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
### vLLM
|
| 93 |
|
| 94 |
vLLM targets NVIDIA and AMD GPUs; on Macs, use llama.cpp or tools built on it.
|
| 95 |
|
| 96 |
+
With vLLM on one NVIDIA H200 (bf16 weights), 512-token prompts and 4,096-token answers in thinking mode,
|
| 97 |
+
throughput of each request, tokens per second:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
| Concurrent requests | Throughput per request |
|
| 100 |
+
| --- | --- |
|
| 101 |
+
| 1 | 184 |
|
| 102 |
+
| 8 | 162 |
|
| 103 |
+
| 24 | 145 |
|
| 104 |
+
| 64 | 104 |
|
| 105 |
+
| 128 | 71 |
|
| 106 |
|
| 107 |
## Training data
|
| 108 |
|
|
|
|
| 128 |
Recommended sampling (from the Qwen3.5 model card):
|
| 129 |
|
| 130 |
| | Thinking (default) | Non-thinking |
|
| 131 |
+
| --- | --- | --- |
|
| 132 |
| `chat_template_kwargs` | `{"enable_thinking": true}` | `{"enable_thinking": false}` |
|
| 133 |
| temperature / top_p / top_k | 1.0 / 0.95 / 20 | 1.0 / 1.0 / 40 |
|
| 134 |
| presence penalty | 1.5 | 2.0 |
|
|
|
|
| 142 |
> There exist exactly three positive real values of \\(k\\) such that \\(f\\) has a minimum at exactly two real values of \\(x\\). Find the sum of these three values of \\(k\\).
|
| 143 |
|
| 144 |
| | Qwen3.5-9B | **Quark** |
|
| 145 |
+
| --- | --- | --- |
|
| 146 |
| Correct, out of 16 attempts | 1 | **10** |
|
| 147 |
| Most common answer | 188 β (14 of 16 attempts) | **240 β** |
|
| 148 |
| Approach | Finds no way in and guesses that k must be one of the existing roots: 18 + 72 + 98 = 188 | Turns "a minimum at two points" into an equation for k and solves it |
|
|
|
|
| 150 |
**How Quark solves it** (summarised from its answer):
|
| 151 |
|
| 152 |
1. If the minimum value \\(m\\) is reached at two points \\(u\\) and \\(v\\), the numerator minus \\(mx\\) must be a perfect square:
|
| 153 |
+
|
| 154 |
$$
|
| 155 |
(x-18)(x-72)(x-98)(x-k)-mx=(x-u)^2(x-v)^2 .
|
| 156 |
$$
|
| 157 |
+
|
| 158 |
+
1. Matching coefficients and eliminating \\(u\\) and \\(v\\) leaves one equation in \\(k\\):
|
| 159 |
+
|
| 160 |
$$
|
| 161 |
(k^2-376k-5120)^2 = 8128512\,k .
|
| 162 |
$$
|
| 163 |
+
|
| 164 |
+
1. It factors as \\((k-8)(k-32)(k-200)(k-512)=0\\), and checking the sign before squaring rules out \\(k=512\\).
|
| 165 |
+
2. So \\(k = 8, 32, 200\\), and the answer is **240**.
|
| 166 |
|
| 167 |
Both models' full written answers (each follows several thousand tokens of reasoning, not shown):
|
| 168 |
|
| 169 |
<details>
|
| 170 |
<summary><b>Quark</b>: 240 (correct)</summary>
|
| 171 |
|
|
|
|
| 172 |
We interpret β \\(f\\) has a minimum at exactly two real values of \\(x\\)β as meaning that the minimum value is attained at exactly two distinct \\(x\\)-values (the intended interpretation; otherwise \\(f\\) has no global minimum on all real \\(x\neq0\\)).
|
| 173 |
|
| 174 |
Let
|
|
|
|
| 318 |
\boxed{240}
|
| 319 |
$$
|
| 320 |
|
|
|
|
| 321 |
</details>
|
| 322 |
|
| 323 |
<details>
|
| 324 |
<summary><b>Qwen3.5-9B</b>: 188 (incorrect)</summary>
|
| 325 |
|
|
|
|
| 326 |
The function is given by \\(f(x)=\frac{(x-18)(x-72)(x-98)(x-k)}{x}\\).
|
| 327 |
|
| 328 |
We are looking for the number of local minima.
|