Yes, Qwen4-35B-A3B runs on an 8GB, 12GB or 16GB graphics card. It is a mixture-of-experts model with 35 billion parameters but only about 3 billion active per token, so with llama.cpp you keep the small, always-used part on the GPU and move most of the “expert” weights into system RAM with --n-cpu-moe. Qwen4 adds one new piece: a 20-billion-parameter n-gram table that llama.cpp reads from your SSD on demand instead of loading into memory. The result is that the recommended 4-bit file, a 36GB download, needs about 25GB of VRAM and RAM together. In practice that means 32GB of system RAM for 4-bit, or 16GB of RAM for a 3-bit file.
Below I explain what changed from Qwen 3.6, which file to download for your RAM, the exact commands for 8GB, 12GB and 16GB cards, how to tune them, the thinking levels, how much of the 1M-token context you can afford, the built-in speed-up called MTP, and what speed to expect. Model details come from Qwen’s own model card and configuration, and file sizes from Unsloth’s Qwen4 guide, all checked on 5 December 2026. Where a number is my own calculation, I say so.
What Qwen4-35B-A3B is, and what changed from Qwen 3.6
Qwen4-35B-A3B is the first medium-sized model of Qwen’s fourth generation, released on 4 December 2026 under the Apache 2.0 licence. The name tells you most of what matters: 35B is the total number of parameters and A3B means about 3 billion are active for each token. According to the official model card, it also includes a vision encoder, so it reads screenshots and photos, and it supports a native context of 1,048,576 tokens.
If you followed my Qwen 3.6 35B-A3B guide, most of the method carries over. Wondering whether to switch at all? My Qwen4 vs Qwen 3.6 comparison answers that first. The expert layout is the same, so the same --n-cpu-moe trick works. Three things are different, and two of them change how you run it:
| Qwen 3.6 35B-A3B | Qwen4-35B-A3B | |
|---|---|---|
| Parameters | 35B total, 3B active | 35B total, 3B active, plus a 20B n-gram embedding and a 2B MTP module |
| Layers and experts | 40 layers, 256 experts, 8 routed + 1 shared | 40 layers, 256 experts, 8 routed + 1 shared |
| Attention | Linear attention in 3 of every 4 layers, full attention in 10 layers | Gated DeltaNet in 3 of every 4 layers, Qwen Sparse Attention in 10 layers |
| Native context | 262,144 tokens | 1,048,576 tokens |
| Thinking control | On or off | Four levels: xhigh, high (default), low and off |
| 4-bit UD-Q4_K_XL file | 22.4GB | 36.2GB download, about 24.7GB in memory |
| Needs | Any recent llama.cpp | llama.cpp with Qwen4 support, merged on 3 December 2026 |
The n-gram embedding. This is the part that confuses people when they see a 36GB download for a model that is supposed to fit in 25GB. Qwen added a lookup table of 10 million common two-word and three-word sequences (bigrams and trigrams), each stored as a 2,048-number vector, which comes to about 20 billion parameters. It is injected once, at layer 2. The model card says it “improves model quality without extra compute or accelerator memory overhead”. Unsloth calls it the engram. Because each token only looks up a handful of rows, llama.cpp does not need to load it: it maps the file and reads the rows it needs from disk.
Sparse attention. The 10 full-attention layers now use Qwen Sparse Attention: a small indexer picks the most relevant 2,048 tokens of the past for each new token, instead of looking at all of them. The cache layout is the same as Qwen 3.6 (2 key-value heads of size 256), so memory per token stays tiny, but long prompts get faster.
MTP in every file. Qwen 3.6 also had a multi-token prediction head, a small extra layer that guesses the next tokens ahead of time. What is new is that Unsloth ships it inside every Qwen4 GGUF, so llama.cpp can use it for speculative decoding with two flags. I cover it in section 12.
Why a 35B model fits on an 8GB card
A dense 35B model would need all 35 billion weights for every token it writes. Qwen4-35B-A3B does not. Each of its 40 layers holds 256 small experts, and a router picks only 8 of them for each token, plus one shared expert that is always on. From the model configuration, the routed experts make up the large majority of the weights, yet a single token touches only about 1 billion of them. That is why you can split the model across three kinds of storage and still get usable speed:
Attention and linear-attention layers, shared experts, embeddings, the output layer and the context cache. About 3GB of the 4-bit file, used for every token, plus the experts of as many layers as you have room for.
Routed experts of the layers you send to the CPU with --n-cpu-moe. Each token needs only 8 of the 256 experts in a layer, so the CPU reads roughly half a gigabyte per token, not 20GB.
The 11.5GB n-gram table of the 4-bit download. With --lazy-mode on llama.cpp reads just the rows each token needs. Windows keeps recently read parts in its file cache, which uses spare RAM but is given back whenever an app needs it.
Your VRAM decides speed. Your system RAM decides which file you can use. Your SSD needs space for the whole download, about 37GB for 4-bit, and should be an NVMe or SATA SSD rather than a hard drive.
The context cache also stays small. Three out of every four layers use Gated DeltaNet, a form of linear attention with a fixed-size memory of about 63MB in total by my calculation. Only the 10 sparse-attention layers keep a cache that grows with the conversation, and they use just 2 key-value heads. Section 11 puts numbers on it.
What you need before you start
| Part | Minimum | Comfortable |
|---|---|---|
| Graphics card | NVIDIA with 8GB VRAM (RTX 3060 Ti, 3070, 4060, 4060 Ti 8GB, 5060) | 12GB (RTX 3060 12GB, 4070, 5070) or 16GB (RTX 4060 Ti 16GB, 4070 Ti Super, 4080, 5060 Ti 16GB, 5070 Ti, 5080) |
| System RAM | 16GB with a 3-bit file | 32GB with the 4-bit file, 48GB or more for 5-bit and 6-bit |
| Free disk space | 30GB for a 3-bit file | 40GB or more on an NVMe SSD |
| Software | llama.cpp with Qwen4 support (any release from 3 December 2026 on) | The latest llama.cpp release, kept up to date |
The rule that matters most: VRAM plus system RAM must be larger than the resident size of the file, with a few gigabytes left for Windows and your other apps. Unsloth’s Qwen4 guide lists the total memory each quantisation needs: about 10 to 11GB for 1-bit, 12 to 16GB for 2-bit, 17 to 19GB for 3-bit, 21 to 25GB for 4-bit, 26 to 28GB for 5-bit, 29 to 31GB for 6-bit and 41GB for 8-bit. These totals already assume the n-gram table stays on the SSD.
Here is how that works out for common combinations. The picks are mine, based on Unsloth’s sizes and leaving about 4 to 6GB of RAM for Windows:
| Your PC | Total memory | File I would use | Notes |
|---|---|---|---|
| 8GB card + 16GB RAM | 24GB | UD-IQ3_XXS (17.2GB) | Close the browser and other heavy apps; keep context at 32K |
| 8GB card + 32GB RAM | 40GB | UD-Q4_K_XL (24.7GB) | The best balance on an 8GB card |
| 12GB card + 16GB RAM | 28GB | UD-Q3_K_XL (19.4GB) | Unsloth’s pick for a 16GB GPU, and it fits here too |
| 12GB card + 32GB RAM | 44GB | UD-Q4_K_XL (24.7GB) | Room for 64K context and the vision file |
| 16GB card + 16GB RAM | 32GB | UD-IQ4_XS (20.5GB) | Unsloth reports 95.2% accuracy for this file in its tests |
| 16GB card + 32GB RAM | 48GB | UD-Q4_K_XL or UD-Q5_K_XL | Q5 only if you rarely need more than 64K context |
AMD and Intel cards work too, through llama.cpp’s Vulkan, ROCm or SYCL builds, and every flag in this guide applies to them. The commands below use the NVIDIA CUDA build because it is what most people have. Apple Silicon Macs share one pool of memory, so the GPU and RAM split does not apply there; follow Unsloth’s Mac instructions instead.
The whole setup at a glance
Step 1: pick the right file for your memory
Quantisation shrinks a model by storing each weight with fewer bits. Unsloth’s “UD” (dynamic) files keep the most sensitive layers at higher precision, so they hold up better than plain quantisation at the same size. For Qwen4 there are two sizes to look at: the download, which includes the n-gram table, and the resident size, which is what actually has to fit in your VRAM and RAM.
| File | Download | Resident in VRAM + RAM | Who it is for |
|---|---|---|---|
UD-IQ1_M | 22.3GB | 10.8GB | Emergency only; Unsloth notes small quants can loop |
UD-IQ2_XXS | 23.4GB | 11.9GB | Unsloth’s pick for 12GB of total memory |
UD-IQ2_M | 26.6GB | 15.1GB | Better than IQ2_XXS if you have the room |
UD-IQ3_XXS | 28.7GB | 17.2GB | 8GB card + 16GB RAM |
UD-Q3_K_XL | 30.9GB | 19.4GB | 12GB card + 16GB RAM; Unsloth’s pick for 16GB GPUs |
UD-IQ4_XS | 32.0GB | 20.5GB | 16GB card + 16GB RAM, or 24GB total |
UD-Q4_K_XL | 36.2GB | 24.7GB | The sweet spot with 32GB RAM |
UD-Q5_K_XL | 43.2GB | 27.8GB | 16GB card + 32GB RAM, short context |
UD-Q6_K | 50.9GB | 29.2GB | 48GB RAM or more |
All sizes are from Unsloth’s quantisation table, with the n-gram table kept on disk. For every file up to 4-bit, the table itself is the 11.5GB second part of the download, stored at IQ4_NL precision. Larger files ship it at higher precision: Q5 files use a 15.4GB version and Q6 files a 21.8GB Q8_0 version.
How much quality do you lose? Unsloth tested its files on GSM8K, MATH-500, CRUXEval-O and MMLU-Pro with thinking on. It reports 95.0% for UD-Q4_K_XL against 95.3% for the full BF16 model, 95.2% for UD-IQ4_XS, 94.0% for UD-Q3_K_XL and 89.6% for the tiny UD-IQ1_S. Unsloth also reports perfect scores on the RULER long-context test at 32K, 64K and 128K for its 3-bit and 4-bit files. Those are Unsloth’s own measurements, but they match what I would expect: 4-bit is very close to the original, 3-bit is fine for everyday use, and below 3-bit you start to notice mistakes.
- 32GB RAM:
UD-Q4_K_XL. Best quality that leaves room for Windows and a browser. - 24GB of total memory:
UD-IQ4_XS. Nearly the same accuracy in Unsloth’s tests, 4GB smaller. - 16GB RAM with an 8GB card:
UD-IQ3_XXS. Good for chat and simple coding; keep the context short. - Want to show it images? Also get
mmproj-BF16.gguf(0.9GB). Section 13 explains how. - Avoid Unsloth’s non-UD names for the same size unless you have a reason; the UD versions scored better in Unsloth’s tests.
The files live in Unsloth’s Hugging Face repository. llama.cpp’s own team also publishes plain Q4_K_M and Q8_0 files in the ggml-org repository, which work the same way. The model is released under Apache 2.0, so you can use it for personal and commercial work.
Step 2: install a llama.cpp that knows Qwen4
Qwen4 needs a llama.cpp build with support for its new architecture. According to Unsloth and the ggml-org model page, that support arrived in pull request #33626, merged on 3 December 2026. Any release after that works. Older builds fail with an error about an unknown model architecture.
- Download two zip files
Open the llama.cpp releases page. For an NVIDIA card, take the CUDA build and the matching CUDA runtime from the same release. In release b13016 from 5 December 2026 they are named
llama-b13016-bin-win-cuda-12.4-x64.zipandcudart-llama-bin-win-cuda-12.4-x64.zip. RTX 50 owners can use the CUDA 13.5 pair instead. - Unzip both into one folder
For example
C:\llama. There is no installer; the folder is the program. - Check that it runs
Open PowerShell in that folder (Shift + right-click in the folder, then Open in Terminal) and run the version command below. The date of the release you downloaded must be 3 December 2026 or later.
.\llama-server.exe --version
If you have an AMD card on Windows, take the Vulkan zip instead; it needs no runtime download. On Linux, build from source with CUDA turned on:
git clone https://github.com/ggml-org/llama.cpp
cmake llama.cpp -B llama.cpp/build -DGGML_CUDA=ON
cmake --build llama.cpp/build --config Release -j --target llama-server llama-cli
The flags in the rest of this guide are the same on Windows and Linux. On Linux, replace the backtick at the end of each line with a backslash and drop the .\ and .exe.
Step 3: download the model
You have two options. The simplest is to let llama.cpp download it for you the first time you start the server, using -hf. It fetches both parts of the file and the vision projector, and stores them in its cache folder. The commands in the next section use this method.
If you want the files in a folder you choose, for example on a second SSD with more space, download them with the Hugging Face command-line tool. Install it once with pip install -U huggingface_hub, then:
hf download unsloth/Qwen4-35B-A3B-GGUF `
--include "UD-Q4_K_XL/*" "mmproj-BF16.gguf" `
--local-dir D:\models\Qwen4-35B-A3B-GGUF
The 4-bit download arrives as two parts: Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf, which holds the model, and the second part, which is the n-gram table. Point llama.cpp at the first part and it finds the second automatically. Then use -m with that path instead of -hf in the commands below:
-m D:\models\Qwen4-35B-A3B-GGUF\UD-Q4_K_XL\Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf
Put the files on an SSD. The n-gram table is read from disk while the model writes, so on a hard drive every token waits for the disk. If the folder is on a hard drive, move it before you blame the model for being slow.
Step 4: the commands for 8GB, 12GB and 16GB cards
The flag that makes a small card work is --n-cpu-moe N. According to the llama.cpp server documentation, it keeps the mixture-of-experts weights of the first N layers on the CPU. Qwen4-35B-A3B has 40 layers, and at 4-bit each layer of experts is about 0.54GB, so each step you lower N moves another half gigabyte onto the GPU.
I worked out a safe starting value for each card. The numbers below are my estimate from the file sizes, leaving about 0.8GB for Windows and the display, plus room for the compute buffers. They should load first time; section 9 shows how to fine-tune them.
8GB card with 32GB of RAM (4-bit, 32K context):
.\llama-server.exe `
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL `
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU `
--n-cpu-moe 36 --no-mmproj `
-c 32768 -np 1 -fa on -ctk q8_0 -ctv q8_0 `
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 `
--port 8080
8GB card with 16GB of RAM (3-bit, 16K context). Each 3-bit layer of experts is smaller, about 0.36GB, so more of them fit:
.\llama-server.exe `
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-IQ3_XXS `
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU `
--n-cpu-moe 32 --no-mmproj `
-c 16384 -np 1 -fa on -ctk q8_0 -ctv q8_0 `
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 `
--port 8080
12GB card with 32GB of RAM (4-bit, 64K context):
.\llama-server.exe `
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL `
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU `
--n-cpu-moe 29 --no-mmproj `
-c 65536 -np 1 -fa on -ctk q8_0 -ctv q8_0 `
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 `
--port 8080
16GB card with 32GB of RAM (4-bit, 128K context):
.\llama-server.exe `
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL `
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU `
--n-cpu-moe 23 --no-mmproj `
-c 131072 -np 1 -fa on -ctk q8_0 -ctv q8_0 `
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 `
--port 8080
When the server says it is listening, open http://127.0.0.1:8080 in your browser. llama.cpp has its own chat page there, so you can start talking to the model straight away. Here is what each flag does:
| Flag | What it does |
|---|---|
-hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL | Downloads (first time) and loads that file. Replace with -m path if you downloaded it yourself. |
--load-mode mmap | Maps the file into memory instead of copying it. Required for the next flag. |
--lazy-mode on | Reads rows of very large lookup tables from disk on demand. This is what keeps the n-gram table on the SSD. The default, auto, does the same for tables over 4GiB. |
-ot per_layer_token_embd=CPU | Tells llama.cpp to keep the n-gram table (its internal name is per-layer token embedding) on the CPU side, never on the GPU. This is Unsloth’s recommended setting. |
--n-cpu-moe N | Keeps the expert weights of the first N of the 40 layers in system RAM. Lower N puts more on the GPU: faster, but more VRAM. |
--no-mmproj | Skips the 0.9GB vision projector that -hf would otherwise load. Remove it if you want image input. |
-c 32768 | Context size in tokens. Always set it: if you leave it out, llama.cpp takes the size from the model, which for Qwen4 is 1M tokens. |
-np 1 | One conversation slot. With several slots, the context is shared between them, which you do not want on a small card. |
-fa on | Flash attention: less memory for the cache and faster long prompts. Needed for an 8-bit cache. |
-ctk q8_0 -ctv q8_0 | Stores the context cache in 8-bit instead of 16-bit, halving its size with very little quality cost. |
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 | Qwen’s recommended sampling for thinking mode, from the model card. |
--port 8080 | The address the server listens on: http://127.0.0.1:8080. Only your own PC can reach it unless you add --host. |
The first start takes a while because of the download. After that, loading takes from a few seconds to about a minute, depending on your SSD.
Step 5: tune it for your card
The starting values are deliberately cautious. Your card may have more room, especially if you have no other programs on the GPU. Tuning takes ten minutes and is worth it, because every layer of experts you move onto the GPU makes each token a little faster.
- Open Task Manager
Go to Performance, then GPU, and watch Dedicated GPU memory. On Linux, run
nvidia-smiin a second terminal. - Start the server and send a long prompt
Paste in a long document and ask for a summary, so the cache and buffers reach their full size. Memory use at idle is lower than in real use.
- Lower --n-cpu-moe by 1 or 2
Restart with the smaller number. Repeat while dedicated memory stays at least 0.5GB below the card’s total during that long prompt.
- Step back one if it fails
If loading fails with an out-of-memory error, or the speed suddenly drops because Windows starts sharing system memory with the GPU, go back to the last number that worked.
- Save the command
Put the final command in a file called
qwen4.bat(replace the backticks with^, or put everything on one line) so you can start it with a double-click.
Watch for shared GPU memory. On Windows, an NVIDIA card that runs out of VRAM can quietly spill into system RAM instead of failing. Everything still works, but speed can fall by half or more. If Task Manager shows shared GPU memory climbing while the model runs, raise --n-cpu-moe by 1 or 2.
What about automatic fitting? Recent llama.cpp builds have --fit, which is on by default. It adjusts any settings you have not set yourself so the model fits in VRAM, leaving a 1GB margin by default. If you leave out --n-cpu-moe and -c, it will try to do the job for you. I still prefer setting both: you know exactly what you get, and the result does not change when you update llama.cpp.
The GPU expert cache. llama.cpp also has --moe-cache-mib N, which reserves N megabytes of VRAM as a cache for the experts that live in system RAM. Experts that the router picks often stay on the GPU, so fewer have to be read from RAM. Unsloth reports that on its test machine this almost doubled decoding speed: from 53 to 95 tokens per second with 8GB of VRAM, and from 70 to 127 with 16GB. Unsloth does not list the exact cache size it used, so treat this as something to experiment with. My suggestion is to raise --n-cpu-moe by 2 to free about 1GB, then add --moe-cache-mib 1024, and compare the speed on the same prompt.
Loading fails, the first long prompt crashes the server, shared GPU memory climbs, or you want a longer context or the vision file.
Task Manager shows more than 1GB of dedicated memory free during a long prompt, and no shared memory in use.
Thinking levels and sampling settings
Qwen4 thinks before it answers by default. Unlike Qwen 3.6, which could only switch thinking on or off, Qwen4 has four levels, according to the model card. llama.cpp passes the level to the model with --reasoning-effort, or you can switch thinking off completely with --reasoning off:
| Level | Flag | When to use it |
|---|---|---|
| xhigh | --reasoning-effort xhigh | Hard maths, tricky bugs, planning. Slowest, and uses the most context. |
| high (default) | nothing, or --reasoning-effort high | Most coding and analysis work. |
| low | --reasoning-effort low | Quick questions where you still want a short check. |
| off | --reasoning off | Chat, writing, translation, summaries. Answers start at once. |
Qwen recommends different sampling settings for thinking and non-thinking use. The commands above use the thinking values. For non-thinking mode, replace the sampling line with this one, which adds a presence penalty to stop repetition:
--reasoning off --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.0 --presence-penalty 1.5
On an 8GB card, thinking costs you twice: it takes time, and the thinking text fills the context. The model card allows up to 262,144 tokens of reasoning on hard tasks, which no small card can hold. For everyday use on 8GB I would run with --reasoning-effort low or --reasoning off, and start a separate server with high for the hard problems.
The model card also notes that Qwen4 keeps its earlier thinking in the conversation by default (preserve_thinking is on). That helps agents and long coding sessions stay consistent, but it also means the context fills faster. If you run long chats, my posts on context compaction thresholds and Open WebUI compaction show how to keep them under control.
Using one of the smallest files (UD-IQ1_S, UD-IQ1_M or UD-IQ2_XXS)? Unsloth found that these sometimes loop. It recommends --min-p 0.01 and --presence-penalty 1.5 for them, in both modes.
How much of the 1M-token context can you afford?
Qwen4 supports 1,048,576 tokens natively, about 750,000 words. Whether you can use that depends on memory, and here Qwen4 is unusually frugal. Only 10 of its 40 layers keep a growing cache, and each stores 2 key-value heads of 256 numbers. From the configuration, I calculate about 20KB per token with a 16-bit cache, and half that with -ctk q8_0 -ctv q8_0. The sparse-attention indexer stores a small extra set of keys, which I have left out because it is a fraction of the total.
| Card (4-bit file) | Context I would start with | Cache at 8-bit | Longest that is realistic |
|---|---|---|---|
| 8GB | 32K tokens | 0.34GB | 64K, with --n-cpu-moe raised by 1 |
| 12GB | 64K tokens | 0.67GB | 128K, with --n-cpu-moe raised by 2 |
| 16GB | 128K tokens | 1.34GB | 256K, with --n-cpu-moe raised by 3 |
| Any card, cache in RAM | Up to 1M tokens | 10.7GB of system RAM | Use -nkvo; slow, but possible with 64GB RAM |
The trade is simple: every gigabyte of cache on the GPU is a gigabyte less for experts. About 0.54GB of cache costs you one layer of experts, which is one step up on --n-cpu-moe. For most people, 32K to 128K is the right range. A 32K context already holds a long chat or a few source files.
The -nkvo flag keeps the whole cache in system RAM instead. That frees VRAM for experts but makes long prompts slower, because attention then runs on the CPU. It only makes sense when you really need a very long context and have the RAM for it.
One more thing: a long context is not just memory. Reading a 100K-token document takes time before the first word appears, even with sparse attention. On a small card, expect long documents to take minutes, not seconds, to read in. Short chats feel instant.
MTP: the free speed-up built into every file
Multi-token prediction (MTP) is a small extra layer, 2 billion parameters in the original model, that guesses the next one or two tokens before the main model confirms them. When the guess is right, you get two or three tokens for the price of one pass. According to Unsloth, every one of its Qwen4 GGUF files already includes the MTP head, so there is no separate download. In its 4-bit files the head is about 0.59GB; in files up to 3-bit, 0.49GB.
Switch it on with two flags added to any command above:
--spec-type draft-mtp --spec-draft-n-max 2
The second flag sets how many tokens the head guesses ahead. Unsloth measured how often the guesses are accepted: about 0.89 with one token ahead, 0.68 with two and around 0.5 with three. It recommends two, and found depths of three and four slower than two. On its test hardware, MTP made decoding about 1.2 to 1.35 times faster with the 4-bit file, with code gaining more than prose because code is more predictable.
On an 8GB card already at its limit, the 0.6GB head costs you one layer of experts. The speed-up and the loss can cancel out. Test both with the same prompt and keep whichever is faster.
Your GPU has spare room for the extra head, and you mostly generate code, structured text or long answers. Expect the biggest gain when most experts are on the GPU.
To compare, look at the timing line the server prints after each answer, or the speed shown under each reply in the built-in chat page. Use the same prompt, with thinking off, so the answers are the same length.
Showing it images: the vision projector
Qwen4-35B-A3B is multimodal: it can read screenshots, photos, charts and scanned pages. The image part lives in a separate file called the vision projector, or mmproj. Unsloth provides it in BF16, F16 and F32; the BF16 and F16 versions are about 0.9GB.
When you use -hf, llama.cpp downloads and loads the projector automatically. That is why the commands above include --no-mmproj: on a small card, 0.9GB is nearly two layers of experts. To use images, remove --no-mmproj and raise --n-cpu-moe by 2. If you downloaded the files yourself, add --mmproj followed by the path to mmproj-BF16.gguf.
On an 8GB card there is another option: --no-mmproj-offload keeps the projector in system RAM. Images then take longer to process, but you keep all your VRAM for the language model. Once loaded, you can drag an image into the built-in chat page, or send it through the OpenAI-compatible API as an image URL or base64 data.
What speed to expect
Speed depends far more on your system RAM and CPU than on the GPU, because the experts that live in RAM are read for every token. Each token needs about 1 billion expert parameters, roughly 0.57GB at 4-bit, and most of that comes from RAM when you have a small card.
The only published numbers I can point to are Unsloth’s. With the 4-bit file, Unsloth reports 53 tokens per second with 8GB of VRAM and 70 with 16GB, rising to 95 and 127 with the expert cache switched on. Those figures come from Unsloth’s own test machine, which almost certainly has faster RAM and a faster CPU than a typical gaming PC, so treat them as a ceiling rather than a promise.
| What you will notice | What decides it | What helps |
|---|---|---|
| Writing speed (tokens per second) | System RAM bandwidth and the share of experts on the GPU | Dual-channel DDR5, lower --n-cpu-moe, the expert cache, MTP |
| Waiting before the first word | Prompt length and GPU compute | Shorter prompts, a faster GPU, flash attention |
| Pause before every answer | Thinking | --reasoning-effort low or --reasoning off |
| Slow start-up | SSD speed | Keep the files on an NVMe SSD |
My own rough expectation for an ordinary desktop, based on how similar 3B-active models behave: comfortably faster than you can read on DDR5, and slower but still usable on DDR4 or a laptop with single-channel memory. If your speed is far below that, the usual causes are shared GPU memory (section 9), a hard drive, or a single RAM stick running in single-channel mode.
A quick way to measure is the timing line the server prints after every reply. It shows prompt processing and generation speed separately, so you can see which one is slow and fix the right thing.
Using it from other apps and coding tools
llama-server speaks the same API as OpenAI, so most AI apps can use it. Point them at http://127.0.0.1:8080/v1 with any text as the API key. You can test it from PowerShell:
$body = '{"model":"qwen4","messages":[{"role":"user","content":"Explain mixture of experts in two sentences."}]}'
Invoke-RestMethod -Uri http://127.0.0.1:8080/v1/chat/completions -Method Post `
-ContentType "application/json" -Body $body | Select-Object -ExpandProperty choices
- Open WebUI, LibreChat and similar chat apps: add an OpenAI-compatible connection with the address above.
- Coding agents and editors: use the same address as a custom OpenAI endpoint. Tool calling works because llama.cpp uses the model’s own chat template by default.
- Your own scripts: any OpenAI client library works; only the base URL changes.
- Agents that read large tool outputs: keep an eye on context. My guide to keeping JSON tool output safe during compaction applies here too.
Everything runs on your own PC. Nothing leaves it unless you open the server to your network yourself with --host 0.0.0.0; if you do, also set --api-key so not just anyone on the network can use it.
Ollama, LM Studio and Unsloth Desktop
You do not have to use llama.cpp directly. The alternatives are easier to start with, but each gives you less control over where the model lives, which is exactly what a small card needs.
| App | How to start | Good for | Limits on a small card |
|---|---|---|---|
| Ollama | ollama run qwen4 | One command, quick first try | The qwen4 download is 36 to 37GB, and I found no per-tensor or --n-cpu-moe control |
| LM Studio | Search for Qwen4-35B-A3B and pick a GGUF | A friendly chat window | Needs an update with Qwen4 support; check its settings for an expert offload option |
| Unsloth Desktop | Search unsloth/Qwen4-35B-A3B-GGUF in its Model hub | Picks where the engram goes for you | Newer and less widely used than the others |
| llama.cpp | The commands in this guide | Full control: experts, engram, cache, MTP | More typing; no installer |
The Ollama library page lists tags for the default file, q4_K_M, BF16 and NVFP4 versions, all with the full 1M context. Because Ollama manages memory for you, I could not confirm how it handles the n-gram table or experts on an 8GB card, so I would not start there with a small GPU. On 16GB with 32GB of RAM, it is a reasonable first try.
Unsloth Desktop, according to Unsloth, chooses where to keep the engram automatically and can also serve an API. If you are new to local AI and find the command line off-putting, it is the easiest route that still understands Qwen4’s three-tier layout. For more beginner-friendly tools, see my list of the best free AI tools for low-end PCs.
If something goes wrong
| Problem | Likely cause | Fix |
|---|---|---|
| Error about an unknown model architecture | llama.cpp is too old | Download a release from 3 December 2026 or later |
| Out of memory while loading | --n-cpu-moe too low or context too large | Raise --n-cpu-moe by 2, or halve -c |
| Uses 30GB or more of RAM | The n-gram table was loaded into memory | Add --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU |
Huge memory use with no -c | Context defaulted to 1M tokens | Always set -c, for example -c 32768 |
| Very slow, GPU nearly idle | VRAM spilled into shared memory, or a hard drive | Raise --n-cpu-moe; move the files to an SSD |
| Windows becomes sluggish | Not enough RAM left over | Use a smaller file or close other apps |
| Long pause before every answer | Thinking is on (default high) | Add --reasoning-effort low or --reasoning off |
| Answers repeat or loop | Sampling settings or a very small file | Use Qwen’s values; for 1-bit and 2-bit files add --min-p 0.01 --presence-penalty 1.5 |
| Cannot send images | Vision projector skipped | Remove --no-mmproj or add --mmproj with the file path |
| Download stops part-way | Network or disk space | Run the same command again; it resumes. Check you have 40GB free |
| Command fails in PowerShell | Line breaks | Each line except the last must end with a space and a backtick |
Common questions
Can I run Qwen4-35B-A3B with 16GB of system RAM?
Yes, with the 3-bit UD-IQ3_XXS file and at least an 8GB card. Close the browser and other heavy apps, and keep the context at 16K to 32K.
Does it work on a 6GB card?
It can load with --cpu-moe, which keeps all experts in RAM, and a short context, but there is little VRAM left for speed. I would treat 8GB as the practical minimum.
Why is the download so much bigger than the memory it needs?
About 11.5GB of the 4-bit download is the n-gram table. With the flags in this guide it stays on the SSD and is read a few rows at a time.
Is Qwen4 better than Qwen 3.6 35B-A3B?
Unsloth says so: it calls it the strongest model under 50B and reports 61.8 on DeepSWE v1.1 and 21.2 on Terminal-Bench 4.1. Those are their figures; try both on your own tasks.
Will it wear out my SSD?
No. The n-gram table is only read, never written, and reading does not wear an SSD the way writing does.
Can I use the full 1M context on 16GB?
Not on the GPU. At 8-bit the cache alone is about 10.7GB. With -nkvo and 64GB of system RAM it is possible, but slow.
Is it free for commercial use?
Yes. Qwen releases it under the Apache 2.0 licence. Check the model card for the exact terms.
Can I fine-tune it on my PC?
Not on an 8 to 16GB card in any practical way. Unsloth supports training Qwen4, but a 35B model needs far more memory to train than to run.
Does this work on a laptop?
Yes, if it has an 8GB or larger NVIDIA GPU and 32GB of RAM. Laptops are often slower because of single-channel RAM and power limits. With less, see my guide to running a local LLM on an 8GB laptop.
Is my data private?
Yes. llama.cpp runs everything on your own PC and sends nothing anywhere, unless you open the server to the network yourself.
Your next step
If you have 32GB of RAM, download UD-Q4_K_XL and start with --n-cpu-moe 36 on an 8GB card, 29 on 12GB or 23 on 16GB, keeping the three engram flags in every command. Then lower the number until Task Manager shows the GPU nearly full without touching shared memory. Those few flags are the difference between a 36GB download that will not load and a 35B model you can use every day.
Sources: Qwen4-35B-A3B model card, model configuration, Unsloth GGUF files, Unsloth Qwen4 guide, ggml-org GGUF files, llama.cpp server options, llama.cpp releases, llama.cpp Qwen4 support pull request, Ollama qwen4 library page.