To run Qwen4-35B-A3B locally, update Ollama and run ollama run qwen4:35b-a3b, or start llama.cpp with llama-server -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL. A 4-bit build wants about 21 to 25 GB of GPU memory or unified memory, because llama.cpp can leave the model’s 11.5 GB n-gram table on your SSD. The weights are Apache-2.0, so the model costs $0. You pay only for hardware and power.
This guide covers memory per quant, the commands for Ollama, llama.cpp, MLX and vLLM, thinking control, the tokenizer caveat, and how your coding agent can test the local endpoint with Apidog CLI.
What is Qwen4-35B-A3B?
Qwen4-35B-A3B is the first open-weight model in Alibaba’s Qwen4 family, released December 4, 2026 under Apache-2.0. It’s a natively multimodal mixture-of-experts model: 35B parameters with 3B activated per token, plus a 20B n-gram embedding table and a 2B multi-token prediction (MTP) module.

The official model card lists these specs:
| Spec | Qwen4-35B-A3B |
|---|---|
| Parameters | 35B total, 3B activated, plus 20B n-gram embedding and 2B MTP |
| Experts | 256, with 8 routed + 1 shared per token |
| Layers | 40: 10 x (3 Gated DeltaNet + 1 Qwen Sparse Attention), each followed by MoE |
| Context | 1,048,576 tokens natively |
| Inputs | Text, image, video |
| Thinking | reasoning_effort of xhigh, high (default), low or off |
| License | Apache-2.0 |
Qwen claims it beats the dense Qwen3.8-27B and matches Qwen3.8-Flash-Next at about a third of the size. Compare the two local picks in Qwen4-35B-A3B vs Qwen3.8-27B, or get the full tour in what Qwen4-35B-A3B is. The API-only flagship is covered in what Qwen4-Max is.
Why it matters locally: only 3B parameters fire per token, so decode is fast, and the hybrid attention keeps the cache small at long context.
How much RAM and VRAM does Qwen4-35B-A3B need?
Plan on 21 to 25 GB for a 4-bit quant, as long as your runtime can keep the n-gram table on disk. Unsloth’s own advice: start with UD-IQ4_XS on a 24 GB GPU or a 24 GB Mac, try UD-IQ3_XXS with a short context at 18 GB, and use 2-bit or 3-bit on a 16 GB GPU.
The catch is the n-gram embedding, which Unsloth calls the engram. Every GGUF in Unsloth’s quant repo ships in two files, and the second file is that table. Unsloth’s Qwen4 guide says it’s about 30% of a 4-bit download, and llama.cpp can read it from your SSD on demand instead of holding it in memory.
Sizes and accuracy from Unsloth’s quant table, checked December 4, 2026:
| Quant | Download | In memory, engram on SSD | Accuracy vs BF16 (95.3%) |
|---|---|---|---|
| UD-IQ2_XXS | 23.4 GB | 11.9 GB | 93.6% |
| UD-Q3_K_XL | 30.9 GB | 19.4 GB | 94.0% |
| UD-IQ4_XS | 32.0 GB | 20.5 GB | 95.2% |
| UD-Q4_K_XL | 36.2 GB | 24.7 GB | 95.0% |
| UD-Q5_K_M | 42.4 GB | 27.0 GB | 95.2% |
| UD-Q6_K_XL | 52.2 GB | 30.5 GB | 94.9% |
| UD-Q8_K_XL | 62.3 GB | 40.5 GB | 94.8% |
Accuracy is Unsloth’s own test (300 questions from GSM8K, MATH-500, CRUXEval-O and MMLU-Pro, thinking on). Gaps under one point are noise, so 4-bit is the sweet spot.

