File size: 16,189 Bytes
6b4406a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3e16858
ee399ef
2720954
6b4406a
2720954
6b4406a
a524ab1
6b4406a
e28c0d4
edb8ddd
396e664
51ac27b
6b4406a
03c78ed
787bc74
7f5699e
 
51ac27b
7f5699e
 
51ac27b
 
 
7f5699e
 
 
6b4406a
 
10fa12c
b373146
4d98655
 
 
10fa12c
b373146
 
 
 
4d98655
b373146
4d98655
935908a
6b4406a
96c32f4
6b4406a
 
b373146
 
10fa12c
6b4406a
ac2bbf0
6b4406a
 
 
b373146
6b4406a
 
b373146
6b4406a
10fa12c
935908a
4d98655
ac2bbf0
 
07f5950
 
51ac27b
07f5950
51ac27b
 
07f5950
 
 
 
 
 
 
 
 
10fa12c
4d98655
edb8ddd
4620245
725cb1d
 
4d98655
b373146
4d98655
b373146
10fa12c
4d98655
 
 
935908a
4d98655
 
10fa12c
b373146
 
 
 
 
 
4d98655
6669a0d
 
 
3bad1a3
 
 
 
 
6669a0d
6b4406a
 
2720954
a524ab1
f491b03
 
151510a
 
6b4406a
 
 
2720954
6b4406a
e06240b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57bb2cc
e06240b
6b4406a
2720954
6b4406a
 
 
03c78ed
 
 
 
 
 
725cb1d
 
 
 
 
 
 
 
 
10fa12c
bd96215
 
4620245
bd96215
 
 
6b4406a
 
 
b373146
6b4406a
 
 
 
 
03c78ed
 
 
 
 
 
 
 
b373146
03c78ed
 
 
 
 
 
 
b373146
03c78ed
 
 
b373146
 
 
03c78ed
 
 
b373146
 
 
03c78ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b4406a
 
 
 
 
 
 
 
 
 
e28c0d4
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
---
library_name: transformers
license: apache-2.0
base_model:
- Qwen/Qwen3.5-9B
base_model_relation: finetune
pipeline_tag: image-text-to-text
language:
- en
tags:
- physics
- science
- reasoning
- math
- qwen3.5
---

