Instructions to use stealth-model/Qwen4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use stealth-model/Qwen4 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf stealth-model/Qwen4:Q4_K_M # Run inference directly in the terminal: llama cli -hf stealth-model/Qwen4:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf stealth-model/Qwen4:Q4_K_M # Run inference directly in the terminal: llama cli -hf stealth-model/Qwen4:Q4_K_M
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf stealth-model/Qwen4:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf stealth-model/Qwen4:Q4_K_M
Use Docker
docker model run hf.co/stealth-model/Qwen4:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use stealth-model/Qwen4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "stealth-model/Qwen4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "stealth-model/Qwen4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/stealth-model/Qwen4:Q4_K_M
- Ollama
How to use stealth-model/Qwen4 with Ollama:
ollama run hf.co/stealth-model/Qwen4:Q4_K_M
- Unsloth Desktop
- Pi
How to use stealth-model/Qwen4 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf stealth-model/Qwen4:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "stealth-model/Qwen4:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use stealth-model/Qwen4 with Docker Model Runner:
docker model run hf.co/stealth-model/Qwen4:Q4_K_M
- Lemonade
How to use stealth-model/Qwen4 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull stealth-model/Qwen4:Q4_K_M
Run and chat with the model
lemonade run user.Qwen4-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use stealth-model/Qwen4 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf stealth-model/Qwen4:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default stealth-model/Qwen4:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use stealth-model/Qwen4 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf stealth-model/Qwen4:Q4_K_M
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "stealth-model/Qwen4:Q4_K_M" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen 4 news and GGUF files
Qwen4-35B-A3B came out on 4 December, the first Qwen 4 model with open weights, under Apache 2.0. It scores 45.7 on StealthMark, the second-best local model we have measured. Its GGUF files are in this repo, in Qwen4-35B-A3B/, with a file and settings for every common GPU and Mac. The repo also keeps the Qwen 4 timeline and Qwen3.8-Flash-Next, Qwen's earlier preview of the Qwen 4 architecture.
By Stealth Models.
Qwen4-35B-A3B, the first open Qwen 4
It has 35B parameters, and only 3B of them work on each token, so most of it can sit in system RAM and it still runs fast. On top comes a 20B n-gram table that llama.cpp reads from your SSD as needed. It reads 1 million tokens natively, takes images and video, and you can set how hard it thinks: xhigh, high, low or off.
StealthMark results
Qwen4-35B-A3B scores 45.7 on StealthMark 1.9.2: 41.6 in General Intelligence and 55.6 in Visual Intelligence. Only Qwen3.8-27B (49.0) scores higher among the local models we have measured, and it leaves the previous 35B-A3B, Qwen3.6-35B-A3B (18.4), far behind. Task by task: our Qwen4-35B-A3B results.
Which file?
| Your machine | File | In memory | Download |
|---|---|---|---|
| 8 to 16 GB GPU with 32 GB of RAM | Qwen4-35B-A3B/Q4_K_XL/ |
24.7 GB | 36.2 GB |
| 24 GB GPU (RTX 3090, 4090, RX 7900 XTX) | Qwen4-35B-A3B/IQ4_XS/ |
20.5 GB | 32.0 GB |
| 32 GB GPU (RTX 5090) | Qwen4-35B-A3B/Q5_K_XL/ |
27.8 GB | 43.2 GB |
| 48 GB of VRAM or more | Qwen4-35B-A3B/Q8_K_XL/ |
40.5 GB | 62.3 GB |
| Mac with 24 GB | Qwen4-35B-A3B/IQ3_XXS/ |
17.2 GB | 28.7 GB |
| Mac with 32 or 36 GB | Qwen4-35B-A3B/IQ4_XS/ |
20.5 GB | 32.0 GB |
| Mac with 48 GB | Qwen4-35B-A3B/Q5_K_XL/ |
27.8 GB | 43.2 GB |
| Mac with 64 GB or more, AMD Strix Halo, NVIDIA DGX Spark | Qwen4-35B-A3B/Q8_K_XL/ |
40.5 GB | 62.3 GB |
| Image and video input, near lossless | Qwen4-35B-A3B/mmproj-Q8_0.gguf |
0.61 GB | 0.61 GB |
| Image and video input, full precision | Qwen4-35B-A3B/mmproj-F16.gguf |
0.90 GB | 0.90 GB |
| Image and video input, smaller | Qwen4-35B-A3B/mmproj-Q6_K.gguf |
0.52 GB | 0.52 GB |
| Image and video input, smaller still | Qwen4-35B-A3B/mmproj-Q5_K.gguf |
0.50 GB | 0.50 GB |
| Image and video input, smallest | Qwen4-35B-A3B/mmproj-Q4_K.gguf |
0.46 GB | 0.46 GB |
Each file comes in two parts. The first holds the model ("in memory" above). The second holds its n-gram table, 11.5 GB (21.8 GB in Q8_K_XL), and llama.cpp reads only the rows it needs from your SSD, so the table costs no VRAM and almost no RAM.
Why these five: Unsloth measured how close each size stays to the full model (mean KL divergence from BF16 over 11 text sets, lower is better): IQ3_XXS 0.076, IQ4_XS 0.053, Q4_K_XL 0.038, Q5_K_XL 0.028, Q8_K_XL 0.017. Below IQ3_XXS the loss climbs fast (Q2_K_XL 0.096, IQ1_S 0.301).
Download and run
You need llama.cpp from 3 December 2026 or newer, which has Qwen 4 support (PR #33626).
hf download stealth-model/Qwen4 --local-dir qwen4 \
--include "Qwen4-35B-A3B/Q4_K_XL/*" "Qwen4-35B-A3B/mmproj-Q8_0.gguf"
GPU plus system RAM (here a 16 GB GPU with 32 GB of RAM, 128k context):
llama-server \
-m qwen4/Qwen4-35B-A3B/Q4_K_XL/Qwen4-35B-A3B-Q4_K_XL-00001-of-00002.gguf \
--mmproj qwen4/Qwen4-35B-A3B/mmproj-Q8_0.gguf \
-ngl all --n-cpu-moe 23 \
--load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
-fa on -ctk q8_0 -ctv q8_0 -c 131072 --jinja \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0
Mac, AMD Strix Halo or NVIDIA DGX Spark (here a 36 GB Mac):
llama-server \
-m qwen4/Qwen4-35B-A3B/IQ4_XS/Qwen4-35B-A3B-IQ4_XS-00001-of-00002.gguf \
--mmproj qwen4/Qwen4-35B-A3B/mmproj-Q8_0.gguf \
-ngl all --load-mode mmap --lazy-mode on -ot per_layer_token_embd=CPU \
-fa on -ctk q8_0 -ctv q8_0 -c 131072 --jinja \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0
If it doesn't fit on a Mac, let the GPU use more of the memory, for example 20 GB on a 24 GB Mac: sudo sysctl iogpu.wired_limit_mb=20480. It resets when you restart.
Pick your settings
All rows use an 8-bit KV cache (-ctk q8_0 -ctv q8_0) and load the vision projector.
| Your machine | File | --n-cpu-moe at 128k |
--n-cpu-moe at 256k |
RAM for experts (128k / 256k) |
|---|---|---|---|---|
| 8 GB GPU, 32 GB RAM | Q4_K_XL | 38 | 40 (--cpu-moe), without the vision projector |
20.2 / 21.4 GB |
| 12 GB GPU, 32 GB RAM | Q4_K_XL | 31 | 33 | 16.1 / 17.3 GB |
| 16 GB GPU, 32 GB RAM | Q4_K_XL | 23 | 26 | 11.4 / 13.1 GB |
| 16 GB GPU, 64 GB RAM, best quality | Q5_K_XL | 25 | 27 | 14.7 / 15.9 GB |
| 24 GB GPU | IQ4_XS | 0 | 1 | none / 0.4 GB |
| 24 GB GPU, 32 GB RAM, best quality | Q5_K_XL | 10 | 13 | 5.9 / 7.7 GB |
| 32 GB GPU | Q5_K_XL | 0 | 0 | none |
| 48 GB of VRAM or more | Q8_K_XL | 0 | 0 | none |
| Mac, AMD Strix Halo, NVIDIA DGX Spark | the file for your memory, from the table above | all on the GPU | all on the GPU | none |
We derived these from the GGUF headers, not from a test run, keeping about 3 GB of VRAM free for llama.cpp's buffers and the vision projector.
--n-cpu-moe is how many of the 40 expert layers stay in system RAM. If you run out of memory, raise it by 2; with VRAM to spare, lower it by 1. Without the vision projector you can lower it by about 2. Set -t to your number of physical cores; fast RAM matters most when experts sit in system RAM.
Options
- Thinking. It thinks at
highby default. To change that, send"reasoning_effort": "low"(orxhighoroff) as a top-level field in your request, not only insidechat_template_kwargs, where llama-server answers with an error. For no thinking at all, start the server with--reasoning offand use--temp 0.7 --top-p 0.8 --top-k 20 --presence-penalty 1.5. - MTP. Every file has Qwen's multi-token prediction head built in.
--spec-type draft-mtp --spec-draft-n-max 2gave about 1.2 to 1.4 times faster output in Unsloth's tests. It takes 0.5 to 1.7 GB more VRAM, so raise--n-cpu-moeby 1 or 2, and use--spec-draft-n-max 1when experts sit in system RAM. - Expert cache. When experts sit in system RAM,
--moe-cache-mibkeeps the busiest of them on the GPU. Unsloth measured 1.8 to 2 times faster output this way on 8 to 24 GB GPUs. Try--moe-cache-mib 2048and raise--n-cpu-moeby 4 to make room. - The n-gram table. With RAM to spare,
--lazy-mode offkeeps it in memory instead of on your SSD. - 1M context. The 8-bit cache takes about 1.6 GB per 128k tokens, so 12.8 GB at 1M. With
-ctk q4_0 -ctv q4_0it's 6.8 GB.
These are Unsloth's Dynamic GGUFs from unsloth/Qwen4-35B-A3B-GGUF, 4 December upload, byte for byte; we only dropped UD- from the names. The model is Qwen/Qwen4-35B-A3B.
Qwen3.8-Flash-Next, the Qwen 4 preview
Qwen3.8-Flash-Next already uses the new design: a learned n-gram memory next to sparse attention, and 512 experts, of which 10 work on each token. It reads 262,144 tokens natively and up to 1 million with YaRN.
| File | Size | Best for |
|---|---|---|
Q2_K_XL/ |
79 GB | 16 to 32 GB GPUs with 64 GB of RAM |
Q4_K_XL/ |
111 GB | 24 to 32 GB GPUs with 96 to 128 GB of RAM, AMD Strix Halo, NVIDIA DGX Spark |
Q5_K_XL/ |
158 GB | 32 GB GPUs with 128 GB of RAM, 192 GB machines |
mmproj-Q8_0.gguf |
0.6 GB | vision, near lossless, a third less VRAM |
mmproj-F16.gguf |
0.9 GB | vision, full precision |
mmproj-Q6_K.gguf |
0.52 GB | vision, smaller |
mmproj-Q4_K.gguf |
0.46 GB | vision, smallest |
MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf |
2.8 GB | faster output with MTP |
MTP/mtp-Qwen3.8-Flash-Next-shared-Q4_K_M.gguf |
1.9 GB | MTP when VRAM is tight |
It needs far less VRAM than its size suggests. Only 4 to 5.5 GB has to sit on the GPU; the experts stay in system RAM, and the n-gram table (29 GB, 54 GB in Q5) can stay on your SSD. You need llama.cpp b11971 (28 October) or newer.
Pick your settings
All rows use a 4-bit KV cache (-ctk q4_0 -ctv q4_0), so the whole cache is only about 2 GB at 256k and 8 GB at 1M.
| Your machine | File | --n-cpu-moe at 256k |
--n-cpu-moe at 1M |
RAM for experts (256k / 1M) |
|---|---|---|---|---|
| 16 GB GPU, 64 GB RAM | Q2_K_XL | 42 | 45 (512k max) | 40 / 43 GB |
| 24 GB GPU, 64 GB RAM | Q2_K_XL | 34 | 42 | 33 / 40 GB |
| 24 GB GPU, 96 GB RAM | Q4_K_XL | 41 | 46 | 66 / 73 GB |
| 32 GB GPU, 64 GB RAM | Q2_K_XL | 26 | 33 | 25 / 32 GB |
| 32 GB GPU, 96 to 128 GB RAM | Q4_K_XL | 36 | 41 | 58 / 66 GB |
| 32 GB GPU, 128 GB RAM, best quality | Q5_K_XL | 39 | 42 | 80 / 86 GB |
| AMD Strix Halo or NVIDIA DGX Spark, 128 GB unified | Q4_K_XL | all on the GPU | all on the GPU | none |
| 192 GB or more | Q5_K_XL | all on the GPU on unified memory | all on the GPU | none |
--n-cpu-moe is how many of the 48 expert layers stay in system RAM. If you run out of memory, raise it by 2; with VRAM to spare, lower it by 1.
Speed and memory options
- n-gram table on SSD or in RAM.
-ot "^per_layer_token_embd\.weight$=CPU" --lazy-mode onkeeps it on your SSD. That costs no VRAM or RAM, just a few small reads per token, so a fast NVMe drive helps. With RAM to spare (29 GB, 54 GB for Q5),--lazy-mode offkeeps it in memory for slightly faster lookups. - ngram-mod.
--spec-type ngram-moddrafts tokens from text that's already in your context. It costs no memory and helps most when the answer repeats your input, like code edits, summaries or long documents. - MTP. Qwen trained one multi-token prediction layer, and Unsloth measured 1.3 to 1.7x faster output with it. It takes 2.8 GB of VRAM (1.9 GB with the Q4_K_M file), so raise
--n-cpu-moeby 3 on Q2 and by 2 on Q4 and Q5. For now it runs on Unsloth's llama.cpp branchqwen4exp/mtp; support in official llama.cpp is still in review. Add-md qwen4/Qwen3.8-Flash-Next/MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf --spec-type draft-mtp --spec-draft-n-max 5, or combine both with--spec-type draft-mtp,ngram-mod. - 1M context. Add
--rope-scaling yarn --rope-scale 4 --yarn-orig-ctx 262144 -c 1000000 -ub 512. For 512k, use--rope-scale 2 -c 524288. Qwen recommends YaRN only when you actually need the length.
Download and run
hf download stealth-model/Qwen4 --local-dir qwen4 \
--include "Qwen3.8-Flash-Next/Q2_K_XL/*" "Qwen3.8-Flash-Next/mmproj-Q8_0.gguf"
GPU plus system RAM (here a 24 GB GPU with 64 GB of RAM, 256k context):
llama-server \
-m qwen4/Qwen3.8-Flash-Next/Q2_K_XL/Qwen3.8-Flash-Next-Q2_K_XL-00001-of-00003.gguf \
--mmproj qwen4/Qwen3.8-Flash-Next/mmproj-Q8_0.gguf \
-ngl all --n-cpu-moe 34 \
-ot "^per_layer_token_embd\.weight$=CPU" --lazy-mode on \
-fa on -ctk q4_0 -ctv q4_0 -c 262144 \
-ub 2048 -b 2048 -t 8 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0
- Set
-tto your number of physical cores; fast RAM matters most here. - On a 16 GB GPU, use
-ub 1024.
AMD Strix Halo or NVIDIA DGX Spark (128 GB unified, 256k context):
llama-server \
-m qwen4/Qwen3.8-Flash-Next/Q4_K_XL/Qwen3.8-Flash-Next-Q4_K_XL-00001-of-00004.gguf \
--mmproj qwen4/Qwen3.8-Flash-Next/mmproj-Q8_0.gguf \
-ngl all -ot "^per_layer_token_embd\.weight$=CPU" --lazy-mode on \
-fa on -ctk q4_0 -ctv q4_0 -c 262144 -ub 2048 -b 2048 \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0
Q4_K_XL takes about 89 GB this way and fits 1M context too (about 96 GB). Q5_K_XL fits at 256k if your system gives the GPU about 110 GB. With 192 GB or more, swap --lazy-mode on for --lazy-mode off.
Qwen's recommended sampling for thinking mode is --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0, and for instruct --temp 0.7 --top-p 0.8 --top-k 20 --presence-penalty 1.5.
If you run it, tell us your GPU, RAM and speed in the Community tab and we'll tune the table.
Qwen 4 timeline and updates
All scores are on our StealthMark leaderboard.
Is Qwen 4 out?
Yes. Qwen4-Max came out on 16 November, as an API only. On 4 December Qwen released Qwen4-35B-A3B, the first Qwen 4 model with open weights, under Apache 2.0, in BF16 and FP8. Qwen4-27B, Flash and Plus have no date yet. Qwen says more open Qwen 4 models are on the way.
Which Qwen 4 models are out, and which are coming?
Out: Qwen4-Max (API only) and Qwen4-35B-A3B (open weights). Named but not out yet: Qwen4-Plus, Qwen4-Flash and Qwen4-27B. Qwen's lead described 27B as the model local developers have been waiting for.
Will Qwen4-35B-A3B run on my PC?
Most likely. Only 3B of its 35B parameters work on each token, so an 8 GB GPU with 32 GB of RAM can run the 4-bit file, with most experts in system RAM. A 24 GB GPU holds the IQ4_XS file whole, and so does a 32 or 36 GB Mac. The tables above have a file and settings for each.
How good is Qwen4-35B-A3B?
It scores 45.7 on StealthMark 1.9.2, the second-best local model we have measured, behind Qwen3.8-27B at 49.0. The previous 35B-A3B, Qwen3.6-35B-A3B, scored 18.4. Its results task by task are in our Qwen4-35B-A3B results.
How good is Qwen4-Max?
It scores 61.6 on StealthMark 1.9.2, the best Qwen model we have measured and 3.7 points above Qwen3.8-Max-0902. Its results task by task are in our Qwen4-Max results.
Will Qwen4-27B run on my PC?
Kernel code calls it dense, built for one or two GPUs at 4-bit. Its predecessor, Qwen3.8-27B, is the best local model in our StealthMark tests today. When its weights come out, we'll add GGUFs and per-GPU settings. Our forecast for it is in the Qwen 4 guide.
Text and images: CC BY 4.0, stealthmodels.com. GGUF files: Qwen4-35B-A3B under Apache 2.0, Qwen3.8-Flash-Next under the Qwen Community License 1.0, both Qwen's licences, unchanged.
- Downloads last month
- 7,895
2-bit
3-bit
4-bit
5-bit
8-bit
Model tree for stealth-model/Qwen4
Base model
Qwen/Qwen3.8-Flash-Next