Add 0.9 GB for the vision projector (mmproj-BF16.gguf) if you want image input. Context is cheap here: three of every four layers use Gated DeltaNet, which keeps a fixed-size state instead of a growing cache.
How fast does it run?
Fast, because only 3B parameters are active. Unsloth measured UD-Q4_K_XL on mainline llama.cpp with thinking off: about 175 tokens per second on an RTX 5090, 91 on a MacBook Pro M5 Max and 63 on an RTX Spark.
MTP speculative decoding adds more. Every Unsloth GGUF embeds the MTP head, and --spec-type draft-mtp at draft depth 1 lifted code generation to 224 tokens per second on the 5090 and 118.5 on the M5 Max, about 1.3x. Unsloth recommends depth 2 as the default.
Short on VRAM? On a 24 GB GPU with 128 GB of system RAM, llama.cpp’s --moe-cache-mib decoded 131 to 138 tokens per second in Unsloth’s runs, against 69 to 72 with a plain GPU/CPU split. We didn’t benchmark any of this ourselves.
Run Qwen4-35B-A3B with Ollama
Ollama is the quickest start. Update to the latest release, then:
ollama pull qwen4:35b-a3b
ollama run qwen4:35b-a3b
The qwen4 library page lists the default tag as a 36 to 37 GB Q4_K_M build with text and image input and a 1M context window. On Apple Silicon there’s also qwen4:35b-a3b-nvfp4 (36 GB, MLX). Both load the whole file, n-gram table included, so plan for a 48 GB Mac or a GPU plus enough system RAM to split layers.
Raise the context for agent work and skip thinking for quick chats:
OLLAMA_CONTEXT_LENGTH=65536 ollama serve
ollama run qwen4:35b-a3b --think=false
Ollama serves an OpenAI-compatible API at http://localhost:11434/v1.
Run it with llama.cpp
llama.cpp gives you the engram-on-SSD trick and MTP. Qwen4 support landed in mainline at ggml-org/llama.cpp#33626, so build the latest master. Then:
llama-server \
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
--spec-type draft-mtp --spec-draft-n-max 2 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \
--port 8080
-hf pulls both files and the vision projector. --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU keeps the engram on disk and reads it as needed. The sampling values are Qwen’s thinking-mode recommendations. For non-thinking mode, add --reasoning off and switch to --temp 0.7 --top-p 0.8 --top-k 20 --presence-penalty 1.5.
The llama.cpp team also publishes ggml-org/Qwen4-35B-A3B-GGUF in Q4_K_M (36 GB), Q6_K and Q8_0 as single files.
Run it with MLX on a Mac
MLX works today, with one caveat: per the Hugging Face launch post, mlx-lm support for the language model is “on its way” to the official repo. Until it lands, use one of these routes:
- mlx-community 4-bit text build (31.3 GB):
mlx_lm.generate --model mlx-community/Qwen4-35B-A3B-4bit-text --prompt "Explain sparse attention" --max-tokens 4096. Pass--chat-template-config '{"reasoning_effort": "low"}'to change effort. - Unsloth MLX 4-bit (34.0 GB, text only): load it with mlx-lm after placing Unsloth’s
mlx_qwen4_moe.pypatch next to your script. Unsloth measured 75 tokens per second decode and 2,711 prefill on an M5 Max, peaking at 35 GB. - oMLX, which the HF post says supports images, MTP and keeping the n-gram table on SSD.
The two 4-bit builds hold the full table in memory, so a 48 GB Mac is the floor. On 24 or 32 GB, use llama.cpp.
What about LM Studio?
Not yet. When we checked on December 4, 2026, LM Studio had no Qwen4 model page and no lmstudio-community build. Use llama.cpp or Ollama until it does. [VERIFY before publish: re-check lmstudio.ai/models]
Control thinking and serve an OpenAI-compatible endpoint
Every runner above exposes the same /v1/chat/completions shape. Ollama uses port 11434, llama.cpp 8080 and mlx_lm.server 8080 by default. For a GPU server, the vLLM recipe serves the FP8 checkpoint (flags trimmed here):
vllm serve Qwen/Qwen4-35B-A3B-FP8 --trust-remote-code --max-model-len auto \
--enable-auto-tool-choice --tool-call-parser qwen4 --reasoning-parser qwen4
Set thinking per request through chat_template_kwargs, as the model card shows:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "qwen4",
"messages": [{"role": "user", "content": "Write a Python function that merges two sorted lists."}],
"chat_template_kwargs": {"reasoning_effort": "low"}}'
off disables thinking; enable_thinking: false does the same. Qwen warns that lower effort doesn’t always save time in agent loops, because shallow turns cause retries.

