---
title: "Qwen4-35B-A3B tested on a CPU box: can it run your agent loop?"
url: https://theforloops.com/posts/qwen4-35b-a3b-local-agent-loop-test
published_at: 2026-12-04T12:05:05.039229
updated_at: 2026-12-04T12:05:05.040991
author: Noaman Kazi
category: Reviews: Repos & Startups
tags: [qwen4, local-llm, llama.cpp, tool-calling, coding-agents, open-weights]
word_count: 2001
reading_time_minutes: 9
---

# Qwen4-35B-A3B tested on a CPU box: can it run your agent loop?

> **Direct Answer:** Yes, for short, well-specified agent loops. A 2-bit Qwen4-35B-A3B build on an 8-core, GPU-less box with 16 GB of RAM passed 18 of 18 tool-call checks, 5 of 5 repo fixes and 3 of 3 multi-turn agent runs at about 12 tokens/s, but prefill ran at only about 40 tokens/s and the model is about 57B parameters on disk.

## Key Takeaways
- Qwen4-35B-A3B is 35B MoE parameters (3B active) plus a 20B n-gram table and a 2B MTP module: about 57B in total, released 4 December 2026 under Apache 2.0.
- The n-gram table is read 16 rows per token, so it can stay on disk; that is how a 23.4 GB 2-bit build ran on a box with about 7 GB of free RAM.
- Measured on 8 CPU threads with llama.cpp v1.1.1 and Unsloth's UD-IQ2_XXS: 18/18 tool-call checks, 5/5 single-shot fixes, 3/3 agent loops passed.
- Generation ran at 11 to 15 tokens/s typically; prefill at about 40 tokens/s is the real bottleneck for long agent contexts on CPU.
- Qwen's own chart shows it beating Qwen3.8-27B but trailing Qwen3.8-Flash-Next on Terminal Bench, FrontierCode and GPQA; Artificial Analysis scores it 25 vs 28.

