CoolFace
Modelpublic

magiccodingman/Qwen3-4B-Instruct-2507-MXFP4-Hybrid-GGUF

sourceHugging Faceapache-2.0updated 10mo agoView on Hugging Face
0likes582downloads
Model Card

DEPRECIATED!

This model was surpassed by:

https://huggingface.co/magiccodingman/Qwen3-4B-Instruct-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 Instruct 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 one of the 3 found magic models!

Stats compared against the standard Q8_0 (precision loss still compared to F16)

  • —MXFP4_MOE-Q6_K

+10.4% TPS vs Q8, 0.0178% precision loss, 4.5% smaller than Q8

(TLDR: I'm a scientist or something like that..)


  • —MXFP4_MOE-output_mxfp4-router_gate_emb_q6_K

12% smaller than Q8 • 415.24 TPS • 0.0547% precision loss

(TLDR: The perfect balance)


  • —MXFP4_MOE-output_q6_K-router_gate_emb_q6_K

9.5% smaller than Q8 • 427.22 TPS • 0.1051% precision loss

(TLDR: gotta go fast)


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 these models 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 Models - Use One Of These 3 Models!

Each of these models 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 these in the category of "Q7.5" quantization.

The following are the special models to note from what was created. Each of the 3 models shown below are being compared to the Q8 model.

MXFP4MOE-Q6K
(+10.4% TPS vs Q8, 0.0178% loss, 4.5% smaller than Q8)

Honestly, this model feels like Q8 with a gym membership. It's safe for scientific work, most stable for long context, and hits a sweet ~10% boost in TPS.

The following was the conversion script:

bash
llama-quantize \
  --tensor-type token_embd.weight=Q6_K \
  --tensor-type output.weight=Q6_K \
  "Path_To_F16_GGUF.gguf" \
  "Path_To_GGUF.gguf" \
  mxfp4_moe
MXFP4MOE-outputmxfp4-routergateembq6K
(12% smaller than Q8 • 415.24 TPS • 0.0547% loss)

This is the most balanced choice for real world use. It's a rock star in long context windows, great TPS, and decent model size savings compared to the Q8 model.

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
MXFP4MOE-outputq6K-routergateembq6_K
(9.5% smaller than Q8 • 427.22 TPS • 0.1051% loss)

This model is pure gremlin energy. It's goes fast. That's just what it do.

The following was the conversion script:

bash
llama-quantize \
  --tensor-type token_embd.weight=Q6_K \
  --tensor-type output.weight=Q6_K \
  --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 ExampleMeaning
MXFP4_MOEPure MXFP4 pipeline
MXFP4_MOE-Q8Embedding/output in Q8_0
MXFP4_MOE-F16Embedding/output in F16
output_mxfp4-embd_q8Output → MXFP4, Embedding → Q8
output_mxfp4-router_gate_emb_q5_KOutput → MXFP4, Emb/Router/Gate → Q5_K
MXFP4_MOE-Q6_KBoth embedding + output in Q6_K
Q8_0, Q6_K, Q4_K_MPure 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_namesize_reductiontps_change
Q8_046.8%42.02%
MXFP4_MOE-Q846.8%39.75%
MXFP4MOE-Q6K49.2%56.73%
MXFP4MOE-outputmxfp4-routergateembq6K53.2%57.76%
MXFP4_MOE-F1637.87%7.49%
MXFP4MOE-outputq6K-routergateembq6_K51.87%62.31%
MXFP4MOE-outputmxfp4-embdq6K50.53%59.39%
MXFP4MOE-outputmxfp4-embd_q849.33%44.6%
MXFP4MOE-outputmxfp4-routergateemb_q849.33%48.47%
MXFP4MOE-outputmxfp4-embdq5K51.2%70.98%
Q6_K58.93%43.73%
MXFP4MOE-Q5K50.4%67.03%
MXFP4MOE-outputmxfp4-routergateembq5K55.33%67.74%
Q5KM64.13%43.3%
MXFP4MOE-outputmxfp4-embdq4K51.73%76.42%
Q4KM68.93%54.38%
MXFP4MOE-outputmxfp4-routergateembq4K57.33%83.78%
MXFP4MOE-Q4K51.6%72.93%
MXFP4MOE-outputq8-embd_mxfp449.47%77.71%
MXFP4_MOE73.33%91.76%
  • —All percentages compared against the selected family F16 baseline.

Table - File Size + TPS + Avg Precision Loss

model_namefile_size_gbbench_tpsavg_prec_loss
F167.5263.210
Q8_03.99373.820.0049
MXFP4_MOE-Q83.99367.840.0126
MXFP4MOE-Q6K3.81412.520.0178
MXFP4MOE-outputmxfp4-routergateembq6K3.51415.240.0547
MXFP4_MOE-F164.66282.930.0647
MXFP4MOE-outputq6K-routergateembq6_K3.61427.220.1051
MXFP4MOE-outputmxfp4-embdq6K3.71419.530.1371
MXFP4MOE-outputmxfp4-embd_q83.8380.590.1725
MXFP4MOE-outputmxfp4-routergateemb_q83.8390.790.1725
MXFP4MOE-outputmxfp4-embdq5K3.66450.030.1873
Q6_K3.08378.30.2635
MXFP4MOE-Q5K3.72439.640.4048
MXFP4MOE-outputmxfp4-routergateembq5K3.35441.50.5808
Q5KM2.69377.170.7871
MXFP4MOE-outputmxfp4-embdq4K3.62464.350.8979
Q4KM2.33406.340.9867
MXFP4MOE-outputmxfp4-routergateembq4K3.2483.721.2362
MXFP4MOE-Q4K3.63455.171.247
MXFP4MOE-outputq8-embd_mxfp43.79467.742.9366
MXFP4_MOE2504.748.2072
  • —Bench NGL was 35
  • —Utilized CUDA

Table - PPL Columns

model_namegengen_ercodecode_ermathmath_er
F168.88410.20561.54680.01226.71110.137
Q8_08.87540.20531.54880.01236.7080.1367
MXFP4_MOE-Q88.88030.20551.54860.01236.70870.1367
MXFP4MOE-Q6K8.88020.20521.54840.01236.71070.1365
MXFP4MOE-outputmxfp4-routergateembq6K8.88220.20471.5460.01216.7050.1359
MXFP4_MOE-F168.88890.20581.5480.01236.71530.137
MXFP4MOE-outputq6K-routergateembq6_K8.87980.20531.5480.01236.73030.1372
MXFP4MOE-outputmxfp4-embdq6K8.87850.20461.54630.01216.68990.1353
MXFP4MOE-outputmxfp4-embd_q88.87530.20471.54570.01216.68780.1355
MXFP4MOE-outputmxfp4-routergateemb_q88.87530.20471.54570.01216.68780.1355
MXFP4MOE-outputmxfp4-embdq5K8.92510.2061.54660.01216.71870.1365
Q6_K8.84410.20341.54520.01216.69520.1357
MXFP4MOE-Q5K8.92630.20661.5510.01236.74250.1378
MXFP4MOE-outputmxfp4-routergateembq5K8.9790.20811.54810.01216.75070.1375
Q5KM8.97310.20791.5540.01236.77110.1384
MXFP4MOE-outputmxfp4-embdq4K9.04280.20991.55030.01216.75680.1364
Q4KM8.95690.20551.56940.01256.75670.1372
MXFP4MOE-outputmxfp4-routergateembq4K9.07610.21081.55460.01216.78110.1372
MXFP4MOE-Q4K9.07870.21161.55730.01246.76960.1372
MXFP4MOE-outputq8-embd_mxfp49.20940.21171.55980.01237.00020.1427
MXFP4_MOE9.87990.22821.61220.0137.32750.1494
  • —gen = ppl_general
  • —gener = pplgeneral_error
  • —code = ppl_code
  • —codeer = pplcode_error
  • —math = ppl_math
  • —mather = pplmath_error

Table - Precision Loss Columns

model_nameloss_generalloss_codeloss_math
F16000
Q8_0-0.09790.1293-0.0462
MXFP4_MOE-Q8-0.04280.1164-0.0358
MXFP4MOE-Q6K-0.04390.1034-0.006
MXFP4MOE-outputmxfp4-routergateembq6K-0.0214-0.0517-0.0909
MXFP4_MOE-F160.0540.07760.0626
MXFP4MOE-outputq6K-routergateembq6_K-0.04840.07760.2861
MXFP4MOE-outputmxfp4-embdq6K-0.063-0.0323-0.3159
MXFP4MOE-outputmxfp4-embd_q8-0.0991-0.0711-0.3472
MXFP4MOE-outputmxfp4-routergateemb_q8-0.0991-0.0711-0.3472
MXFP4MOE-outputmxfp4-embdq5K0.4615-0.01290.1132
Q6_K-0.4502-0.1034-0.2369
MXFP4MOE-Q5K0.4750.27150.4679
MXFP4MOE-outputmxfp4-routergateembq5K1.06820.0840.5901
Q5KM1.00180.46550.894
MXFP4MOE-outputmxfp4-embdq4K1.78630.22630.681
Q4KM0.81941.46110.6795
MXFP4MOE-outputmxfp4-routergateembq4K2.16120.50431.043
MXFP4MOE-Q4K2.19040.67880.8717
MXFP4MOE-outputq8-embd_mxfp43.66160.84044.3078
MXFP4_MOE11.20884.22819.1848
  • —lossgeneral = precisionlossgeneralpct
  • —losscode = precisionlosscodepct
  • —lossmath = precisionlossmathpct

Takeaway

  • —I found it very interesting how in general the Q6_K hybrid played nicer with MXFP4 than the Q8.
  • —I didn't include the MXFP4 Q8 in my suggested "good batch" category. Because it was the same file size, achieving the same or worse TPS, while losing precision compared to the normal Q8. So there was no real advantages to that model, even if it beat the chosen MXFP4 Q6_K hybrid models that I deemed as "Q7.5" category.
  • —Leaving the output weights on the conversion on MXFP4 consistently improved TPS with minimal precision loss. But in any scenario where the embd was left as MXFP4, it'd result in significantly lower precision.
  • —The pure MXFP4_MOE had significant brain damage. The AI model was NOT okay.
  • —The models I provided in the Bad-Hybrid-Models are the models I've deemed, "not useful enough to utilize compared to their normal non quantized counter parts."