Qwen 4 35B on RX 580 hardware works: a budget card with 8 GB of GDDR5 runs it. On a desktop I paid 150 dollars for, GPU included, it decoded at 18.2 tokens per second with a 1K prompt and 15.1 with a 32K prompt, inside a 128K window.
The catch is the first long prompt: a 32K prompt takes about two and a half minutes before the first word. After that, each new turn starts in three to five seconds, because the cache holds the conversation.
The machine
| Part | What is in it |
|---|---|
| GPU | Sapphire Nitro+ RX 580, 8 GB GDDR5, PCIe 3.0 x16 |
| CPU | Intel Core i5-6600, 4 cores |
| RAM | 16 GB DDR4-2133, dual channel |
| Board | MSI B150M Mortar |
| OS | Ubuntu 26.04.1, Mesa 26.0.8 RADV |
| Engine | llama.cpp b12974, built with the Vulkan backend |
The model files come from Unsloth's GGUF repository. Each quant has two files: the network itself, and an 11.5 GB n-gram table that is the same in every quant. The main Qwen 4 35B page explains why the download is bigger than 35B.
| Quant | Network file | Table file |
|---|---|---|
| UD-IQ1_S | 9.75 GB | 11.52 GB |
| UD-Q2_K_XL | 16.16 GB | 11.52 GB |
The Q2_K_XL pair is bigger than 8 GB of VRAM and 16 GB of RAM put together, and the IQ1_S pair would leave the system almost nothing. Both still run, for a reason covered below.
The results
Medians of three runs, each a fresh server start. Prompts are source code, 256 tokens generated each time.
UD-IQ1_S, 128K window, 17 of 40 expert layers on the GPU, desktop running:
| Prompt | Decode | Prefill | First word after | Next turn |
|---|---|---|---|---|
| 1K | 18.2 tok/s | 243 tok/s | 4.1 s | 3.0 s |
| 8K | 17.3 tok/s | 280 tok/s | 28.6 s | 3.1 s |
| 32K | 15.1 tok/s | 212 tok/s | 151 s | 4.4 s |
Peak VRAM: 8,012 of 8,192 MiB. The lowest free RAM was 12,647 MiB of 15,421, and swap stayed at 1 MiB.
UD-Q2_K_XL, 64K window, 13 of 40 expert layers on the GPU, desktop logged out:
| Prompt | Decode | Prefill | First word after | Next turn |
|---|---|---|---|---|
| 1K | 13.7 tok/s | 184 tok/s | 5.4 s | 4.2 s |
| 8K | 12.2 tok/s | 187 tok/s | 42.7 s | 3.9 s |
| 32K | 11.3 tok/s | 193 tok/s | 166 s | 5.3 s |
Peak VRAM: 8,036 of 8,192 MiB, which is the edge. Q2_K_XL is the better quant and the one I would use for code; IQ1_S buys the bigger window and about a third more speed. "Next turn" is the same conversation plus 500 new tokens with the prompt cache on, which is how a coding agent like opencode talks to the server.
One honest wrinkle: Q2_K_XL slowed a little from run to run, from 12.6 to 11.4 to 10.5 tok/s at 32K. The card peaked at 55 C, so it was not heat. I have not found the cause yet.
The commands
IQ1_S at 128K:
llama-server -m Qwen4-35B-A3B-UD-IQ1_S-00001-of-00002.gguf \
-c 131072 -ngl 999 --n-cpu-moe 23 \
-ot per_layer_token_embd=CPU --load-mode mmap --lazy-mode on \
-fa on --fit off -t 4 -ub 2048 -ctk q8_0 -ctv q8_0
Q2_K_XL at 64K: the same line with the Q2_K_XL file, -c 65536 and --n-cpu-moe 27.
--n-cpu-moe is the number of expert layers kept in system RAM. Lower it until VRAM is almost full: every layer you bring onto the card is speed. On this card 23 is the floor for IQ1_S at 128K and 27 for Q2_K_XL at 64K.
What made the difference
My first run put every expert in RAM, with an f16 cache and -ub 512: 13.2 tok/s with a 1K prompt, 10.5 with 8K, and only 3,333 MiB of VRAM used. These changes took it to the numbers above.
| Change | Effect |
|---|---|
| 18 expert layers onto the GPU, same cache and batch | 1K decode from 13.2 to 14.3 tok/s |
-ub 2048 and a q8_0 cache, which made room for 3 more layers (21 on the GPU) |
32K first word in 150 s instead of 233 s; 1K decode from 14.3 to 19.4 tok/s |
| Log out of the desktop (Q2_K_XL) | room for one more expert layer: 8K decode 14.1 against 12.8, 8K first word 37 s against 64 s |
The first two rows are single runs, and the 18-layer run shared the machine with a download, so read them as direction, not precise gains. The q8_0 cache matters at long windows because it roughly halves the cache and frees VRAM for experts.
The catch: the first long prompt
Decode stays between 11 and 18 tok/s at every prompt size, which is fine for reading along. Prefill is what you wait for: 184 to 280 tokens per second here, so a 32K prompt takes 151 seconds on IQ1_S and 166 on Q2_K_XL.
In a coding agent that cost is paid once per session. The cache keeps the conversation, and every following turn in my tests started in 3.0 to 5.3 seconds, even after a 32K first turn. Qwen 4 mixes attention layers with recurrent ones, and the cache reuse still worked.
What did not help
| Tried | Result |
|---|---|
| MTP speculative decoding, 2 drafts | 59% of drafts accepted, 12.84 tok/s against 12.84 without it |
--spec-type ngram-mod |
made no drafts, 12.90 tok/s |
| GPU forced to its top power state, CPU on the performance governor | 17.6 / 15.9 / 14.7 tok/s against 18.2 / 17.3 / 15.1 untuned |
| Resizable BAR | not available: the card supports a BAR up to 8 GB, but this 2016 BIOS gives the system no address space above 4 GB even with Above 4G enabled |
MTP guesses well, but every guess still has to be checked against experts that live in RAM, and the card has no room left for the draft head. On this machine the gain cancels out. That is the opposite of a 24 GB RTX 3090 holding every expert in VRAM, where a Strata fork reports MTP pushing decode past 300 tok/s.
Where the 11.5 GB table goes
--lazy-mode on with --load-mode mmap makes llama.cpp read only the rows of the n-gram table for the tokens it is processing, straight from the file. Linux keeps the rows it has read in spare RAM. So the table is neither fully in RAM nor read from disk every time. On IQ1_S the whole server process peaked at 10,276 MiB of RAM at a 32K prompt, against 21.3 GB of files on the SSD.
If your card or RAM is different, the calculator sizes the rest of the model, and the GPU checker lists what else fits.
The model made its own picture
The image at the top of this page started on the same machine. I gave Qwen 4 35B (UD-Q2_K_XL) the site's brand rules and asked for a 1600 by 900 card as one HTML file. It wrote the layout, the type, the texture and the colours in 264 seconds, 3,471 tokens at 13.2 tok/s. It drew the GPU itself in CSS; I swapped that for Sapphire's official photo of this exact card and made the title a little smaller. Everything else is its work.
It is the second time a model has made something for this site on this card. The first was Ornith 1.5 9B writing an article about itself.
FAQ
Can Qwen 4 35B run on 8GB of VRAM?
Yes. On an RX 580 8 GB with 16 GB of RAM, UD-IQ1_S ran at 15.1 to 18.2 tok/s with a 128K window, and UD-Q2_K_XL at 11.3 to 13.7 tok/s with a 64K window. Most of the experts stay in system RAM.
How much system RAM does Qwen 4 35B need with an 8 GB card?
16 GB was enough for both quants here: on IQ1_S free RAM never fell below 12,647 MiB. The n-gram table is read from the SSD on demand, so it does not have to fit in RAM.
Which quant should I use on 8 GB?
UD-Q2_K_XL if 64K is enough, because it is the better quant. UD-IQ1_S if you want a 128K window or the extra speed.
Why is the first answer so slow?
The model has to read your whole prompt first, at 184 to 280 tokens per second on this card. A 32K prompt takes about two and a half minutes. Later turns reuse the cache and start in a few seconds.
Does speculative decoding help on an 8 GB card?
Not here. MTP and ngram-mod both left decode where it was, at 12.84 and 12.90 tok/s.