ubergarm commited on
Commit
16fe8c2
·
1 Parent(s): 67744b8

add perplexity and stub out smol-IQ1_KT

Browse files
Files changed (1) hide show
  1. README.md +115 -3
README.md CHANGED
@@ -26,13 +26,125 @@ Also thanks to all the folks in the quanting and inferencing community on [Beave
26
  Finally, I appreciate all the support from [aifoundry.org](https://aifoundry.org) and team as well as huggingface for hosting all these big quants!
27
 
28
  ## Quant Collection
29
- This is an interesting one, currently only one available given the the original model design. The `Q8_0-Q4_0` is `q4_0` routed experts and `q8_0` all other tensors. It works on both ik_llama.cpp and mainline llama.cpp in limited testing. It does *not* use an imatrix!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- * `Q8_0-Q4_0` 543.617 GiB (4.549 BPW)
 
 
 
 
 
 
 
 
 
32
 
 
33
  Final estimate: PPL = TODO
34
 
35
- I may try to make a smaller one e.g. `smol-IQ1_KT` or `smol-IQ2_KS` or similar but not sure how well it will go given the original is QAT'd with `compressed-tensors` to *very similar* to q4_0 except using bf16 block scales instead of fp16 but same 32 weights per block size.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  ## Quick Start
38
  You might need to override the template as needed. The original is here: https://huggingface.co/moonshotai/Kimi-K2-Thinking/blob/main/chat_template.jinja
 
26
  Finally, I appreciate all the support from [aifoundry.org](https://aifoundry.org) and team as well as huggingface for hosting all these big quants!
27
 
28
  ## Quant Collection
29
+ I may try to make a smaller one e.g. `smol-IQ1_KT` or `smol-IQ2_KS` or similar but not sure how well it will go given the original is QAT'd with `compressed-tensors` to *very similar* to q4_0 except using bf16 block scales instead of fp16 but same 32 weights per block size.
30
+
31
+ Perplexity computed against *wiki.test.raw*.
32
+
33
+ ![Perplexity Chart](images/perplexity.png "Chart showing Perplexity improving as BPW increases.")
34
+
35
+ ## Q8_0-Q4_0 543.617 GiB (4.549 BPW)
36
+ Final estimate: PPL = 2.1257 +/- 0.00934
37
+
38
+ This specific quant works on both ik_llama.cpp and mainline llama.cpp. It does *not* use an imatrix and was created going from the original model to full bf16 before further quantization. The exact PR used is linked below in references.
39
+
40
+ <details>
41
+
42
+ <summary>👈 Secret Recipe</summary>
43
+
44
+ ```bash
45
+ #!/usr/bin/env bash
46
+
47
+ # Q4_0 routed experts approximating original QAT design
48
+ # Q8_0 everything else
49
+
50
+ custom="
51
+ ## Attention [0-60] (GPU)
52
+ blk\..*\.attn_k_b\.weight=q8_0
53
+ blk\..*\.attn_v_b\.weight=q8_0
54
+
55
+ # Balance of attn tensors
56
+ blk\..*\.attn_kv_a_mqa\.weight=q8_0
57
+ blk\..*\.attn_q_a\.weight=q8_0
58
+ blk\..*\.attn_q_b\.weight=q8_0
59
+ blk\..*\.attn_output\.weight=q8_0
60
+
61
+ ## First Single Dense Layer [0] (GPU)
62
+ blk\..*\.ffn_down\.weight=q8_0
63
+ blk\..*\.ffn_(gate|up)\.weight=q8_0
64
+
65
+ ## Shared Expert [1-60] (GPU)
66
+ blk\..*\.ffn_down_shexp\.weight=q8_0
67
+ blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
68
+
69
+ ## Routed Experts [1-60] (CPU)
70
+ blk\..*\.ffn_down_exps\.weight=q4_0
71
+ blk\..*\.ffn_(gate|up)_exps\.weight=q4_0
72
+
73
+ token_embd\.weight=q8_0
74
+ output\.weight=q8_0
75
+ "
76
+
77
+ custom=$(
78
+ echo "$custom" | grep -v '^#' | \
79
+ sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
80
+ )
81
 
82
+ numactl -N ${SOCKET} -m ${SOCKET} \
83
+ ./build/bin/llama-quantize \
84
+ --custom-q "$custom" \
85
+ /mnt/data/models/ubergarm/Kimi-K2-Thinking-GGUF/-384x14B-BF16-00001-of-00046.gguf \
86
+ /mnt/data/models/ubergarm/Kimi-K2-Thinking-GGUF/Kimi-K2-Thinking-Q8_0-Q4_0.gguf \
87
+ Q8_0 \
88
+ 128
89
+ ```
90
+
91
+ </details>
92
 
93
+ ## smol-IQ1_KT TODO
94
  Final estimate: PPL = TODO
95
 
96
+ Not sure this will be any good, finishing up imatrix now and will test this before releasing. Hopefully will fit in under 256GB RAM+VRAM.
97
+
98
+ <details>
99
+
100
+ <summary>👈 Secret Recipe</summary>
101
+
102
+ ```bash
103
+ #!/usr/bin/env bash
104
+
105
+ custom="
106
+ ## Attention [0-60] (GPU)
107
+ blk\..*\.attn_k_b\.weight=q8_0
108
+ blk\..*\.attn_v_b\.weight=q8_0
109
+
110
+ # Balance of attn tensors
111
+ blk\..*\.attn_kv_a_mqa\.weight=q8_0
112
+ blk\..*\.attn_q_a\.weight=q8_0
113
+ blk\..*\.attn_q_b\.weight=q8_0
114
+ blk\..*\.attn_output\.weight=q8_0
115
+
116
+ ## First Single Dense Layer [0] (GPU)
117
+ blk\..*\.ffn_down\.weight=q8_0
118
+ blk\..*\.ffn_(gate|up)\.weight=q8_0
119
+
120
+ ## Shared Expert [1-60] (GPU)
121
+ blk\..*\.ffn_down_shexp\.weight=q8_0
122
+ blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
123
+
124
+ ## Routed Experts [1-60] (CPU)
125
+ blk\..*\.ffn_down_exps\.weight=iq1_kt
126
+ blk\..*\.ffn_(gate|up)_exps\.weight=iq1_kt
127
+
128
+ token_embd\.weight=iq4_k
129
+ output\.weight=iq6_k
130
+ "
131
+
132
+ custom=$(
133
+ echo "$custom" | grep -v '^#' | \
134
+ sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
135
+ )
136
+
137
+ numactl -N ${SOCKET} -m ${SOCKET} \
138
+ ./build/bin/llama-quantize \
139
+ --custom-q "$custom" \
140
+ --imatrix /mnt/data/models/ubergarm/Kimi-K2-Thinking-GGUF/imatrix-Kimi-K2-Thinking-BF16.dat \
141
+ /mnt/data/models/ubergarm/Kimi-K2-Thinking-GGUF/-384x14B-BF16-00001-of-00046.gguf \
142
+ /mnt/data/models/ubergarm/Kimi-K2-Thinking-GGUF/Kimi-K2-Thinking-IQ1_KT.gguf \
143
+ IQ1_KT \
144
+ 128
145
+ ```
146
+
147
+ </details>
148
 
149
  ## Quick Start
150
  You might need to override the template as needed. The original is here: https://huggingface.co/moonshotai/Kimi-K2-Thinking/blob/main/chat_template.jinja