magiccodingman's picture
Update README.md
b41ba21 verified
---
license: apache-2.0
base_model:
- Qwen/Qwen3-4B-Thinking-2507
tags:
- qwen3
- gguf
- text-generation
- quantized
- cpu
- gpu
- mxfp4
- mxfp4_hybrid
- mxfp4_moe
---
# DEPRECIATED!
This model was surpassed by:
https://huggingface.co/magiccodingman/Qwen3-4B-Thinking-2507-Unsloth-MagicQuant-Hybrid-GGUF
Use the new version. This shown MXFP4 hybrid is no longer viable in comparison, nor really useable. The data collected is good for understanding and research, but it's not as good for real use.
# Qwen3 4B Thinking 2507 MXFP4 Hybrid GGUF
**Dense model utilizing MXFP4_MOE with hybrid weights on a dense model. Achieving interesting results that show smaller file size, more TPS, and near lossless precision.**
## **Use The Following Model!**
Stats compared against the standard Q8_0 (precision loss still compared to F16)
* **MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K**
12% smaller than Q8 • 411.06 TPS • 0.0007% precision loss
---
This repository contains a set of hybrid MXFP4 quantized GGUF models designed to explore a surprising discovery:
> A carefully targeted combination of MXFP4 + high-precision embeddings/output weights can deliver near-Q8 accuracy with Q4–Q6 level throughput and smaller file sizes than Q8.
Unlike pure MXFP4, which heavily degrades dense models. This hybrid method selectively protects tensors that matter most for semantic stability, while allowing MXFP4 to accelerate everything else.
> **This is experimental**. And should be treated as such. I am more than encouraging people to use this model and leave feedback! Though precision loss seemed near lossless, did the hybrid models act strange in certain situations? Worse or better on some topics compared to the original model? Did it do better/worse overall on everything? I'd love to hear back from others!
---
# The Magic Model
This model achieved:
> **File size reduction compared to the Q8_0**
>
> **Better precision loss scores than the pure Q6_K**
>
> **Achieving noticeably better TPS than a Q4_K_M**
_I have personally deemed this in the category of "Q7.5" quantization._
#### MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K
> **(12% smaller than Q8 • 411.06 TPS • 0.0007% loss)**
This version created beat out everything in every way in the MXFP4 hybrid family created. It not only held the lowest precision loss, but in the Q7.5 category, it was the fastest and smallest model. There was no reason to use any other created version as this one reigned king.
The following was the conversion script:
```bash
llama-quantize \
--tensor-type token_embd.weight=Q6_K \
--tensor-type output.weight=MXFP4 \
--tensor-type 'router.*'=Q6_K \
--tensor-type 'gate.*'=Q6_K \
"Path_To_F16_GGUF.gguf" \
"Path_To_GGUF.gguf" \
mxfp4_moe
```
---
# MXFP4_MOE Hybrid Naming Scheme & Synopsis
Multiple different combinations of converted models were created. The results were interesting to say the least. The following table will explain my naming scheme to what was done to the model to create it.
| Suffix Example | Meaning |
| ----------------------------------- | -------------------------------------- |
| `MXFP4_MOE` | Pure MXFP4 pipeline |
| `MXFP4_MOE-Q8` | Embedding/output in Q8_0 |
| `MXFP4_MOE-F16` | Embedding/output in F16 |
| `output_mxfp4-embd_q8` | Output → MXFP4, Embedding → Q8 |
| `output_mxfp4-router_gate_emb_q5_K` | Output → MXFP4, Emb/Router/Gate → Q5_K |
| `MXFP4_MOE-Q6_K` | Both embedding + output in Q6_K |
| `Q8_0`, `Q6_K`, `Q4_K_M` | Pure model-wide quantizations |
The results achieved were interesting to say the least. It was a brute force game of mass creating models with hybrid methods to find combinations that didn't cause too much noise and paired well with MXFP4.
This repo showcases the converted models, whether good or bad that was created. But, I have been testing other models in different combinations as well. **The winning hybrid combinations shown in this repo DOES NOT always equate to the same results on different models.**
Some models do better or worse with different kinds of combinations. It depends if it's dense, MOE, and much more. Many times the results surprise me. Many models no matter the combination will not play nice with MXFP4. At least with the methods shown here.
---
## Benchmark Methodology
All models were tested with a unified automated harness using `llama.cpp` tools.
**Included tests:**
- **Throughput:**
`llama-bench` with descending GPU offload (`-ngl 35 → 0`) and automatic OOM retry.
Highest successful TPS is recorded.
- **Perplexity:**
Three domains: **general**, **code**, **math**.
Each uses an auto-generated corpus of ~**32k tokens**.
Perplexity is computed with `llama-perplexity` at **2048-token** context.
Same GPU retry logic as above.
- **Precision loss:**
Each model is compared to its **family F16 baseline**.
Precision-loss % is computed for all PPL domains, plus an averaged score.
Models are ranked by this metric.
---
### Table - Overview of Results
Comparing to F16.
| model_name | size_reduction | tps_change |
| ---------- | -------------- | ---------- |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K | 53.2% | 54.2% |
| MXFP4_MOE-output_q6_K-router_gate_emb_q6_K | 51.87% | 60.09% |
| MXFP4_MOE-F16 | 37.87% | 1.35% |
| MXFP4_MOE-Q6_K | 49.2% | 46.95% |
| MXFP4_MOE-output_mxfp4-embd_q6_K | 50.53% | 46.46% |
| MXFP4_MOE-Q8 | 46.8% | 37.79% |
| Q8_0 | 46.8% | 34.91% |
| Q6_K | 58.93% | 56.06% |
| MXFP4_MOE-output_mxfp4-embd_q8 | 49.33% | 41.84% |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q8 | 49.33% | 45.68% |
| MXFP4_MOE-output_mxfp4-embd_q5_K | 51.2% | 60.8% |
| MXFP4_MOE-Q5_K | 50.4% | 55.06% |
| Q5_K_M | 64.13% | 44.47% |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q5_K | 55.33% | 55.62% |
| MXFP4_MOE-output_mxfp4-embd_q4_K | 51.73% | 66.36% |
| Q4_K_M | 68.93% | 45.78% |
| MXFP4_MOE-Q4_K | 51.6% | 66.91% |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q4_K | 57.33% | 69.25% |
| MXFP4_MOE-output_q8-embd_mxfp4 | 49.47% | 70.54% |
| MXFP4_MOE | 73.33% | 94.32% |
* All percentages compared against the selected family F16 baseline.
---
### Table - File Size + TPS + Avg Precision Loss
| model_name | file_size_gb | bench_tps | avg_prec_loss |
| ---------- | ------------ | --------- | -------------- |
| F16 | 7.5 | 266.58 | 0 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K | 3.51 | 411.06 | 0.0007 |
| MXFP4_MOE-output_q6_K-router_gate_emb_q6_K | 3.61 | 426.78 | 0.0136 |
| MXFP4_MOE-F16 | 4.66 | 270.18 | 0.0282 |
| MXFP4_MOE-Q6_K | 3.81 | 391.73 | 0.0377 |
| MXFP4_MOE-output_mxfp4-embd_q6_K | 3.71 | 390.42 | 0.0386 |
| MXFP4_MOE-Q8 | 3.99 | 367.31 | 0.1045 |
| Q8_0 | 3.99 | 359.64 | 0.1047 |
| Q6_K | 3.08 | 416.02 | 0.1051 |
| MXFP4_MOE-output_mxfp4-embd_q8 | 3.8 | 378.13 | 0.1136 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q8 | 3.8 | 388.35 | 0.1136 |
| MXFP4_MOE-output_mxfp4-embd_q5_K | 3.66 | 428.66 | 0.418 |
| MXFP4_MOE-Q5_K | 3.72 | 413.35 | 0.536 |
| Q5_K_M | 2.69 | 385.14 | 0.5535 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q5_K | 3.35 | 414.85 | 0.6332 |
| MXFP4_MOE-output_mxfp4-embd_q4_K | 3.62 | 443.47 | 1.2697 |
| Q4_K_M | 2.33 | 388.61 | 1.6442 |
| MXFP4_MOE-Q4_K | 3.63 | 444.95 | 1.6896 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q4_K | 3.2 | 451.19 | 1.7161 |
| MXFP4_MOE-output_q8-embd_mxfp4 | 3.79 | 454.62 | 2.1993 |
| MXFP4_MOE | 2 | 518.03 | 7.9522 |
* Bench NGL was 35
* Utilized CUDA
---
### Table - PPL Columns
| model_name | gen | gen_er | code | code_er | math | math_er |
| ---------- | ---- | ------- | ----- | -------- | ------ | -------- |
| F16 | 10.0118 | 0.2452 | 1.5919 | 0.0127 | 6.8875 | 0.141 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K | 10.0216 | 0.2444 | 1.5916 | 0.0126 | 6.8822 | 0.14 |
| MXFP4_MOE-output_q6_K-router_gate_emb_q6_K | 9.9831 | 0.2441 | 1.5927 | 0.0127 | 6.9066 | 0.1414 |
| MXFP4_MOE-F16 | 10.0066 | 0.245 | 1.5928 | 0.0128 | 6.893 | 0.1411 |
| MXFP4_MOE-Q6_K | 9.9966 | 0.2445 | 1.5933 | 0.0128 | 6.8997 | 0.1411 |
| MXFP4_MOE-output_mxfp4-embd_q6_K | 10.0333 | 0.2448 | 1.5922 | 0.0127 | 6.8794 | 0.1399 |
| MXFP4_MOE-Q8 | 10.0181 | 0.2454 | 1.5933 | 0.0128 | 6.8987 | 0.1412 |
| Q8_0 | 10.0174 | 0.2454 | 1.5931 | 0.0128 | 6.9001 | 0.1413 |
| Q6_K | 9.9687 | 0.2431 | 1.5926 | 0.0127 | 6.8924 | 0.1409 |
| MXFP4_MOE-output_mxfp4-embd_q8 | 10.0518 | 0.2455 | 1.5918 | 0.0126 | 6.8839 | 0.1401 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q8 | 10.0518 | 0.2455 | 1.5918 | 0.0126 | 6.8839 | 0.1401 |
| MXFP4_MOE-output_mxfp4-embd_q5_K | 10.0796 | 0.2462 | 1.5923 | 0.0127 | 6.9255 | 0.1415 |
| MXFP4_MOE-Q5_K | 10.0569 | 0.2465 | 1.5947 | 0.0128 | 6.9551 | 0.1431 |
| Q5_K_M | 10.0857 | 0.2469 | 1.5978 | 0.0128 | 6.9255 | 0.1413 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q5_K | 10.1209 | 0.2476 | 1.5928 | 0.0127 | 6.9394 | 0.1418 |
| MXFP4_MOE-output_mxfp4-embd_q4_K | 10.2105 | 0.2497 | 1.5985 | 0.0128 | 6.9846 | 0.1425 |
| Q4_K_M | 10.3299 | 0.2538 | 1.6081 | 0.0129 | 6.9383 | 0.1412 |
| MXFP4_MOE-Q4_K | 10.2603 | 0.2523 | 1.6028 | 0.013 | 7.0185 | 0.1439 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q4_K | 10.2553 | 0.2511 | 1.6007 | 0.0128 | 7.0365 | 0.144 |
| MXFP4_MOE-output_q8-embd_mxfp4 | 10.2392 | 0.2468 | 1.6014 | 0.0128 | 7.1444 | 0.1455 |
| MXFP4_MOE | 10.9465 | 0.2659 | 1.6645 | 0.0138 | 7.5735 | 0.1563 |
* gen = ppl_general
* gen_er = ppl_general_error
* code = ppl_code
* code_er = ppl_code_error
* math = ppl_math
* math_er = ppl_math_error
---
### Table - Precision Loss Columns
| model_name | loss_general | loss_code | loss_math |
| ---------- | ------------ | ---------- | ---------- |
| F16 | 0 | 0 | 0 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K | 0.0979 | -0.0188 | -0.077 |
| MXFP4_MOE-output_q6_K-router_gate_emb_q6_K | -0.2867 | 0.0503 | 0.2773 |
| MXFP4_MOE-F16 | -0.0519 | 0.0565 | 0.0799 |
| MXFP4_MOE-Q6_K | -0.1518 | 0.0879 | 0.1771 |
| MXFP4_MOE-output_mxfp4-embd_q6_K | 0.2147 | 0.0188 | -0.1176 |
| MXFP4_MOE-Q8 | 0.0629 | 0.0879 | 0.1626 |
| Q8_0 | 0.0559 | 0.0754 | 0.1829 |
| Q6_K | -0.4305 | 0.044 | 0.0711 |
| MXFP4_MOE-output_mxfp4-embd_q8 | 0.3995 | -0.0063 | -0.0523 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q8 | 0.3995 | -0.0063 | -0.0523 |
| MXFP4_MOE-output_mxfp4-embd_q5_K | 0.6772 | 0.0251 | 0.5517 |
| MXFP4_MOE-Q5_K | 0.4505 | 0.1759 | 0.9815 |
| Q5_K_M | 0.7381 | 0.3706 | 0.5517 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q5_K | 1.0897 | 0.0565 | 0.7535 |
| MXFP4_MOE-output_mxfp4-embd_q4_K | 1.9847 | 0.4146 | 1.4098 |
| Q4_K_M | 3.1773 | 1.0177 | 0.7376 |
| MXFP4_MOE-Q4_K | 2.4821 | 0.6847 | 1.902 |
| MXFP4_MOE-output_mxfp4-router_gate_emb_q4_K | 2.4321 | 0.5528 | 2.1633 |
| MXFP4_MOE-output_q8-embd_mxfp4 | 2.2713 | 0.5968 | 3.7299 |
| MXFP4_MOE | 9.336 | 4.5606 | 9.9601 |
* loss_general = precision_loss_general_pct
* loss_code = precision_loss_code_pct
* loss_math = precision_loss_math_pct