Request for UD quants of the model

#2
by anjeysapkovski - opened

Dear @Jackrong , thank you for your work. The models are awesome. The only issue is with their quants.
Default Q2, Q3, Q4 quantization does not preserve models quality, because many fragile tensor types could be quantized with higher bits at the cost of a tiny file increase.

Problem Statement

The main weaknesses in current Q4_K_M quantization (just for example) are insufficient precision on highly sensitive tensors, particularly: attention projections (Q/K/V/Output), SSM components, and MTP-related tensors. These lower-bit assignments (mostly Q4_K and some mixed Q6_K) increase quantization error in critical paths compared to Unsloth’s more conservative approach.

Proposed Improvements (based on Unsloth’s superior strategy):

attn_qkv.weight [2048, 8192] Q6_K => attn_qkv.weight [2048, 8192] Q8_0
attn_q.weight [2048, 8192] Q4_K => attn_q.weight [2048, 8192] Q8_0
attn_k.weight [2048, 512] Q4_K => attn_k.weight [2048, 512] Q8_0
attn_v.weight [2048, 512] Q6_K => attn_v.weight [2048, 512] Q8_0
attn_output.weight [4096, 2048] Q4_K => attn_output.weight [4096, 2048] Q8_0
ffn_down_exps.weight [512, 2048, 256] Q6_K => ffn_down_exps.weight [512, 2048, 256] Q5_K
ffn_down_shexp.weight [512, 2048] Q6_K => ffn_down_shexp.weight [512, 2048] Q8_0
ffn_gate_shexp.weight [2048, 512] Q4_K => ffn_gate_shexp.weight [2048, 512] Q8_0
ffn_up_shexp.weight [2048, 512] Q4_K => ffn_up_shexp.weight [2048, 512] Q8_0
ssm_alpha.weight [2048, 32] Q4_K => ssm_alpha.weight [2048, 32] F32
ssm_beta.weight [2048, 32] Q4_K => ssm_beta.weight [2048, 32] F32
ssm_out.weight [4096, 2048] Q4_K => ssm_out.weight [4096, 2048] Q8_0
nextn.eh_proj.weight [4096, 2048] Q4_K => nextn.eh_proj.weight [4096, 2048] Q8_0

Recommended llama-quantize Command

./llama-quantize \
  --imatrix imatrix.dat \
  --tensor-type "attn_qkv.weight=Q8_0" \
  --tensor-type "attn_q.weight=Q8_0" \
  --tensor-type "attn_k.weight=Q8_0" \
  --tensor-type "attn_v.weight=Q8_0" \
  --tensor-type "attn_output.weight=Q8_0" \
  --tensor-type "ffn_down_exps.weight=Q5_K" \
  --tensor-type "ffn_down_shexp.weight=Q8_0" \
  --tensor-type "ffn_gate_shexp.weight=Q8_0" \
  --tensor-type "ffn_up_shexp.weight=Q8_0" \
  --tensor-type "ssm_alpha.weight=F32" \
  --tensor-type "ssm_beta.weight=F32" \
  --tensor-type "ssm_out.weight=Q8_0" \
  --tensor-type "nextn.eh_proj.weight=Q8_0" \
  --output-tensor-type Q6_K \
  model-f16.gguf \
  model-Q4_K_M-improved.gguf \
  Q4_K_M

This command uses Q4_K_M as the base quantization while selectively applying higher precision to the most critical tensors following Unsloth’s proven pattern.

Sign up or log in to comment