quark / README.md
chengfp-eng's picture
Update README.md
935908a verified
|
Raw History Blame
11.9 kB
metadata
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

Quark

Quark is a 9B reasoning model for physics, science and maths, built by FirstPrinciples. The base model is 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, Ollama and LM Studio; this Q8_0 version matches bf16 on every benchmark below.

Quark is the first in a series of small, powerful scientific reasoning models. You can run it locally (see Usage) or on Theo Platform, 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.

Results

Accuracy (%), measured with 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)
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
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)

Q8_0 version

A Q8_0 version (model weights quantized to 8 bits) for llama.cpp, Ollama and LM Studio (in their GGUF format) is available at FirstPrinciplesLabs/quark-GGUF. Its accuracy is in the Results table: it matches Quark on all benchmarks.

Throughput

Tokens per second on an NVIDIA H200 and a MacBook Pro, for the original bf16 weights and the 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

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. Solutions were checked for correctness, and problems overlapping the benchmarks above were removed.

Usage

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

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

Or run it locally with Ollama (BF16 weights, with the recommended sampling settings and a 131,072-token context built in):

ollama run firstprinciples/quark

For the Q8_0 version with llama.cpp:

llama-server -hf FirstPrinciplesLabs/quark-GGUF: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)=(xβˆ’18)(xβˆ’72)(xβˆ’98)(xβˆ’k)xf(x)=\dfrac{(x-18)(x-72)(x-98)(x-k)}{x}. There exist exactly three positive real values of kk such that ff has a minimum at exactly two real values of xx. Find the sum of these three values of kk.

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 mm is reached at two points uu and vv, the numerator minus mxmx must be a perfect square:

(xβˆ’18)(xβˆ’72)(xβˆ’98)(xβˆ’k)βˆ’mx=(xβˆ’u)2(xβˆ’v)2. (x-18)(x-72)(x-98)(x-k)-mx=(x-u)^2(x-v)^2 .

  1. Matching coefficients and eliminating uu and vv leaves one equation in kk:

(k2βˆ’376kβˆ’5120)2=8128512 k. (k^2-376k-5120)^2 = 8128512\,k .

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

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

Quark: 240 (correct)

We interpret β€œ ff has a minimum at exactly two real values of xx” as meaning that the minimum value is attained at exactly two distinct xx-values (the intended interpretation; otherwise ff has no global minimum on all real xβ‰ 0x\neq0).

Let

P(x)=(xβˆ’18)(xβˆ’72)(xβˆ’98)(xβˆ’k). P(x)=(x-18)(x-72)(x-98)(x-k).

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

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

18β‹…72+18β‹…98+72β‹…98=10116, 18\cdot72+18\cdot98+72\cdot98=10116,

18β‹…72β‹…98=127008. 18\cdot72\cdot98=127008.

Thus

P(x)=x4βˆ’(k+188)x3+(10116+188k)x2βˆ’(127008+10116k)x+127008k. P(x)=x^4-(k+188)x^3+(10116+188k)x^2-(127008+10116k)x+127008k.

Suppose the minimum value is mm, attained at two distinct xx-values uβ‰ vu\neq v. Then f(x)βˆ’mf(x)-m has double zeros at uu and vv. Since

x(f(x)βˆ’m)=P(x)βˆ’mx, x(f(x)-m)=P(x)-mx,

we must have

P(x)βˆ’mx=(xβˆ’u)2(xβˆ’v)2. P(x)-mx=(x-u)^2(x-v)^2.

Now expand the right-hand side:

(xβˆ’u)2(xβˆ’v)2=x4βˆ’2(u+v)x3+((u+v)2+2uv)x2βˆ’2uv(u+v)x+u2v2. (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,(1) 2(u+v)=k+188, \tag{1}

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

u2v2=127008k.(3) u^2v^2=127008k. \tag{3}

Let

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

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

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

From (3),

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

Substitute into (2):

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

Simplify:

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

k24βˆ’94kβˆ’1280=βˆ’2127008k. \frac{k^2}{4}-94k-1280=-2\sqrt{127008k}.

Multiplying by 44,

k2βˆ’376kβˆ’5120=βˆ’8127008k.(4) k^2-376k-5120=-8\sqrt{127008k}. \tag{4}

Now square both sides:

(k2βˆ’376kβˆ’5120)2=64β‹…127008 k. (k^2-376k-5120)^2=64\cdot127008\,k.

Since 64β‹…127008=812851264\cdot127008=8128512,

(k2βˆ’376kβˆ’5120)2βˆ’8128512k=0. (k^2-376k-5120)^2-8128512k=0.

This factors as

(kβˆ’8)(kβˆ’32)(kβˆ’200)(kβˆ’512)=0. (k-8)(k-32)(k-200)(k-512)=0.

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

k=8:64βˆ’3008βˆ’5120=βˆ’8064,k=32:1024βˆ’12032βˆ’5120=βˆ’16128,k=200:40000βˆ’75200βˆ’5120=βˆ’40320,k=512:262144βˆ’192512βˆ’5120=64512. \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=512k=512 is extraneous, while

k=8,β€…β€Š32,β€…β€Š200 k=8,\;32,\;200

are valid.

Their sum is

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

240 \boxed{240}

Qwen3.5-9B: 188 (incorrect)

The function is given by f(x)=(xβˆ’18)(xβˆ’72)(xβˆ’98)(xβˆ’k)xf(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)P(x) = (x-18)(x-72)(x-98)(x-k). Then f(x)=P(x)/xf(x) = P(x)/x.

The critical points of f(x)f(x) are given by fβ€²(x)=0f'(x) = 0, which is equivalent to xPβ€²(x)βˆ’P(x)=0x P'(x) - P(x) = 0. Let Q(x)=xPβ€²(x)βˆ’P(x)Q(x) = x P'(x) - P(x). Q(x)Q(x) is a polynomial of degree 4.

We analyzed the signs of Q(x)Q(x) at the roots of P(x)P(x), denoted r1,r2,r3,r4r_1, r_2, r_3, r_4 (sorted).

We found that Q(ri)Q(r_i) alternates in sign: Q(r1)<0Q(r_1) \lt 0, Q(r2)>0Q(r_2) \gt 0, Q(r3)<0Q(r_3) \lt 0, Q(r4)>0Q(r_4) \gt 0.

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

Using the Intermediate Value Theorem, Q(x)Q(x) has roots in the intervals (βˆ’βˆž,0)(-\infty, 0), (r1,r2)(r_1, r_2), (r2,r3)(r_2, r_3), and (r3,r4)(r_3, r_4).

Let these roots be c1,c2,c3,c4c_1, c_2, c_3, c_4. c1c_1 is in (βˆ’βˆž,0)(-\infty, 0), and corresponds to a local maximum (since fβ†’βˆ’βˆžf \to -\infty at both ends of this interval). c2c_2 is in (r1,r2)(r_1, r_2), and corresponds to a local minimum (since ff changes from 0 to negative to 0). c3c_3 is in (r2,r3)(r_2, r_3), and corresponds to a local maximum (since ff changes from 0 to positive to 0). c4c_4 is in (r3,r4)(r_3, r_4), and corresponds to a local minimum (since ff changes from 0 to negative to 0).

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

The problem states there are exactly three values of kk. 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 kk are likely the roots of P(x)P(x) where the polynomial has a multiple root.

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

Specifically, if k=18k=18, r1=18r_1=18 is a double root. If k=72k=72, r2=72r_2=72 is a double root. If k=98k=98, r3=98r_3=98 is a double root.

These values are natural candidates.

If kk 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,98k=18, 72, 98.

(Note: There might be a subtle nuance regarding the definition of minimum or global minimum, or perhaps my analysis of generic kk having 2 minima implies the condition holds for all kk, 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,9818, 72, 98.

Sum =18+72+98=188= 18 + 72 + 98 = 188. 188\boxed{188}

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