Hi, I have for the last couple weeks looked into the ability of solving maths theorems using Qwen3.8 27B. Lots of results coming out of the frontier labs, so I thought it could be interesting to check what the abilities are with Qwen3.8 27B. Almost everything is open source here: https://github.com/aisathome/aisathome including the setup of the model and harness: however it is integrated into a larger system so it's not intended to be run in isolation.
I am using prove2me for the open theorem statements, these have been generated out of real maths papers, but a Lean 4 proof does not exist. Anyone can submit a proof here, and most I would assume use frontier labs (Opus 5.5, GPT-6.1-sol.) So this setup is actually competing against people running frontier models.
Right now 16 proofs from this setup have been accepted on prove2me, 13 of them proved from scratch by Qwen3.8 27B. And I am looking at how to scale it up right now.
| Hardness | Level (rough) | Proved by Qwen | Closed by reusing an existing proof | GPU-hours | Tokens in / out, trials 6-11 (from KV cache) |
|---|
| easy | bachelor | 5 of 8 | – | 13.5 | 55M / 1.7M (95%) |
| moderate | bachelor | 8 of 11 (+1 running) | – | 66.1 | 201M / 5.7M (96%) |
| moderate-hard | master | 0 of 5 | 1 | 16.9 | 50M / 1.5M (95%) |
| hard | PhD | 0 of 16 | 2 | 129.2 | 491M / 13.7M (96%) |
| research | research | 0 of 4 | – | 2.4 | – |
| Total | | 13 of 44 | 3 | ~228 | 796M / 23M (96%) |
The hardness level is Opus 5.5's opinion on how hard it is. On the bachelor-level lemmas it proved 13 of 19; on master and PhD level it proved none of 21. Around 3 GPU-hours per proof. Since trial 6 the agents have read 796M prompt tokens (96% from the KV cache) and generated 23M, so about 72M in and 2M out per proof, failed attempts included; only about 3M of those 72M were not already in the KV cache.
Still figuring out if there are harness/scaffolding things that could improve the results on these harder theorems, but right now I will be focusing on the easier/moderate theorems. They're still open on prove2me, so nobody has submitted a proof for them yet.
So far prove2me has accepted 16 of our submissions. Qwen3.8 27B proved 13 open lemmas from scratch (out of 48 it has tried, one still running), and 3 more were closed by reusing a proof that was already on prove2me. prove2me has rejected none of what I submitted, because everything is checked by Lean on my side first.
Everything below is also in github, the proving harness is in harness/ and the configuration of the model/node is in node/.
For comparison, I ran OpenAI's GPT-6.1-sol (via Codex) through the same pipeline on three of the hard ones. It proved 2 of them, each in under 30 minutes, and failed three times on the third (one that needs stochastic calculus). It did burn my 5-hour limit as well.
Given GPT-6.1-sol's own plans, Qwen proved 0 of 5 steps on one of them (in 7.7 GPU-hours) and 3 of 6 on the other before I stopped it. The gap to frontier is real, but the easier half is definitely doable on a 3090. And this is math coming out of math papers.
The model:
- Qwen3.8 27B, Unsloth UD-IQ4_XS (~14.3 GB), llama.cpp, q4_0 KV cache, 192k context on a 24 GB card.
- Why 192k: on a needle-in-a-haystack recall test it got 77/80 at about 195k and 62/80 at about 247k, so I capped it at 192k. I have space for more context, but the evidence showed that recall degraded with bigger context. In practice about 1 in 8 agent sessions fills the 192k window and gets compacted, mostly on the hard lemmas; the median request is about 57k tokens.
- MTP speculative decoding (Qwen's own multi-token-prediction head as the draft): generation after a 32k prompt went from 37 to 71 tok/s on a 3090, and 90 tok/s on a 4090 (llama.cpp b12342, same quant and KV cache). The outputs still pass the same model check as without it. This was a very good speedup.
- 16 GB cards run UD-Q3_K_XL at 80k context, but every proof so far came from 24 GB cards.
The agents:
- The model first writes an outline: the proof split into small steps, each left as
sorry in Lean. - Each
sorry becomes its own task, sent to a GPU in the network. A fresh agent session (opencode, in a sandbox with Lean and Mathlib, no internet) proves just that one step, compiling as it goes. So any agents can attempt the individual tasks. That means multiple agents usually contributed to a final proof. - When every step is proved, the pieces are put back together and checked by Lean, then by a separate kernel replay, and only then submitted to prove2me, which checks it again.
One task is often 40-130 agent steps, and the agent re-reads its context every step. About 96% of the prompt tokens come from the KV cache.
In money: ~3 GPU-hours per proof is about 1 kWh on a 3090 at home, or about $0.70 on a rented one, which is what I am using right now.
Splitting the proof into small steps was the single biggest improvement: before that it proved 0 of 10.
What goes wrong
- Hard lemmas (master and PhD level): 0 of 21. In 4 of the 7 failures I could check against a known proof, the model had found the right Mathlib lemmas; it just couldn't put the argument together. Better scaffolding mostly saves GPU time; it doesn't add proofs at this level.
- The outline is the weak point. A good outline means almost every step gets proved first try. One false step in the outline and everything after it is wasted.
- Easy lemmas get taken fast, because people also point frontier agents at prove2me.
Full write-up with every attempt: https://aisathome.org/devlog/5-qwen-proofs-on-consumer-hardware/ Live queue and results: https://aisathome.org/science/prove2me/