Instructions to use Xylolabs/Qwen3-4B-GGUF 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 Xylolabs/Qwen3-4B-GGUF 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 Xylolabs/Qwen3-4B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Xylolabs/Qwen3-4B-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Xylolabs/Qwen3-4B-GGUF:Q4_K_M # Run inference directly in the terminal: llama cli -hf Xylolabs/Qwen3-4B-GGUF: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 Xylolabs/Qwen3-4B-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama cli -hf Xylolabs/Qwen3-4B-GGUF:Q4_K_M
Use Docker
docker model run hf.co/Xylolabs/Qwen3-4B-GGUF:Q4_K_M
- Llama new
- LM Studio
- Jan
- vLLM
How to use Xylolabs/Qwen3-4B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Xylolabs/Qwen3-4B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Xylolabs/Qwen3-4B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Xylolabs/Qwen3-4B-GGUF:Q4_K_M
- Ollama
How to use Xylolabs/Qwen3-4B-GGUF with Ollama:
ollama run hf.co/Xylolabs/Qwen3-4B-GGUF:Q4_K_M
- Unsloth Desktop
- Pi
How to use Xylolabs/Qwen3-4B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Xylolabs/Qwen3-4B-GGUF: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": "Xylolabs/Qwen3-4B-GGUF:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use Xylolabs/Qwen3-4B-GGUF with Docker Model Runner:
docker model run hf.co/Xylolabs/Qwen3-4B-GGUF:Q4_K_M
- Lemonade
How to use Xylolabs/Qwen3-4B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Xylolabs/Qwen3-4B-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.Qwen3-4B-GGUF-Q4_K_M
List all available models
lemonade list
- Hermes Agent
How to use Xylolabs/Qwen3-4B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Xylolabs/Qwen3-4B-GGUF: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 Xylolabs/Qwen3-4B-GGUF:Q4_K_M
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Xylolabs/Qwen3-4B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Xylolabs/Qwen3-4B-GGUF: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 "Xylolabs/Qwen3-4B-GGUF: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"
GGUF quants of Qwen/Qwen3-4B for llama.cpp, on CUDA, Metal or CPU.
Files
| File | Size |
|---|---|
Qwen3-4B-Q8_0.gguf |
4.280 GB |
Qwen3-4B-Q6_K.gguf |
3.306 GB |
Qwen3-4B-Q5_K_M.gguf |
2.890 GB |
Qwen3-4B-Q4_K_M.gguf |
2.497 GB |
Qwen3-4B-Q4_K_S.gguf |
2.383 GB |
Qwen3-4B-IQ4_XS.gguf |
2.286 GB |
Qwen3-4B-IQ4_XS-imat.gguf |
2.271 GB |
Qwen3-4B-IQ3_XXS.gguf |
1.670 GB |
Qwen3-4B-2m.imatrix |
7.75 MB |
Qwen3-4B-imat.imatrix |
7.75 MB |
How to run
Use llama.cpp cd959bae99ff4bed22bef2604f45241c09bbb8c8 or newer.
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
git checkout cd959bae99ff4bed22bef2604f45241c09bbb8c8
cmake -B build -DCMAKE_BUILD_TYPE=Release # add -DGGML_CUDA=ON for NVIDIA GPUs
cmake --build build -j --target llama-cli llama-server
./build/bin/llama-cli -m Qwen3-4B-Q5_K_M.gguf --jinja -c 8192 -ngl 99
llama-server takes the same flags.
Accuracy
The reference weights were BF16.
| Quant | Size | WikiText-2 KL | top-1 | Held-out KL | top-1 |
|---|---|---|---|---|---|
| Xylolabs Q8_0 | 4.280 GB | 0.001566 | 98.407% | 0.001625 | 98.147% |
| Xylolabs Q6_K | 3.306 GB | 0.006034 | 96.887% | 0.006976 | 96.676% |
| Xylolabs Q5_K_M | 2.890 GB | 0.011236 | 95.456% | 0.010252 | 95.980% |
| Xylolabs Q4_K_M | 2.497 GB | 0.042454 | 91.598% | 0.041984 | 91.676% |
| Xylolabs Q4_K_S | 2.383 GB | 0.048107 | 91.152% | 0.048118 | 91.020% |
| Xylolabs IQ4_XS | 2.271 GB | 0.048621 | 91.529% | 0.037710 | 92.441% |
| Xylolabs IQ4_XS-imat | 2.271 GB | 0.058079 | 90.539% | 0.052823 | 90.931% |
| Xylolabs IQ3_XXS | 1.670 GB | 0.198634 | 82.760% | 0.183483 | 82.931% |
All files and rivals: BENCHMARKS.md
| Quant | Size | Chat KL | top-1 |
|---|---|---|---|
| Xylolabs Q8_0 | 4.280 GB | 0.001453 | 98.686% |
| Xylolabs Q6_K | 3.306 GB | 0.006422 | 97.627% |
| Xylolabs Q4_K_M | 2.497 GB | 0.043744 | 93.980% |
| Xylolabs Q4_K_S | 2.383 GB | 0.049789 | 93.539% |
IQ3_XXS: Weights optimized with our implementation of IST Austria's GSQ (Gumbel-softmax code search); the output scale is calibrated.
Which file for your hardware
| Hardware | Memory | File | Context |
|---|---|---|---|
| RTX 4090 / RTX 3090 | 24 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| RTX 5090 | 32 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| RTX 6000 Ada, or 2 x 24 GB | 48 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| One H100 | 80 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| RTX PRO 6000 Blackwell (GDDR7) | 96 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| DGX Spark | 128 GB unified | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| Mac Studio M5 Max | 128 GB unified | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| One 141 GB datacenter GPU | 141 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| One B200 | 192 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| Mac Studio M5 Ultra | 256 GB unified | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| Mac Studio M5 Ultra | 512 GB unified | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
| One B300 (HBM3e) | 288 GB | Qwen3-4B-Q8_0.gguf (4.3 GB) |
32K |
License and notices
Apache License 2.0, copied in LICENSE. We converted the weights to GGUF and quantized them.
Citation
See the original Qwen3-4B model card for the Qwen3 technical report and citation.
Updates
- 2026-12-06: Upgraded
Q5_K_M(2.89 GB, mean KL 0.01074),IQ4_XS(2.27 GB, mean KL 0.04317) using Full-Hessian Block-OBS + Intra-Block GPTQ; updatedaccuracy-by-size.csvandMANIFEST. - 2026-12-05: Moved the full comparison to BENCHMARKS.md.
- 2026-11-29: Added files from MaziyarPanahi and Unsloth.
- 2026-11-29: Added the importance matrices
Qwen3-4B-2m.imatrix,Qwen3-4B-imat.imatrixused for the quantized levels.
- Downloads last month
- 6,044
3-bit
4-bit
5-bit
6-bit
8-bit