Skip to content
Inference Academy

How to run Qwen4-35B-A3B locally: Mac, RTX 5090, DGX Spark or one server GPU

A practical guide to running Qwen4-35B-A3B on your own hardware. Which machines it fits, from a 32 GB RTX 5090 to a Mac, a DGX Spark or a single H200, how much GPU memory and system RAM each format needs, why the n-gram embedding table can live in RAM, measured speeds, and the commands for Ollama, llama.cpp, MLX, vLLM and SGLang, plus the settings that matter.

Key takeaways

  • The 4-bit versions are about 36 to 37 GB, FP8 is about 56 GiB and BF16 about 106 GiB, counting the 20B n-gram embedding table.
  • That table is a lookup, so vLLM and SGLang can keep it in system RAM: in FP8 the GPU then holds about 40 GB and the host about 20 GB.
  • SGLang's tests show about 249 tokens/s end to end on an RTX 5090 in NVFP4 and about 200 on an RTX PRO 6000, single request, with multi-token prediction on.
  • The KV cache is small: about 20 KiB per token in BF16, so even long sessions cost little memory compared with the weights.
  • Ollama, llama.cpp and MLX run the quantised versions on Macs and PCs; vLLM and SGLang need their new qwen4 images at launch.

By

6 min read

Share
On this page

Qwen4-35B-A3B is the rare new model that is genuinely practical to run yourself: a mixture of experts with about 3B active parameters, a small KV cache and a 1M-token context. This guide covers which machines it fits, how much memory each format needs, what speed to expect and the commands to start it. For what the architecture does, see Qwen4-35B-A3B explained.

Figures come from the model card, the vLLM recipe, the SGLang cookbook, Hugging Face's launch post and Ollama's library page, as of 4 December 2026. Speeds are the SGLang team's measurements, not ours.

#How much memory it needs

The repository holds about 57 billion parameters: 35B of model, 20B of n-gram embedding table and 2B of multi-token prediction. The n-gram table is a lookup (each token reads a few rows), so serving engines can leave it in system RAM instead of GPU memory. That changes the arithmetic:

Format Whole checkpoint On the GPU with the table in RAM System RAM for the table
BF16 about 106 GiB about 72.7 GB about 41 GB
FP8 about 56 GiB about 39.7 GB about 20.5 GB
NVFP4 about 44 GiB less (see SGLang's per-device presets) yes
4-bit GGUF (Ollama qwen4:35b-a3b-q4_K_M) 37 GB — —
MLX NVFP4 (Ollama qwen4:35b-a3b-nvfp4) 36 GB — —

Checkpoint sizes are SGLang's figures; the GPU and RAM split is vLLM's (it offloads the table by default); the 4-bit sizes are Ollama's download sizes. Ollama and MLX load the table along with everything else, although Hugging Face notes that oMLX can offload it to SSD.

The KV cache barely matters. Only 10 of the 40 layers keep a KV cache (the rest use linear attention with a fixed 60 MiB state per sequence), at about 20 KiB per token in BF16. A 32K-token chat needs about 640 MiB, and a full 1M-token context about 20 GiB, or roughly 5.6 GiB with the NVFP4 KV cache vLLM uses. Budget a few GB for it, not tens (KV cache explained, how much VRAM to run an LLM).

#Which machine

Machine What fits Notes
RTX 5090 (32 GB) NVFP4 only, n-gram table in host RAM SGLang's own test device; BF16 and FP8 do not fit
RTX PRO 6000 (96 GB) NVFP4 or FP8, table on GPU or in RAM Room for many concurrent sessions
DGX Spark (128 GB unified) Any 4-bit or FP8 version Listed by SGLang (DGX Spark vs Mac Studio vs Strix Halo)
Mac with 64 GB or more 4-bit GGUF or MLX 48 GB is tight once the OS and context are counted
One H100 (80 GB) FP8, with the table in RAM vLLM says H100 fits the FP8 checkpoint; SGLang does not list H100
One H200 or Blackwell data-centre GPU FP8 or BF16 vLLM's default recipe uses one GPU
16 GB GPU Experimental SGLang needs 64 GB of host RAM and has not yet validated it on real hardware

AMD MI350X and MI355X have dedicated vLLM and SGLang images (SGLang caps context at 262,144 tokens there and turns the prefix cache off by default).

#How fast it runs

The SGLang cookbook reports single-request speeds with an 8K-token prompt and 1K-token output, NVFP4 weights and multi-token prediction drafting 3 tokens:

GPU N-gram table End-to-end tokens/s Median decode tokens/s Median TTFT Peak GPU memory
RTX PRO 6000 (96 GB) On GPU 204 401 2.10 s 46.9 GiB
RTX PRO 6000 (96 GB) In host RAM 200 382 2.09 s 27.9 GiB
RTX 5090 (32 GB) In host RAM 249 not given 1.38 s 27.7 GiB

Two things stand out. Moving the n-gram table to system RAM saved 19 GiB of GPU memory for about 2% of the speed. And multi-token prediction accepted 3.3 to 3.5 tokens per step on average, which is most of the reason a single request reaches a few hundred tokens per second (speculative decoding explained). With a different draft model (DFlash2) on the RTX PRO 6000, SGLang measured about 320 tokens/s for one request, about 1,170 total at 8 concurrent requests and about 1,760 at 32.

On a Mac, Hugging Face reports that multi-token prediction made llama.cpp 22% faster on an M5 with the 4-bit quantisation; it gives no absolute figure. Measure your own machine with your own prompts (how to benchmark an LLM server).

#Ollama: the quickest start

bash
ollama run qwen4:35b-a3b

The default tag is about 36 to 37 GB. Ollama's page lists qwen4:35b-a3b-q4_K_M (37 GB), qwen4:35b-a3b-nvfp4 (36 GB, MLX) and BF16 tags (114 GB), all with image input and the 1M context. It also serves an API at http://localhost:11434 that agent tools can point at (Ollama vs llama.cpp).

#llama.cpp

Hugging Face's post gives these commands for the official GGUF repository (Q4_K_M, Q6_K and Q8_0 quantisations):

bash
llama serve -hf ggml-org/Qwen4-35B-A3B-GGUF:Q6_K
llama serve -hf ggml-org/Qwen4-35B-A3B-GGUF:Q4_K_M --spec-type draft-mtp --spec-draft-n-max 3

The second turns on speculative decoding with the built-in multi-token-prediction head. Use a recent build: the Qwen4 architecture is new.

#MLX on a Mac

bash
mlx_lm.generate --model mlx-community/Qwen4-35B-A3B-4bit-text --prompt "Explain sparse attention like I am 5" --max-tokens 4096

That checkpoint is text only. For image input, multi-token prediction and offloading the n-gram table to SSD, Hugging Face points to oMLX. Support in the official mlx-lm repository was still on its way at launch (MLX vs llama.cpp).

#vLLM on one GPU

At launch vLLM used a dedicated image, vllm/vllm-openai:qwen4 (and vllm/vllm-openai-rocm:qwen4 for AMD). The recipe's default command for the FP8 checkpoint on one GPU:

bash
export VLLM_USE_RUST_FRONTEND=1
vllm serve Qwen/Qwen4-35B-A3B-FP8 \
  --trust-remote-code \
  --enable-prefix-caching \
  --tensor-parallel-size 1 \
  --max-model-len auto \
  --disable-flashinfer-autotune \
  --kv-cache-dtype nvfp4 \
  --attention-config.indexer_kv_dtype fp8 \
  --enable-auto-tool-choice \
  --tool-call-parser qwen4 \
  --reasoning-parser qwen4 \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3,"index_share_for_mtp_iteration":true}'

