Running Qwen4 35B on an RTX 3070 8GB — a 40 tok/s Local MoE Field Review
Short answer first: an 8GB graphics card and 32GB of RAM are enough to run Qwen4-35B-A3B at roughly 40 tokens per second. I served the model with llama.cpp, pinned it as Cline's default model, gave it a real code and security inspection task, and cross-checked the server log to prove the answer was generated on this machine. The catch is prefill on long prompts and hard long-horizon tasks: there the local setup feels weaker than the official benchmark table. This is what it actually takes to run a 35B-class MoE on 8GB of VRAM.
My hardware and why this model
All measurements below are from one operator machine, taken on 2026-12-06.
| Item | Spec |
|---|---|
| CPU | AMD Ryzen 7 5800X (8 cores, 16 threads) |
| RAM | 32GB (31GiB usable) |
| GPU | NVIDIA GeForce RTX 3070 8GB |
| Driver / CUDA | 595.71.05 / 13.2 |
| OS | Ubuntu 25.10, kernel 6.17.0-41 |
| Inference engine | llama.cpp 1.1.1-dev (commit 4066b9d) |
The model is Qwen4-35B-A3B, published on 2026-12-04 under Apache 2.0. It is a mixture-of-experts model with 35B language parameters and 3B active per token. It has 40 layers and 256 experts (8 routed plus 1 shared), with a native context of 1,048,576 tokens. According to the model card, a 20B n-gram embedding and a 2B MTP module are attached, so the server reports 56,376,690,560 parameters in total.
The files I downloaded are the Unsloth UD-IQ3_XXS quantization: 3.0625 bits per weight, split into two parts of 17GB and 11GB, totaling 28,724,215,296 bytes. A separate engram IQ4_NL file of 11GB is added on top. The whole model directory takes 38GB. Fitting 35B into 8GB of VRAM is impossible, so I chose this setup from the start with a "keep only part of it on the GPU" strategy.
llama.cpp setup: splitting work between GPU and CPU
The key is a hybrid offload: send only the expert layers to the CPU and keep attention and dense computation on the GPU.
-ngl 99 -fa on -ctk q8_0 -ctv q8_0
-ot "\.ffn_.*_exps\.=CPU" -ot per_layer_token_embd=CPU
--moe-cache-mib 3072 -c 49152 -b 2048 -ub 512
-ngl 99: put as many layers on the GPU as possible.-ot "\.ffn_.*_exps\.=CPU": keep only the MoE expert weights on the CPU. Since only 3B of the 35B is active, the CPU load is smaller than it sounds.-ot per_layer_token_embd=CPU: also move the per-layer token embedding to the CPU.-ctk q8_0 -ctv q8_0: store the KV cache in 8 bits so a 49,152-token context fits within 32GB of RAM.--moe-cache-mib 3072: reserve 3GB for the CPU expert cache to cut repeated computation.
In practice VRAM usage was 6,580MiB, leaving about 1.6GB of the 8GB free. Process RSS was 16.3 to 18.3GB, peak 18.8GB, and swap usage was only 229MB. On a 32GB system this barely holds up with a browser and editor open at the same time. On 16GB of RAM this configuration is effectively impossible.
I registered the server as a systemd user service so it starts automatically after boot. It listens on 127.0.0.1:8080 and exposes an OpenAI-compatible /v1 endpoint.
Measured speed: what 40 tokens per second means
These numbers were taken on the morning of the same day with the server kept running.
| Measurement | Result |
|---|---|
| Short answer, 166 tokens | 3.9s, 42.1 tok/s |
| 248-token answer | 7.1s |
| Server log, 1,704 tokens generated | 39.99s, 42.59 tok/s |
| Server log, 1,260 tokens generated | 41.78 tok/s, 43.42 tok/s over a 3s window |
| 73-token prompt evaluation | 722ms, 101.05 tok/s |
Generation speed is stable at 40 to 43 tok/s. Because it is a MoE with 3B active parameters, the per-token compute is small, and 16 CPU threads can handle the experts even when they live on the CPU. In practice short answers finish in one or two seconds, close to instant.
Prefill is a different story. Loading a long prompt without a cache drops to about 20 to 25 tok/s. Once you feed it an entire codebase, prompt processing takes longer than generation. The q8_0 KV cache and the prompt cache make a large difference here.
The real test: a local security check through Cline
Measuring speed alone leaves the doubt: did this model really answer? So I connected Cline CLI to the local server, gave it a real task, and compared the generation records.
I pinned Cline to the openai-compatible provider only.
cline auth -p openai-compatible -k local \
-m qwen4-35b-a3b-iq3xxs -b http://127.0.0.1:8080/v1
Then I removed the other providers from ~/.cline/data/settings/providers.json so the model could not flip back. Cline's ACP mode only supports its own sign-in methods, so Orca's structured chat cannot use a local provider; the terminal TUI and direct CLI runs work fine.
The test request was: "inspect the open ports and security state on this PC." Cline ran commands, read the output, and wrote a Korean report. The session record shows 16,345 input tokens, 1,704 output tokens, and 16,272 cache-read tokens.
At the same moment, the llama-server log showed exactly 1,704 tokens generated at 42.59 tok/s, 40.7 seconds in total. The numbers match down to the token. That is evidence the answer came from llama.cpp on this PC, not from a cloud. A short round trip like "Reply with exactly: OK" also recorded model ID qwen4-35b-a3b-iq3xxs and provider openai-compatible.
Optimization also happens inside Cline
Serving the model once is not the end of the work. I hand the tuning to Cline as well, on two levels.
1) Optimizing Cline's own settings
- Keep only the
openai-compatibleprovider in~/.cline/data/settings/providers.json. If another provider remains, exiting the TUI rewrites the file and the model flips. - Match
contextWindowto the server's-cvalue. Mine is 49,152. Larger than the server cuts requests off, and much smaller needlessly truncates long tasks. - Keep
maxTokensat 8192. At 40 tok/s, 8,192 tokens already takes about three minutes; raising it without limit only wastes time when a run fails. - Use the terminal TUI and CLI instead of ACP structured chat. A local provider does not pass the ACP authentication step.
- Turn auto-approve on for repetitive work and off for anything that changes the system.
2) Asking Cline to optimize the server options
- Show Cline the current launch command and the eval lines from
journalctl, and ask for the cause of slow prefill and which flags to change. - The candidates are
-b/-ubbatch size,--moe-cache-mib, the-otexpert offload range, KV cache quantization, and the-csize. - After changing a flag, re-measure the same prompt and compare tok/s from the server log. Judge by numbers, not by feel.
- Once the server is a service, one
systemctl --user restart qwen4-llama.serviceapplies the change.
The result is a division of labor: the model runs locally and the agent does the tuning. Code and logs stay on the PC during tuning as well.
Quality: the gap between official benchmarks and local feel
The published scores for Qwen4-35B-A3B put it near the top of 35B-class open models.
| Benchmark | Score |
|---|---|
| GPQA Diamond | 86.9 |
| DeepSWE v1.1 | 61.8 |
| NL2Repo | 51.7 |
| Terminal-Bench 4.1 | 21.2 |
| FrontierCode-AA 2.0 | 16.1 |
| APEX-Agents v1.1 | 59.0 |
| AA-Briefcase v1.1 Elo | 1486 |
Its Artificial Analysis Intelligence Index is 25, first among open models in the 40B to 150B range. It is not first overall: Qwen4 Max scores 43 and Gemini 4 Neon xhigh scores 62. BenchLM gives it 52.3 out of 100, rank 87 of 218, rank 50 in coding, and rank 92 in knowledge. API pricing is $0.06 per million input tokens and $0.36 per million output tokens, with a 95% cache discount.
My local experience is one step below that table, for clear reasons. IQ3_XXS is an aggressive 3.06 bits per weight, and the experts run on the CPU. The context is reduced from the native one million to 49,152, reasoning effort is low, and temperature is 1.0.
Even so, it was usable for code editing, understanding repository structure, writing Korean reports, and summarizing documents. It is weak at long autonomous terminal work where the model must carry out many steps alone. Terminal-Bench 21.2 and FrontierCode 16.1 show exactly that. This model is less an autonomous long-running agent and more a coding assistant that I steer.
Compared with SuperGemma
The same PC also runs SuperGemma E4B under Ollama (Q4_K_M, 5.3GB). The two models have completely different characters.
| Item | Qwen4-35B-A3B (IQ3_XXS) | SuperGemma E4B (Q4_K_M) |
|---|---|---|
| Parameters | 35B MoE, 3B active | 7.5B, 4.5B effective |
| Disk | 38GB (27GB weights + 11GB engram) | 5.3GB |
| Context | 49,152 (native 1M) | 32k / 63k |
| VRAM | 6.5GB + CPU experts + 18GB RAM | all inside 8GB |
| BenchLM | 52.3 | 26.58 |
| GPQA Diamond | 86.9 | 58.6 |
| Strength | code, repo understanding, knowledge, reports | short Korean chat, summaries, instant replies |
SuperGemma is light, fast, and well suited to short Korean conversations. For hard reasoning and coding, Qwen4 is clearly ahead. BenchLM is twice as high and GPQA differs by 28 points. The sensible split is SuperGemma for quick questions and Qwen4 for real work.
What I liked and what I did not
Three things worked well.
- A 35B-class MoE runs at 40 tok/s on a common 8GB VRAM and 32GB RAM machine. Perceived latency is almost gone.
- All inference stays local. I do not have to send code and logs outside.
- It plugs directly into agent tools such as Cline through a single OpenAI-compatible endpoint.
The downsides are clear too.
- Prefill on long prompts is slow. Feeding an entire large repository is painful.
- IQ3_XXS quantization and CPU experts lower quality below the official scores. Hard coding tasks produce more wrong answers.
- A 49,152 context is a constraint next to the native one million. More RAM would ease it.
- Orca's structured chat (ACP) does not support a local provider, so I have to use the terminal TUI.
Who should try this
- People with 8GB of VRAM and at least 32GB of RAM who want a local coding assistant that never sends code to the cloud.
- People for whom real code editing and repository understanding matter more than short chat.
- People who want to replace API costs with electricity and run an agent entirely on their own machine.
I would not recommend it for machines with 16GB of RAM or less, for people who constantly need long contexts, or for people who need an agent that runs autonomously for hours. In those cases a smaller model or a cloud API is better.
I now keep this local Qwen4 pinned as Cline's default model. More important than the 40 tok/s number is that my code never leaves my PC. The compromise of running a 35B MoE on an 8GB graphics card turns out to be more usable than I expected.
AI Knowledge Hub
Visitor Comments