Downloads · 30 days
3.8K
4% of all-time downloads
geoffmunn/Qwen3-4B-f16
Qwen3-4B-f16 is a text generation model from geoffmunn. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This is a GGUF-quantized version of the Qwen/Qwen3-4B language model — a powerful 4-billion-parameter LLM from Alibaba's Qwen series, designed for strong reasoning, agentic workflows, and multilingual fluency on consu…
Downloads · 30 days
3.8K
4% of all-time downloads
All-time downloads
88.7K
Public
Repo size
130 GB
Likes
6
Public
Click a slice to open those files.
.gguf59.1 GB · 100%
From the Hugging Face model README
This is a GGUF-quantized version of the Qwen/Qwen3-4B language model — a powerful 4-billion-parameter LLM from Alibaba's Qwen series, designed for strong reasoning, agentic workflows, and multilingual fluency on consumer-grade hardware.
Converted for use with llama.cpp, LM Studio, OpenWebUI, GPT4All, and more.
The Qwen3-4B model strikes a powerful balance between capability and efficiency, offering:
It’s ideal for:
Choose Qwen3-4B when you need more intelligence than a tiny model can provide—but still want to run offline, avoid cloud costs, or maintain full control over your AI stack.
At 4B scale, quantization achieves near-miraculous fidelity—multiple variants deliver better-than-F16 quality under specific conditions, making this the "sweet spot" where intelligent compression acts as beneficial regularization. However, imatrix interactions are uniquely paradoxical: it harms Q4_K_HIFI (+4.4% degradation) and Q5_K_S (+1.63% degradation) while helping Q4_K_M and Q5_K_HIFI. This makes quantization selection critically dependent on imatrix usage:
| Bit Width | Best Variant (+ imatrix) | Quality vs F16 | File Size | Speed | Memory | Viability |
|---|---|---|---|---|---|---|
| Q5_K | Q5_K_HIFI + imatrix | -0.76% ✅✅✅ | 2.67 GiB | 182.7 TPS | 2,734 MiB | Exceptional |
| Q4_K | Q4_K_HIFI (no imatrix) | +0.29% ✅✅ | 2.50 GiB | 184.1 TPS | 2,560 MiB | Near-lossless |
| Q3_K | Q3_K_HIFI + imatrix | +5.9% ✅ | 2.15 GiB | 151.3 TPS | 2,202 MiB | Good |
| Q2_K | Q2_K + imatrix | +18.7% ⚠️ | 1.55 GiB | 250.4 TPS | 2,610 MiB | Fair (degraded) |
💡 Critical insight: 4B is the only scale where Q5_K_S without imatrix beats F16 (-0.68% vs F16) while being 124% faster and 65% smaller—a rare quantization "free lunch." Conversely, imatrix harms certain variants (Q4_K_HIFI, Q5_K_S), a paradox not seen at other scales.
→ Q5_K_HIFI + imatrix
Q5_K_HIFI_RES8 support→ Q4_K_M + imatrix
→ Q5_K_S (no imatrix)
→ Q4_K_HIFI (no imatrix)
→ Q3_K_S + imatrix
→ Q2_K + imatrix
⚠️ imatrix is NOT universally beneficial at 4B scale — it exhibits paradoxical behavior:
| Variant | imatrix Effect | Recommendation |
|---|---|---|
| Q5_K_S | ❌ Harmful: +1.63% PPL degradation | Never use imatrix — quality drops from -0.68% to +0.94% vs F16 |
| Q4_K_HIFI | ❌ Severely harmful: +4.4% PPL degradation | Never use imatrix — quality drops from +0.29% to +4.72% vs F16 |
| Q4_K_M | ✅ Beneficial: -0.34% PPL improvement | Always use imatrix — best Q4 quality at +2.75% vs F16 |
| Q5_K_HIFI | ✅ Beneficial: -0.80% PPL improvement | Always use imatrix — achieves -0.76% vs F16 (best overall) |
| Q3_K variants | ✅ Beneficial: 6-12% PPL improvement | Always use imatrix — essential for production quality |
| Q2_K variants | ✅ Essential: 56-63% PPL improvement | Mandatory — unusable without imatrix (+169–220% loss) |
⚠️ Q4_K_HIFI without imatrix is remarkable: Achieves +0.29% precision loss — the closest to lossless 4-bit quantization observed across all tested scales. This makes it ideal for deployments where imatrix generation overhead is undesirable.
⚠️ Q5_K_S without imatrix is the 4B anomaly: Wins all three dimensions simultaneously (quality, speed, size) without imatrix — a rare quantization "free lunch" that only occurs at this specific model scale.
⚠️ Q2_K is borderline viable only with imatrix: +18.7% loss remains degraded for quality-sensitive tasks. Reserve for extreme memory constraints where no other option fits.
| Available VRAM | Recommended Variant | Expected Quality | Why |
|---|---|---|---|
| < 1.8 GiB | Q3_K_S + imatrix | PPL 16.73, +16.6% loss ⚠️ | Only option that fits; quality acceptable for non-critical tasks |
| 1.8 – 2.5 GiB | Q4_K_S (no imatrix) | PPL 15.04, +4.9% loss | Good speed/size balance; avoid imatrix (degrades Q4_K_S slightly) |
| 2.5 – 3.0 GiB | Q4_K_M + imatrix ✅ | PPL 14.29, +2.75% loss | Best balance of quality/speed/size; standard compatibility |
| 3.0 – 4.0 GiB | Q5_K_HIFI + imatrix ✅ | PPL 14.23, -0.76% loss | Near-F16 quality; requires custom build |
| > 7.5 GiB | F16 or Q5_K_HIFI + imatrix | 0% or -0.76% loss | F16 if absolute precision required; Q5_K_HIFI if speed/memory matter |
Need best quality?
├─ Yes → Using imatrix?
│ ├─ Yes → Q5_K_HIFI + imatrix (-0.76% vs F16) ✅✅✅
│ └─ No → Q4_K_HIFI (no imatrix, +0.29% vs F16) ✅✅
│
Need best balance?
├─ Yes → Using imatrix?
│ ├─ Yes → Q4_K_M + imatrix (+2.75% vs F16, standard build) ✅
│ └─ No → Q5_K_S (no imatrix, -0.68% vs F16, fastest/smallest) ✅
│
Need max speed?
├─ Yes → Q5_K_S (no imatrix) — 184.65 TPS
│ ⚠️ Never pair with imatrix!
│
Memory constrained (< 2.2 GiB)?
└─ Yes → Q3_K_S + imatrix — 1,792 MiB runtime
Accept +16.6% quality loss for extreme footprint reduction
The Qwen3-4B model delivers the optimal balance of intelligence and efficiency—powerful enough for nuanced reasoning and code generation, yet compact enough to run on consumer hardware without cloud dependency. It's the definitive choice when you need robust language understanding and generation capabilities while maintaining full data sovereignty and offline operation.
Choose Qwen3-4B when you need serious capability without infrastructure overhead—delivering 95% of 7B-class performance at half the resource footprint, with quantization options that paradoxically improve quality under the right conditions.
| Scenario | Recommended Variant | Rationale |
|---|---|---|
| Default / General Purpose | Q4_K_M + imatrix | Best balance of quality (+2.75%), speed (200 TPS), size (2.32 GiB), and universal compatibility |
| Maximum Quality | Q5_K_HIFI + imatrix | Achieves perplexity better than F16 (-0.76% vs F16) with 64% memory reduction |
| Speed-Critical (no imatrix) | Q5_K_S (no imatrix) | Fastest (184.7 TPS) AND highest quality (-0.68% vs F16) AND smallest size (2.62 GiB) |
| Near-Lossless 4-bit | Q4_K_HIFI (no imatrix) | +0.29% loss — closest to lossless 4-bit quantization observed across all scales |
| Extreme Constraints | Q3_K_S + imatrix | Only if memory < 2.2 GiB; +16.6% loss acceptable for non-critical tasks |
| Avoid Entirely | Q2_K without imatrix | Unusable quality (+169–220% loss); only consider Q2_K with imatrix for extreme constraints |
⚠️ Golden rules for 4B:
✅ 4B is the quantization anomaly: The only scale where uniform quantization (Q5_K_S) without imatrix guidance beats full precision while being faster and smaller—a demonstration that intelligent model compression isn't always about preserving fidelity, but sometimes about enhancing it through beneficial regularization.
| Scenario | Variant | PPL | vs F16 | Speed | Size | Memory |
|---|---|---|---|---|---|---|
| Best quality | Q5_K_HIFI + imat | 14.2321 | -0.76% ✅ | 182.7 TPS | 2.67 GiB | 2,734 MiB |
| Best balance | Q4_K_M + imat | 14.2865 | +2.75% ✅ | 200.2 TPS | 2.32 GiB | 2,376 MiB |
| Fastest/smallest | Q5_K_S (no imat) | 14.2439 | -0.68% ✅✅ | 184.7 TPS | 2.62 GiB | 2,683 MiB |
| Near-lossless Q4 | Q4_K_HIFI (no imat) | 14.3832 | +0.29% ✅ | 184.1 TPS | 2.50 GiB | 2,560 MiB |
| Smallest footprint | Q3_K_S + imat | 16.7282 | +16.6% | 223.5 TPS | 1.75 GiB | 1,792 MiB |
✅ = Excellent | ✅✅ = Better than F16 | ⚠️ = Avoid imatrix pairing
Golden rule for 4B:
NOTE: This analysis does not include the HIFI models.
I have run each of these models across 6 questions, and ranked them all based on the quality of the anwsers. Qwen3-4B-f16:Q3_K_M (or Qwen3-4B-f16:Q3_HIFI) is the best model across all question types, but if you want to play it safe with a higher precision model, then you could consider using Qwen3-4B-f16:Q8_0.
You can read the results here: Qwen3-4b-f16-analysis.md
If you find this useful, please give the project a ❤️ like.
| Level | Speed | Size | Recommendation |
|---|---|---|---|
| Q2_K | ⚡ Fastest | 1.9 GB | 🚨 DO NOT USE. Worst results from all the 4B models. |
| 🥈 Q3_K_S | ⚡ Fast | 2.2 GB | 🥈 Runner up. A very good model for a wide range of queries. |
| 🥇 Q3_K_M | ⚡ Fast | 2.4 GB | 🥇 Best overall model. Highly recommended for all query types. |
| Q4_K_S | 🚀 Fast | 2.7 GB | A late showing in low-temperature queries. Probably not recommended. |
| Q4_K_M | 🚀 Fast | 2.9 GB | A late showing in high-temperature queries. Probably not recommended. |
| Q5_K_S | 🐢 Medium | 3.3 GB | Did not appear in the top 3 for any question. Not recommended. |
| Q5_K_M | 🐢 Medium | 3.4 GB | A second place for a high-temperature question, probably not recommended. |
| Q6_K | 🐌 Slow | 3.9 GB | Did not appear in the top 3 for any question. Not recommended. |
| 🥉 Q8_0 | 🐌 Slow | 5.1 GB | 🥉 If you want to play it safe, this is a good option. Good results across a variety of questions. |
You can read the guide for building llama.cpp here: HIFI_BUILD_GUIDE.md.
The HIFI quantization also used a massive 9343 chunk imatrix file for extra precision. You can re-use it here: Qwen3-4B-f16-imatrix-9343-generic.gguf
The imatrix was created as a generic mix of Wikipedia, mathmatics, and coding examples.
You can use the HIFI GitHub repository to build it from source if you're interested: https://github.com/geoffmunn/llama.cpp.
Build notes: HIFI_BUILD_GUIDE.md
Improvements and feedback are welcome.
Load this model using:
llama.cppEach quantized model includes its own README.md and shares a common MODELFILE for optimal configuration.
Importing directly into Ollama should work, but you might encounter this error: Error: invalid character '<' looking for beginning of value.
In this case try these steps:
wget https://huggingface.co/geoffmunn/Qwen3-4B-f16/resolve/main/Qwen3-4B-f16%3AQ3_K_M.gguf (replace the quantised version with the one you want)nano Modelfile and enter these details (again, replacing Q3_K_M with the version you want):FROM ./Qwen3-4B-f16:Q3_K_M.gguf
# Chat template using ChatML (used by Qwen)
SYSTEM You are a helpful assistant
TEMPLATE "{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>{{ end }}<|im_start|>user
{{ .Prompt }}<|im_end|>
<|im_start|>assistant
"
PARAMETER stop <|im_start|>
PARAMETER stop <|im_end|>
# Default sampling
PARAMETER temperature 0.6
PARAMETER top_p 0.95
PARAMETER top_k 20
PARAMETER min_p 0.0
PARAMETER repeat_penalty 1.1
PARAMETER num_ctx 4096
The num_ctx value has been dropped to increase speed significantly.
ollama create Qwen3-4B-f16:Q3_K_M -f ModelfileYou will now see "Qwen3-4B-f16:Q3_K_M" in your Ollama model list.
These import steps are also useful if you want to customise the default parameters or system prompt.
👤 Geoff Munn (@geoffmunn)
🔗 Hugging Face Profile
This is a community conversion for local inference. Not affiliated with Alibaba Cloud or the Qwen team.