What the flags do:

  • --kv-cache-dtype nvfp4 stores the KV cache in 4-bit floats, about 3.6 times smaller than BF16 by the recipe's figure; the sparse-attention indexer's cache stays in FP8.
  • --max-model-len auto uses the full 1M-token window if the KV cache allows it, otherwise lowers it and says so in the start-up log.
  • --disable-flashinfer-autotune speeds up start-up; the recipe says to remove it for the best prefill speed.
  • The speculative config uses the built-in MTP head to draft 3 tokens.
  • --trust-remote-code is needed because Qwen4 ships its own tokenizer implementation.

#SGLang

SGLang support was not in a release at launch: use the lmsysorg/sglang:qwen4 image or install from the pull request the cookbook names. The cookbook's interactive panel generates the command for each device; the flags it relies on include --trust-remote-code, --reasoning-parser qwen4, --tool-call-parser qwen4, --speculative-algorithm NEXTN for multi-token prediction, --mem-fraction-static (0.60 to 0.85 depending on the device) and --ple-offload-backend file for keeping the n-gram table off the GPU. Start from the preset for your device rather than assembling the command by hand (vLLM vs SGLang).

#Settings that matter

  • Reasoning effort. Thinking is on by default (high); xhigh, low and off are the alternatives. vLLM's recipe notes that its API takes none, not off, to disable thinking. For agents, lower effort can mean more retries, so compare cost per completed task.
  • Sampling. With thinking on: temperature 1.0, top-p 0.95, top-k 20. With it off: temperature 0.7, top-p 0.8, top-k 20, presence penalty 1.5.
  • Output length. Qwen recommends allowing up to 262,144 tokens of reasoning and 131,072 of final answer on agent tasks; cap these lower for interactive chat.
  • Text only? If you never send images, vLLM's recipe has a text-only option that skips the vision encoder and saves memory.
  • Prefix caching. Linear-attention layers need state checkpoints for prefix reuse; vLLM enables it in its recipe, but check your hit rate on real traffic.

#Which option to pick

You want Use
To try it in five minutes on a Mac or PC Ollama
The most control locally, MTP speed-ups, any quantisation llama.cpp
Apple's own framework on Apple Silicon MLX or oMLX
An OpenAI-compatible server for a team, high concurrency vLLM or SGLang on an RTX PRO 6000, H100, H200 or Blackwell GPU

Sources: model card, vLLM recipe, SGLang cookbook, Hugging Face launch post, Ollama library. Engine support was changing quickly at launch; check the recipes for current versions.

guidelocalhardwareollamallama-cppvllmsglang

Found this useful?

Send it to someone who is learning the same thing.

Share this article

Next: learn it step by step, free

VRAM math

Weights, KV cache and overhead, worked out for real models, so you can size any machine. A free lesson with worked examples and a quiz.

Free 5-day email course

Why LLM inference is slow and how to make it fast. One short email a day for five days, each built on a free lesson, then the occasional new lesson or offer. Unsubscribe in one click.