![Quark by FirstPrinciples](https://huggingface.co/FirstPrinciplesLabs/quark/resolve/main/assets/quark_banner_final.png)

# Quark

Quark is a 9B reasoning model for physics, science and maths, built by [FirstPrinciples](https://firstprinciples.com/). The base model is
[Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) with additional post-training: supervised fine-tuning on
our curated physics, maths and coding mix.

It outperforms the base model on a range of benchmarks, and reaches
graduate-level science scores comparable to much larger open models. We also quantized the model weights to 8 bits (Q8_0) for llama.cpp; this
[Q8_0 version](#q8_0-version) matches bf16 on every benchmark below. On the popular benchmark Hummanity's Last Exam (HLE, text-only) Quark is on the Pareto frontier of performance vs. model size:
no model of its size or smaller scores higher.

Quark is the first in a series of small, powerful scientific reasoning models. You can run it locally (see [Usage](#usage)) or on [Theo Platform](https://firstprinciples.com/sign-up), a research platform for complex problems, where you can use it alongside other frontier models, check its results with Python, Mathematica and Sage, and keep each session as a research graph you can revise one step at a time.

## Intended use

Quark is built for researchers working on hard problems in physics, science and maths, where the
reasoning matters as much as the answer:

- **Solve your problems:** derivations, estimates, calculations, with step by step reasoning.
- **Check your work:** a second opinion on a derivation or result. For results that matter, verify the answer
  independently with TheoVerify on [Theo Platform](https://firstprinciples.com/sign-up).
- **Private and offline research:** the Q8_0 version runs on a 16 GB Mac, so unpublished work and sensitive data
  stay on your machine.

## Results

Accuracy (%), measured with [EvalScope](https://github.com/modelscope/evalscope) and vLLM (the Q8_0 version
with llama.cpp): thinking mode, up to 131,072 output tokens, and following the Qwen3.5 model card's sampling
settings. AIME 2025 is averaged over 16 samples per problem and GPQA Diamond over 8. HLE (text-only, 2,158
questions) is graded by Qwen3.5-27B as judge.

| Benchmark | Qwen3.5-9B | Quark (bf16) | Quark ([Q8_0](#q8_0-version)) |
| --- | --- | --- | --- |
| GPQA Diamond | 81.6 | 87.4 | **87.8** |
| AIME 2025 | 86.9 | 91.7 | **94.0** |
| MMLU-Pro Physics | 90.7 | 91.0 | **91.6** |
| Humanity's Last Exam (HLE), text | 15.9 | **22.7** | 22.3 |
| HLE, physics subset | 8.4 | 15.8 | **16.3** |

All were measured by us with the same setup.

**Compared with other open models** (scores as reported by each developer):

| Model | Size | GPQA Diamond | AIME 2025 | HLE |
| --- | --- | --- | --- | --- |
| Quark (fp16) | 9B | 87.4 | 91.7 | 22.7 |
| Quark (Q8_0) | 9B | 87.8 | 94.0 | 22.3 |
| Qwen3-8B | 8B | 59.6 | 69.3 | 4.4 |
| Qwen3.5-9B | 9B | 81.7 | — | 14.9¹ |
| NVIDIA Nemotron Nano 9B v2 | 9B | 64.0 | 72.1 | 6.5 |
| gpt-oss-20b | 21B | 71.5 | 91.7 | 10.9 |
| Qwen3.5-27B | 27B | 85.5 | — | 24.3 |
| Qwen3.8-27B | 27B | **89.2** | — | **30.8** |
| gpt-oss-120b | 117B | 80.1 | 92.5 | 14.9 |
| DeepSeek-R1-0528 | 671B | 81.0 | 87.5 | 17.7 |
| Kimi K2 Thinking | 1T | 84.5 | **94.5** | 23.9 |

— = not reported. Sources: each model's official model card; Quark (bf16) and its Q8_0 version measured by us
(see above)

¹ Not reported by Qwen; measured by [Artificial Analysis](https://artificialanalysis.ai/models/qwen3-5-9b) (reasoning mode, 2,158 text-only HLE questions).

### HLE accuracy against model size

![HLE accuracy against total parameters, with the Pareto frontier](https://huggingface.co/FirstPrinciplesLabs/quark/resolve/main/assets/hle_pareto.png)

HLE (text-only) accuracy against total parameters, log scale. **Quark is on the Pareto frontier: no model of its size or
smaller scores higher.** The next model up the frontier, Qwen3.8 27B, is roughly three times its size.

![HLE accuracy of 7–10.5B models](https://huggingface.co/FirstPrinciplesLabs/quark/resolve/main/assets/hle_7_10b.png)

All 37 models of 7–10.5B parameters scored by Artificial Analysis. Quark leads K2 Horizon 7B by 4.5 points.

Quark is measured by us; every other model by [Artificial Analysis](https://artificialanalysis.ai/evaluations/humanitys-last-exam)
on the same 2,158 questions with its own grader (data retrieved November 2026). Mixture-of-experts models are plotted at
their total size, and models without a published parameter count aren't shown.

## Q8_0 version

A Q8_0 version (model weights quantized to 8 bits) for llama.cpp (in GGUF format) is available at
[FirstPrinciplesLabs/quark_quantized_weight_only-Q8_0](https://huggingface.co/FirstPrinciplesLabs/quark_quantized_weight_only-Q8_0). Its accuracy is
in the [Results](#results) table: it matches Quark on all benchmarks. It is also on Ollama as
[FirstPrinciples/quark-q8](https://ollama.com/FirstPrinciples/quark-q8) (see [Usage](#usage)).

## Throughput

Tokens per second on an NVIDIA H200 and a MacBook Pro, for the original bf16 weights and the
[Q8_0 version](#q8_0-version).

### llama.cpp

Throughput (token/s) for a single user with llama.cpp, by how much context is already filled.


| Hardware | Context | Q8_0 | bf16 |
| --- | --- | --- | --- |
| NVIDIA H200 | empty | **216** | 185 |
| NVIDIA H200 | 32K | **191** | 167 |
| NVIDIA H200 | 100K | **156** | 139 |
| MacBook Pro, M4, 16 GB | empty | **11.2** | does not fit (18.4 GB) |
| MacBook Pro, M4, 16 GB | 32K | **8.7** | does not fit |

On the MacBook Pro (M4, 16 GB), with the Q8_0 version serving several requests at once
(`llama-server --parallel N`):

| Concurrent requests | Throughput per request (token/s) |
| --- | --- |
| 1 | 11.2 |
| 2 | 10.5 |
| 4 | 7.1 |

## Training data

Quark was fine-tuned on our curated mix of about 200,000 physics, science, maths and coding problems,
each with a worked solution written by [Qwen3.8-Flash-Next](https://huggingface.co/Qwen/Qwen3.8-Flash-Next).
Solutions were filtered by rejection sampling, keeping only correct ones. Duplicate questions were removed,
and so was any question that shares at least half of a benchmark question's word 13-grams (after
lower-casing and keeping only letters and digits). We checked against the full GPQA Diamond, AIME 2025, MATH-500,
MMLU-Pro, SuperGPQA and HLE (text-only) sets.

## Usage

Quark runs anywhere Qwen3.5-9B does (Transformers, vLLM, SGLang). We recommend an output budget of 131,072 tokens for best performance.

With [Transformers](https://github.com/huggingface/transformers) (`pip install -U transformers accelerate`; the bf16
weights need about 20 GB of GPU memory):

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "FirstPrinciplesLabs/quark"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")

messages = [{"role": "user", "content": (
    "A particle is in the ground state of a 1D infinite square well of width L. The well suddenly expands to "
    "width 2L. What is the probability of finding the particle in the ground state of the new well?"
)}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, enable_thinking=True, return_tensors="pt", return_dict=True
).to(model.device)

output = model.generate(
    **inputs,
    max_new_tokens=32768,  # hard problems can need up to 131,072
    do_sample=True, temperature=1.0, top_p=0.95, top_k=20,
)
text = tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True)

thinking, finished, answer = text.partition("</think>")
if not finished:
    print("Stopped while still thinking; raise max_new_tokens.")
print(answer.strip())  # expected: 32 / (9 pi^2), about 0.36
```

To serve it with vLLM:

```bash
vllm serve FirstPrinciplesLabs/quark \
  --max-model-len 135168 --reasoning-parser qwen3
```

Or run it locally with [Ollama](https://ollama.com/FirstPrinciples/quark) (BF16 weights, with the recommended sampling settings and a 131,072-token context built in):

```bash
ollama run firstprinciples/quark
```

For the [Q8_0 version](#q8_0-version) with [Ollama](https://ollama.com/FirstPrinciples/quark-q8) (about 10 GB; the same sampling settings and 131,072-token context built in):

```bash
ollama run FirstPrinciples/quark-q8
```

A 131,072-token context needs about 15 GB of GPU memory. On a 16 GB Mac, lower it inside the chat with
`/set parameter num_ctx 32768` (longer answers are then cut off).

For the [Q8_0 version](#q8_0-version) with llama.cpp:

```bash
llama-server -hf FirstPrinciplesLabs/quark_quantized_weight_only-Q8_0 --jinja -c 131072 \
  --temp 1.0 --top-k 20 --top-p 0.95 --presence-penalty 1.5
```

Recommended sampling (from the Qwen3.5 model card):

| | Thinking (default) | Non-thinking |
| --- | --- | --- |
| `chat_template_kwargs` | `{"enable_thinking": true}` | `{"enable_thinking": false}` |
| temperature / top_p / top_k | 1.0 / 0.95 / 20 | 1.0 / 1.0 / 40 |
| presence penalty | 1.5 | 2.0 |
| max output tokens | up to 131,072 | 32,768 |

## Example

A hard problem from AIME 2025 (II, problem 15), in thinking mode with the recommended sampling settings:

> Let \\(f(x)=\dfrac{(x-18)(x-72)(x-98)(x-k)}{x}\\).
> 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\\).

| | Qwen3.5-9B | **Quark** |
| --- | --- | --- |
| Correct, out of 16 attempts | 1 | **10** |
| Most common answer | 188 ✗ (14 of 16 attempts) | **240 ✓** |
| 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 |

**How Quark solves it** (summarised from its answer):

1. If the minimum value \\(m\\) is reached at two points \\(u\\) and \\(v\\), the numerator minus \\(mx\\) must be a perfect square:

$$
(x-18)(x-72)(x-98)(x-k)-mx=(x-u)^2(x-v)^2 .
$$

1. Matching coefficients and eliminating \\(u\\) and \\(v\\) leaves one equation in \\(k\\):

$$
(k^2-376k-5120)^2 = 8128512\,k .
$$

1. It factors as \\((k-8)(k-32)(k-200)(k-512)=0\\), and checking the sign before squaring rules out \\(k=512\\).
2. So \\(k = 8, 32, 200\\), and the answer is **240**.

Both models' full written answers (each follows several thousand tokens of reasoning, not shown):

<details>
<summary><b>Quark</b>: 240 (correct)</summary>

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\\)).

Let

$$
P(x)=(x-18)(x-72)(x-98)(x-k).
$$

First expand \\(P(x)\\). We have

$$
18+72+98=188,
$$

$$
18\cdot72+18\cdot98+72\cdot98=10116,
$$

$$
18\cdot72\cdot98=127008.
$$

Thus

$$
P(x)=x^4-(k+188)x^3+(10116+188k)x^2-(127008+10116k)x+127008k.
$$

Suppose the minimum value is \\(m\\), attained at two distinct \\(x\\)-values \\(u\neq v\\). Then \\(f(x)-m\\) has double zeros at \\(u\\) and \\(v\\). Since

$$
x(f(x)-m)=P(x)-mx,
$$

we must have

$$
P(x)-mx=(x-u)^2(x-v)^2.
$$

Now expand the right-hand side:

$$
(x-u)^2(x-v)^2
=
x^4-2(u+v)x^3+\bigl((u+v)^2+2uv\bigr)x^2-2uv(u+v)x+u^2v^2.
$$

Matching coefficients gives

$$
2(u+v)=k+188, \tag{1}
$$

$$
(u+v)^2+2uv=10116+188k, \tag{2}
$$

$$
u^2v^2=127008k. \tag{3}
$$

Let

$$
r=u+v,\qquad s=uv.
$$

Since \\(u,v\gt 0\\), we have \\(r\gt 0\\) and \\(s\gt 0\\). From (1),

$$
r=\frac{k+188}{2}.
$$

From (3),

$$
s=\sqrt{127008k}.
$$

Substitute into (2):

$$
\left(\frac{k+188}{2}\right)^2+2\sqrt{127008k}=10116+188k.
$$

Simplify:

$$
\frac{k^2}{4}+94k+8836+2\sqrt{127008k}=10116+188k,
$$

$$
\frac{k^2}{4}-94k-1280=-2\sqrt{127008k}.
$$

Multiplying by \\(4\\),

$$
k^2-376k-5120=-8\sqrt{127008k}. \tag{4}
$$

Now square both sides:

$$
(k^2-376k-5120)^2=64\cdot127008\,k.
$$

Since \\(64\cdot127008=8128512\\),

$$
(k^2-376k-5120)^2-8128512k=0.
$$

This factors as

$$
(k-8)(k-32)(k-200)(k-512)=0.
$$

But equation (4) requires the left-hand side \\(k^2-376k-5120\\) to be negative. Checking the candidates:

$$
\begin{aligned}
k=8&:\quad 64-3008-5120=-8064,\\
k=32&:\quad 1024-12032-5120=-16128,\\
k=200&:\quad 40000-75200-5120=-40320,\\
k=512&:\quad 262144-192512-5120=64512.
\end{aligned}
$$

Thus \\(k=512\\) is extraneous, while

$$
k=8,\;32,\;200
$$

are valid.

Their sum is

$$
8+32+200=240.
$$

$$
\boxed{240}
$$

</details>

<details>
<summary><b>Qwen3.5-9B</b>: 188 (incorrect)</summary>

The function is given by \\(f(x)=\frac{(x-18)(x-72)(x-98)(x-k)}{x}\\).

We are looking for the number of local minima.

Let \\(P(x) = (x-18)(x-72)(x-98)(x-k)\\). Then \\(f(x) = P(x)/x\\).

The critical points of \\(f(x)\\) are given by \\(f'(x) = 0\\), which is equivalent to \\(x P'(x) - P(x) = 0\\). Let \\(Q(x) = x P'(x) - P(x)\\).

\\(Q(x)\\) is a polynomial of degree 4.

We analyzed the signs of \\(Q(x)\\) at the roots of \\(P(x)\\), denoted \\(r_1, r_2, r_3, r_4\\) (sorted).

We found that \\(Q(r_i)\\) alternates in sign: \\(Q(r_1) \lt  0\\), \\(Q(r_2) \gt  0\\), \\(Q(r_3) \lt  0\\), \\(Q(r_4) \gt  0\\).

Also \\(Q(0) \lt  0\\).

Using the Intermediate Value Theorem, \\(Q(x)\\) has roots in the intervals \\((-\infty, 0)\\), \\((r_1, r_2)\\), \\((r_2, r_3)\\), and \\((r_3, r_4)\\).

Let these roots be \\(c_1, c_2, c_3, c_4\\).

\\(c_1\\) is in \\((-\infty, 0)\\), and corresponds to a local maximum (since \\(f \to -\infty\\) at both ends of this interval).

\\(c_2\\) is in \\((r_1, r_2)\\), and corresponds to a local minimum (since \\(f\\) changes from 0 to negative to 0).

\\(c_3\\) is in \\((r_2, r_3)\\), and corresponds to a local maximum (since \\(f\\) changes from 0 to positive to 0).

\\(c_4\\) is in \\((r_3, r_4)\\), and corresponds to a local minimum (since \\(f\\) changes from 0 to negative to 0).

Thus, for generic \\(k\\) (distinct roots), \\(f(x)\\) has exactly two local minima.

The problem states there are exactly three values of \\(k\\). This suggests that for these values, the condition holds, or perhaps the interpretation of "minimum" or the number of extrema changes. However, based on standard interpretations of such problems where the set of solutions is finite and associated with the roots of the polynomial, the values of \\(k\\) are likely the roots of \\(P(x)\\) where the polynomial has a multiple root.

If \\(k\\) coincides with one of the existing roots \\(18, 72, 98\\), the polynomial \\(P(x)\\) has a root of multiplicity at least 2.

Specifically, if \\(k=18\\), \\(r_1=18\\) is a double root. If \\(k=72\\), \\(r_2=72\\) is a double root. If \\(k=98\\), \\(r_3=98\\) is a double root.

These values are natural candidates.

If \\(k\\) is distinct from 18, 72, 98, and positive, the number of minima is consistently found to be 2.

Given the constraint "exactly three positive real values", it implies that the condition holds specifically for \\(k=18, 72, 98\\).

(Note: There might be a subtle nuance regarding the definition of minimum or global minimum, or perhaps my analysis of generic \\(k\\) having 2 minima implies the condition holds for all \\(k\\), but the problem structure implies a finite set. In competitions, such "exactly three" questions often point to the roots).

Assuming the values are \\(18, 72, 98\\).

Sum \\(= 18 + 72 + 98 = 188\\).

\\(\boxed{188}\\)

</details>

## Limitations

- **Needs a long output budget.** At a 32K-token limit about 20% of GPQA answers are cut off and GPQA drops
  to 74.9, below the base model.
- **Non-thinking mode is slightly weaker than the base model** (AIME 56.7 vs 59.8, GPQA 76.8 vs 79.6).
- **Specialised:** trained only on single-turn science, maths and code questions; not trained for
  conversation, tool use, images or safety beyond what Qwen3.5-9B already has.

## License

Apache 2.0