![A desktop CPU resting on RAM modules next to a drive's circuit board](https://images.pexels.com/photos/37113174/pexels-photo-37113174.jpeg?auto=compress&cs=tinysrgb&w=1600)
*Photo: Marta Branco / Pexels*

**Short answer: yes, for small agent loops, even at 2-bit on a CPU.** I ran Qwen4-35B-A3B on an 8-core, GPU-less box with 16 GB of RAM, and it passed all 18 tool-call checks, 5 of 5 single-shot bug fixes and 3 of 3 multi-turn "make the tests pass" runs. The catch is prefill: at about 40 tokens per second, long contexts get slow fast, and "3B active" hides a model that is about 57B parameters on disk.

Qwen released the model on 4 December under Apache 2.0, and the [Hacker News thread](https://news.ycombinator.com/item?id=50755448) (749 points and 166 comments when I checked) quickly turned into people testing it on their own machines. So I did the same, with real numbers, on hardware that has no business running a 35B model.

@[tweet](https://x.com/Alibaba_Qwen/status/2128672205282435077)

## What "35B with 3B active" actually means

The [model card](https://huggingface.co/Qwen/Qwen4-35B-A3B) lists the language model as **35B parameters with 3B activated, plus a 20B n-gram embedding and a 2B multi-token prediction (MTP) module**. [Hugging Face's launch post](https://huggingface.co/blog/qwen4) puts it at about 3.8B active and about 56B in total. [Artificial Analysis](https://artificialanalysis.ai/models/qwen4-35b-a3b) counts 57B. The repo's safetensors weigh in at 56.8B parameters.

The rest of the design, per the card:

- **Mixture of experts:** 256 experts, 8 routed plus 1 shared per token, 40 layers.
- **Attention:** a hybrid. Three Gated DeltaNet (linear attention) layers, then one sparse-attention layer, repeated 10 times. That keeps the cache small.
- **Context:** 1,048,576 tokens, natively.
- **Inputs:** text, images and video, with a vision encoder.
- **Thinking control:** `reasoning_effort` of `xhigh`, `high` (the default), `low` or `off`.

The interesting part is the n-gram table, which Unsloth and the HN crowd call the "engram". It's a 20.5B-parameter lookup table in the second decoder layer, and Hugging Face says **each token reads just 16 rows of it**. So it doesn't need to sit in fast memory. You can leave it on disk and read it on demand. One HN commenter measured 79 tokens/s with the table on disk and 81 with it in RAM, on one sample.

That's the whole trick behind "runs on a single GPU when quantized." It's also why the "3B" in the name tells you about speed, not about how much you have to download.

## What it claims, and what the scoreboard says

Qwen says the model outperforms the dense Qwen3.8-27B and "matches Qwen3.8-Flash-Next at ~1/3 the size." Its own chart supports the first claim far better than the second:

| Benchmark (Qwen's chart) | Qwen4-35B-A3B | Qwen3.8-Flash-Next | Qwen3.8-27B |
|---|---|---|---|
| DeepSWE v1.1 | **61.8** | 58.7 | 42.2 |
| Terminal Bench 4.1 | 21.2 | **24.2** | 5.6 |
| FrontierCode-AA 2.0 | 16.1 | **27.1** | 14.9 |
| NL2Repo | **51.7** | 48.1 | 42.3 |
| APEX Agents v1.1 | 59.0 | **61.0** | 47.5 |
| GPQA | 86.9 | **91.7** | 89.2 |

Against the 27B, it's a clear win nearly everywhere. Against Flash-Next it's a split, and FrontierCode is a rout: 16.1 against 27.1. On the independent side, Artificial Analysis gives it **25 on its Intelligence Index, against 28 for Flash-Next**. It's still the highest-scoring model under 150B parameters on that index. Hosted on Alibaba Cloud it costs $0.06 in and $0.36 out per million tokens, and Artificial Analysis measured 218 output tokens per second there.

The HN thread had the same split. One commenter running it on a 96 GB workstation card called the coding "quite good actually." They also said it was "not even close" to Flash-Next on prompt adherence for complex tasks: "I had to tell it 3 times to upload a file before it stopped proposing an upload structure and actually do it." Keep that in mind when you read my results, because my tasks were short and well specified.

## The test rig: deliberately underpowered

This is the setup I'd call "a dev box you already have," minus the GPU:

- **Machine:** a VM with 8 vCPUs (Intel Xeon with AVX-512), 16 GB of RAM and **no GPU**. Other processes were running, and only about 7 GB of RAM was free when I started.
- **Disk:** a virtual disk that read at 1.4 to 1.7 GB/s in a quick `dd` test.
- **Inference:** llama.cpp v1.1.1 (commit `1579b02`), built from source, CPU only.
- **Model file:** [Unsloth's](https://huggingface.co/unsloth/Qwen4-35B-A3B-GGUF) `UD-IQ2_XXS` GGUF, 23.4 GB in two files (11.9 GB plus 11.5 GB). The second file is the same 11.5 GB in every Unsloth quant from 1-bit to 4-bit, which fits with it being the n-gram table.
- **Mode:** thinking off, with the card's non-thinking sampling (temperature 0.7, top-p 0.8, top-k 20, presence penalty 1.5). I added min-p 0.01, as [Unsloth's guide](https://unsloth.ai/docs/models/qwen4) advises for its smallest quants.

Unsloth's own table says 2-bit quants want 12 to 16 GB of memory, so this box was under-specced on purpose. When the server loaded, llama.cpp said so too: *"failed to fit params to free device memory: was unable to fit model into system memory."* It then loaded anyway in about 15 seconds, because it memory-maps the weights and reads the n-gram table lazily:

```bash
llama-server -m Qwen4-35B-A3B-UD-IQ2_XXS-00001-of-00002.gguf \
  --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
  -c 8192 -np 1 -t 8 --jinja --reasoning off \
  --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.01 --presence-penalty 1.5 \
  --host 127.0.0.1 --port 8088
```

Why 2-bit? It was the smallest quant I trusted not to be a toy, and it gave me the most room on a box with a few GB to spare. If your machine has 24 GB or more, Unsloth suggests starting at `UD-IQ4_XS`. Expect better quality than what I tested, not worse.

## Results: tool calls

I adapted the recipe from the [Amazon Ergo review](/posts/amazon-ergo-review-open-weights-coding-model-agent-loop). This time the model runs locally, so I could actually run it. I gave it three tools (`get_weather`, `search_files`, `convert_currency`) through llama.cpp's OpenAI-compatible endpoint and six prompts:

- one call with an enum argument (fahrenheit);
- choosing the search tool with a path and `max_results: 5` pulled out of plain English;
- a currency conversion that needs the ISO codes EUR and JPY;
- two parallel calls (Tokyo and Oslo weather);
- a question that needs no tool;
- a request no tool can serve (booking a restaurant table).

Each case passed only if the tool name, every argument and the call count were right, or if it made no call when none was needed.

**Result: 18 of 18 passed across three repetitions. Every call parsed as valid JSON, with no made-up tools.** On the restaurant prompt it said plainly that it couldn't book tables and listed what it could do. The median request took 5.7 seconds end to end.

## Results: a small repo fix

Next came the single-shot coding task from the Ergo recipe, trimmed down. A `textstats.py` with three bugs (splitting on spaces only, keeping empty tokens, ignoring alphabetical tie-breaks) and four pytest tests, three of them failing. The model had to return the complete fixed file.

**5 of 5 runs passed the tests.** All five answers were the same file, character for character. It switched to `split()`, dropped empty words and sorted by `(-count, word)`. That's the fix I'd have written. Each run took about 13 to 14 seconds after the first one warmed up, which took 42.

## Results: a real agent loop

This is the test that matters for the headline question. I built a two-file repo (`money.py`, `cart.py`) with three failing tests: comma handling in `$1,200.00`, a float trap where `int(float("4.35") * 100)` gives 434, and a cart total that ignores quantity. The model got four tools (`list_files`, `read_file`, `write_file`, `run_tests`) and one instruction: fix the source, don't touch the tests, say DONE. I ran the loop for real, executing each tool call and feeding the output back.

```python
for turn in range(15):
    r = client.chat.completions.create(model="qwen4", messages=msgs, tools=TOOLS, max_tokens=1500, **SAMPLING)
    m = r.choices[0].message
    msgs.append(m.model_dump(exclude_none=True))
    if not m.tool_calls:
        break                      # the model says it's done
    for tc in m.tool_calls:
        out = tool(tc.function.name, json.loads(tc.function.arguments or "{}"))
        msgs.append({"role": "tool", "tool_call_id": tc.id, "content": out})
```

| Run | Turns | Tool calls | Wall time | Tests at end |
|---|---|---|---|---|
| 1 | 6 | 8 | 61.5 s | 6/6 pass |
| 2 | 6 | 8 | 59.7 s | 6/6 pass |
| 3 | 8 | 10 | 133.0 s | 6/6 pass |

**3 of 3 runs finished with all tests passing and the test file untouched.** None of the tool arguments were malformed. Every run followed the same disciplined path: list files, read all three, run the tests, then write fixes. The best part was run 3. Its first fix rounded `4.35` to a whole number before multiplying by 100, which broke four tests. It read the pytest output, rewrote `money.py` with `Decimal` and `ROUND_HALF_UP`, and passed on the next run. That's the loop working as intended: try, break, read the error, fix.

One honest caveat about my own test: the discount check happens to pass with the original floor division, so it didn't really test rounding. Write stricter tests than I did.

## Speed and memory, measured

| Metric (2-bit, CPU only, 8 threads) | Measured |
|---|---|
| Generation speed, typical | 11 to 15 tokens/s (median 12.0 across the 18 tool-call requests) |
| Generation speed, worst I saw | 5.1 to 6.3 tokens/s, on a 2,296-token prompt and while the box was busy |
| Prompt processing (prefill), fresh 2,296-token prompt | 39.4 and 43.6 tokens/s |
| Time to load the model | about 15 s |
| Peak resident memory | 12.5 GB, of which about 5.8 GB was allocated memory; the rest was memory-mapped model pages the OS can drop and re-read |

The speeds varied because this is a shared machine and other jobs were running. Treat them as a range, not a spec sheet.

The prefill number deserves the most attention. Generation at about 12 tokens/s feels fine for tool calls. But at roughly 40 tokens/s of prompt processing, a 2,300-token prompt waits close to a minute before the first token. An agent that has piled up 30,000 tokens of file contents and logs would wait about 12 minutes, if the cache can't reuse earlier turns. The 1M-token context window is real, but on a CPU you won't want to use much of it. On a GPU it's a different world. One HN commenter reported more than 100 tokens/s with a 4-bit quant on a Radeon RX 7900 XTX. Another reported 438 tokens/s across four parallel streams on a 96 GB RTX 6000-class card.

## What I didn't test

- **Thinking mode.** I ran everything with reasoning off to keep runs short. Artificial Analysis scored the model at its highest reasoning effort (xhigh), and Qwen's card warns that lower effort can mean more failures and retries on multi-turn tasks.
- **Long-horizon work.** My loops ran 6 to 8 turns on a toy repo. The prompt-adherence complaints on HN came from longer, messier tasks.
- **Vision, the MTP drafter, or any quant other than UD-IQ2_XXS.**
- **A head-to-head.** I didn't run Flash-Next or any other model on the same tasks, so these results say "it can do this," not "it beats X."

## Verdict

Can a model with 3B active parameters run your agent loop? **For short, well-specified loops (tool routing, structured arguments, small repo fixes with tests) yes, and it does it on hardware you already own.** A 2-bit build on a GPU-less box with a few GB of free RAM got every check I gave it right, and caught and fixed its own mistake. That beats what I expected from "IQ2_XXS," and the Apache 2.0 license means there's no fine print to read.

Two cautions. First, budget for the real size: 23 GB on disk at 2-bit, and about 57B parameters in total, whatever the name says. Second, on a CPU, prefill is your bottleneck, not generation. Keep contexts short, or put it on a GPU before you point it at a big codebase. If you need the strongest local coding model and have the hardware, Qwen's own chart says Flash-Next still wins on the hard stuff.

If you run agents locally, try the quant your machine can hold, on 10 or so of your own tasks with real tests, before you trust any benchmark, mine included. If you'd rather not run anything, the hosted model at $0.06 and $0.36 per million tokens is cheap enough to check first.

## Frequently Asked Questions
### How much RAM do you need to run Qwen4-35B-A3B?
Unsloth's guide suggests 12 to 16 GB for 2-bit quants, 17 to 19 GB for 3-bit and 21 to 25 GB for 4-bit. In this test a 2-bit build still ran with about 7 GB free, because llama.cpp memory-maps the weights and reads the n-gram table from disk.

### Does Qwen4-35B-A3B support function calling?
Yes. Through llama.cpp's OpenAI-compatible server with --jinja, it produced valid tool calls in all 18 checks, including parallel calls and correctly declining when no tool fit.

### Is Qwen4-35B-A3B better than Qwen3.8-Flash-Next?
Not overall. It wins on DeepSWE and NL2Repo in Qwen's chart but loses on Terminal Bench 4.1, FrontierCode-AA 2.0, APEX Agents and GPQA, and scores 25 to Flash-Next's 28 on the Artificial Analysis Intelligence Index.

### What is the engram or n-gram embedding in Qwen4?
A 20.5B-parameter lookup table in the second decoder layer that encodes recent bigrams and trigrams. Each token reads only 16 rows, so the table can live on SSD with little effect on decode speed.

### How fast is Qwen4-35B-A3B on a CPU?
On 8 Xeon vCPUs at 2-bit, generation ran at about 11 to 15 tokens per second and prompt processing at about 40 tokens per second, so a 2,300-token prompt waits close to a minute for its first token.


## Sources & Citations
- [Qwen4-35B-A3B model card](https://huggingface.co/Qwen/Qwen4-35B-A3B)
- [Qwen4-35B-A3B launch post](https://x.com/Alibaba_Qwen/status/2128672205282435077)
- [Welcome Qwen 4: Cutting-edge intelligence on-device](https://huggingface.co/blog/qwen4)
- [Qwen4 35B-A3B: How to Run Locally](https://unsloth.ai/docs/models/qwen4)
- [unsloth/Qwen4-35B-A3B-GGUF](https://huggingface.co/unsloth/Qwen4-35B-A3B-GGUF)
- [Qwen4 35B A3B: Intelligence, Performance & Price Analysis](https://artificialanalysis.ai/models/qwen4-35b-a3b)
- [Qwen4-35B-A3B (discussion)](https://news.ycombinator.com/item?id=50755448)
- [llama.cpp v1.1.1 release](https://github.com/ggml-org/llama.cpp/releases/tag/v1.1.1)