The tokenizer caveat. Qwen ships its own tokenizer reference implementation (it needs tiktoken and trust_remote_code=True). The Jinja template in tokenizer-compat/ is for backward compatibility only: same text, but token IDs can differ because the reference code separates control tokens from normal ones. llama.cpp, Ollama and MLX use the Jinja route. If tool calls parse oddly or control tokens leak, update the runtime first, and use vLLM or Transformers when you need exact parity.
Let your coding agent test the local endpoint with Apidog CLI
Every runner claims the same OpenAI shape, but each handles reasoning fields, tool calls and long waits differently. Have your coding agent build a repeatable check with Apidog CLI so a broken template shows up in seconds, not mid-task.
Set it up once:
npm install -g apidog-cli@latest
apidog login --with-token <YOUR_TOKEN>
npx -y skills add https://apidog.com # pick your agent when prompted
Then give Claude Code, Codex or OpenCode one prompt:
In Apidog project <projectId>, create an environment "qwen4-local" with base URL
http://localhost:8080/v1. Add a POST /chat/completions endpoint for model qwen4,
then a test case that sends reasoning_effort "low" and asserts status 200,
a non-empty choices array, and a usage object with completion_tokens > 0.
Run it and summarize any failures.
The agent checks what exists, validates its payloads, creates the resources and runs the case:
apidog environment list --project <projectId>
apidog environment create qwen4-local --project <projectId> --base-url http://localhost:8080/v1
apidog cli-schema validate endpoint-create --file endpoint.json
apidog endpoint create --project <projectId> --file endpoint.json
apidog test-case create --project <projectId> --file case.json
apidog run --test-case <caseId> --project <projectId> -e <envId> --timeout-request 300000

--timeout-request 300000 gives a thinking model five minutes before the run calls it a failure. Swap the base URL to http://localhost:11434/v1 and the same case checks Ollama. A second environment for Qwen Cloud’s qwen4-35b-a3b, with your key passed through --env-var, compares local and hosted answers. More setups: Apidog CLI in Claude Code and the apidog run reference. Apidog’s Free plan covers up to 4 users.
Once that check passes, a team can hand the same agent work out as tasks on Sharkly, a board that assigns jobs to coding agents running on your own machines with your own Claude Code, Codex or OpenCode plan, so several local-model runs go in parallel and you review each one before it merges. It’s free to start.
Local vs the hosted Qwen4 API
Local keeps prompts on your machine and costs nothing per token. Hosted gives you the full 1M context without a big machine, plus Qwen Cloud’s built-in tools. Our Qwen4-35B-A3B API guide covers that path, and the Qwen4-Max API guide covers the flagship. For the previous local pick, see running Qwen3.8-27B locally.
FAQ
Is Qwen4-35B-A3B free to run locally? Yes. The weights are Apache-2.0 on Hugging Face, and Ollama, llama.cpp, MLX and vLLM are free. You pay only for hardware and electricity.
Can I run Qwen4-35B-A3B on a 24 GB GPU or Mac? Yes, with llama.cpp and the engram on SSD. Unsloth recommends UD-IQ4_XS, which needs about 20.5 GB in memory. Ollama’s 37 GB tag won’t fit.
Why is the download so much bigger than 35B parameters suggests? The file also carries a 20B n-gram embedding table and a 2B MTP module. At 4-bit that table is an 11.5 GB second file.
How do I turn off thinking? Send "chat_template_kwargs": {"reasoning_effort": "off"}, start llama.cpp with --reasoning off, or run Ollama with --think=false. Then use temperature 0.7, top_p 0.8 and presence_penalty 1.5.
Does the local model read images? Yes in Ollama and in llama.cpp with the mmproj file. The 4-bit MLX builds above are text only.



