Views
No views yet
ik_llama.cpp imatrix Quantizations of moonshotai/Kimi-K2-Instructik_llama.cpp can also run your existing GGUFs from bartowski, unsloth, mradermacher, etc if you want to try it out before downloading my quants.Q8_0 1016.623 GiB (8.504 BPW):
IQ4_KS 554.421 GiB (4.638 BPW)IQ4_KS ffn_(gate|up)_exps and IQ5_KS ffn_down_exps routed experts.1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
6blk\..*\.attn_kv_b\.weight=q8_0
7
8# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
9# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
10blk\..*\.attn_k_b\.weight=q8_0
11
12# Balance of attn tensors
13blk\..*\.attn_.*=q8_0
14
15## First Single Dense Layer [0] (GPU)
16blk\..*\.ffn_down\.weight=q8_0
17blk\..*\.ffn_(gate|up)\.weight=q8_0
18
19## Shared Expert [1-60] (GPU)
20blk\..*\.ffn_down_shexp\.weight=q8_0
21blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
22
23## Routed Experts [1-60] (CPU)
24blk\..*\.ffn_down_exps\.weight=iq5_ks
25blk\..*\.ffn_(gate|up)_exps\.weight=iq4_ks
26
27## Token embedding and output tensors (GPU)
28token_embd\.weight=iq6_k
29output\.weight=iq6_k
30"
31
32custom=$(
33 echo "$custom" | grep -v '^#' | \
34 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
35)
36
37numactl -N 1 -m 1 \
38./build/bin/llama-quantize \
39 --custom-q "$custom" \
40 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
41 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
42 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-IQ4_KS.gguf \
43 IQ4_KS \
44 192IQ3_KS 430.908 GiB (3.604 BPW)IQ3_KS ffn_(gate|up)_exps and IQ4_KS ffn_down_exps routed experts.1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
6blk\..*\.attn_kv_b\.weight=q8_0
7
8# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
9# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
10blk\..*\.attn_k_b\.weight=q8_0
11
12# Balance of attn tensors
13blk\..*\.attn_.*=q8_0
14
15## First Single Dense Layer [0] (GPU)
16blk\..*\.ffn_down\.weight=q8_0
17blk\..*\.ffn_(gate|up)\.weight=q8_0
18
19## Shared Expert [1-60] (GPU)
20blk\..*\.ffn_down_shexp\.weight=q8_0
21blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
22
23## Routed Experts [1-60] (CPU)
24blk\..*\.ffn_down_exps\.weight=iq4_ks
25blk\..*\.ffn_(gate|up)_exps\.weight=iq3_ks
26
27## Token embedding and output tensors (GPU)
28token_embd\.weight=iq4_k
29output\.weight=iq6_k
30"
31
32custom=$(
33 echo "$custom" | grep -v '^#' | \
34 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
35)
36
37numactl -N 1 -m 1 \
38./build/bin/llama-quantize \
39 --custom-q "$custom" \
40 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
41 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
42 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-IQ3_KS.gguf \
43 IQ3_KS \
44 192IQ2_KL 349.389 GiB (2.923 BPW)IQ2_KL ffn_(gate|up)_exps and IQ3_KS ffn_down_exps routed experts.1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
6blk\..*\.attn_kv_b\.weight=q8_0
7
8# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
9# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
10blk\..*\.attn_k_b\.weight=q8_0
11
12# Balance of attn tensors
13blk\..*\.attn_.*=q8_0
14
15## First Single Dense Layer [0] (GPU)
16blk\..*\.ffn_down\.weight=q8_0
17blk\..*\.ffn_(gate|up)\.weight=q8_0
18
19## Shared Expert (1-60) (GPU)
20blk\..*\.ffn_down_shexp\.weight=q8_0
21blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
22
23## Routed Experts (1-60) (CPU)
24blk\..*\.ffn_down_exps\.weight=iq3_ks
25blk\..*\.ffn_(gate|up)_exps\.weight=iq2_kl
26
27## Token embedding and output tensors (GPU)
28token_embd\.weight=iq4_k
29output\.weight=iq6_k
30"
31
32custom=$(
33 echo "$custom" | grep -v '^#' | \
34 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
35)
36
37numactl -N 1 -m 1 \
38./build/bin/llama-quantize \
39 --custom-q "$custom" \
40 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
41 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
42 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-IQ2_KL.gguf \
43 IQ2_KL \
44 192smol-IQ2_KL 329.702 GiB (2.758 BPW)IQ2_KL ffn_(gate|up)_exps and also IQ2_KL ffn_down_exps routed experts.1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
6blk\..*\.attn_kv_b\.weight=q8_0
7
8# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
9# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
10blk\..*\.attn_k_b\.weight=q8_0
11
12# Balance of attn tensors
13blk\..*\.attn_.*=q8_0
14
15## First Single Dense Layer [0] (GPU)
16blk\..*\.ffn_down\.weight=q8_0
17blk\..*\.ffn_(gate|up)\.weight=q8_0
18
19## Shared Expert (1-60) (GPU)
20blk\..*\.ffn_down_shexp\.weight=q8_0
21blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
22
23## Routed Experts (1-60) (CPU)
24blk\..*\.ffn_down_exps\.weight=iq2_kl
25blk\..*\.ffn_(gate|up)_exps\.weight=iq2_kl
26
27## Token embedding and output tensors (GPU)
28token_embd\.weight=iq4_k
29output\.weight=iq6_k
30"
31
32custom=$(
33 echo "$custom" | grep -v '^#' | \
34 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
35)
36
37numactl -N 1 -m 1 \
38./build/bin/llama-quantize \
39 --custom-q "$custom" \
40 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
41 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
42 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-bigattnshexpdense-smol-IQ2_KL.gguf \
43 IQ2_KL \
44 192IQ2_KS 290.327 GiB (2.429 BPW)IQ2_KS ffn_(gate|up)_exps and band new SOTA IQ2_KL ffn_down_exps routed experts.1custom="
2## Attention [0-60] (GPU)
3# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
4blk\..*\.attn_kv_b\.weight=q8_0
5
6# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
7# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
8blk\..*\.attn_k_b\.weight=q8_0
9
10# Balance of attn tensors
11blk\..*\.attn_.*=q8_0
12
13## First Single Dense Layer [0] (GPU)
14blk\..*\.ffn_down\.weight=q8_0
15blk\..*\.ffn_(gate|up)\.weight=q8_0
16
17## Shared Expert [1-60] (GPU)
18blk\..*\.ffn_down_shexp\.weight=q8_0
19blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
20
21## Routed Experts [1-60] (CPU)
22blk\..*\.ffn_down_exps\.weight=iq2_kl
23blk\..*\.ffn_(gate|up)_exps\.weight=iq2_ks
24
25## Token embedding and output tensors (GPU)
26token_embd\.weight=iq4_k
27output\.weight=iq6_k
28"
29
30custom=$(
31 echo "$custom" | grep -v '^#' | \
32 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
33)
34
35numactl -N 1 -m 1 \
36./build/bin/llama-quantize \
37 --custom-q "$custom" \
38 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
39 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
40 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-IQ2_KS.gguf \
41 IQ2_KS \
42 192IQ1_KT 234.141 GiB (1.959 BPW)IQ1_KT ffn_(gate|up)_exps and IQ2_KT ffn_down_exps routed experts.1custom="
2## Attention [0-60] (GPU)
3# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
4blk\..*\.attn_kv_b\.weight=q8_0
5
6# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
7# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
8blk\..*\.attn_k_b\.weight=q8_0
9
10# Balance of attn tensors
11blk\..*\.attn_.*=q8_0
12
13## First Single Dense Layer [0] (GPU)
14blk\..*\.ffn_down\.weight=q8_0
15blk\..*\.ffn_(gate|up)\.weight=q8_0
16
17## Shared Expert [1-60] (GPU)
18blk\..*\.ffn_down_shexp\.weight=q8_0
19blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
20
21## Routed Experts [1-60] (CPU)
22blk\..*\.ffn_down_exps\.weight=iq2_kt
23blk\..*\.ffn_(gate|up)_exps\.weight=iq1_kt
24
25## Token embedding and output tensors (GPU)
26token_embd\.weight=iq4_kt
27output\.weight=iq6_k
28"
29
30custom=$(
31 echo "$custom" | grep -v '^#' | \
32 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
33)
34
35numactl -N 1 -m 1 \
36./build/bin/llama-quantize \
37 --custom-q "$custom" \
38 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
39 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
40 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-bigattnshexpdense-IQ1_KT.gguf \
41 IQ1_KT \
42 192smol-IQ1_KT 219.375 GiB (1.835 BPW)IQ1_KT ffn_(gate|up)_exps and also IQ1_KT ffn_down_exps routed experts.1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5# Only ik's fork uses this, keep it q8_0 as its only for PP with -mla 3
6blk\..*\.attn_kv_b\.weight=q8_0
7
8# ideally k_b and v_b are smaller than q8_0 as they are is used for TG with -mla 3 (and ik's imatrix supports it)
9# blk.*.attn_k_b.weight is not divisible by 256 so only supports qN_0 or iq4_nl
10blk\..*\.attn_k_b\.weight=q8_0
11
12# Balance of attn tensors
13blk\..*\.attn_.*=q8_0
14
15## First Single Dense Layer [0] (GPU)
16blk\..*\.ffn_down\.weight=q8_0
17blk\..*\.ffn_(gate|up)\.weight=q8_0
18
19## Shared Expert [1-60] (GPU)
20blk\..*\.ffn_down_shexp\.weight=q8_0
21blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
22
23## Routed Experts [1-60] (CPU)
24blk\..*\.ffn_down_exps\.weight=iq1_kt
25blk\..*\.ffn_(gate|up)_exps\.weight=iq1_kt
26
27## Token embedding and output tensors (GPU)
28token_embd\.weight=iq4_kt
29output\.weight=iq6_k
30"
31
32custom=$(
33 echo "$custom" | grep -v '^#' | \
34 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
35)
36
37numactl -N 1 -m 1 \
38./build/bin/llama-quantize \
39 --custom-q "$custom" \
40 --imatrix /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/imatrix-Kimi-K2-Instruct-Q8_0.dat \
41 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-384x15B-Instruct-safetensors-BF16-00001-of-00045.gguf \
42 /mnt/raid/models/ubergarm/Kimi-K2-Instruct-GGUF/Kimi-K2-Instruct-bigattnshexpdense-smol-IQ1_KT.gguf \
43 IQ1_KT \
44 1921# Two CUDA devices with enough VRAM to offload more layers
2# Keep in mind Kimi-K2 starts at 1 unlike DeepSeek at 3 (first dense layers)
3./build/bin/llama-server \
4 --model "$model"\
5 --alias ubergarm/Kimi-K2-Instruct \
6 --ctx-size 32768 \
7 -ctk q8_0 \
8 -fa -fmoe \
9 -mla 3 \
10 -ngl 99 \
11 -ot "blk\.(1|2|3)\.ffn_.*=CUDA0" \
12 -ot "blk\.(4|5|6)\.ffn_.*=CUDA1" \
13 -ot exps=CPU \
14 --parallel 1 \
15 --threads 48 \
16 --threads-batch 64 \
17 --host 127.0.0.1 \
18 --port 80801# compile
2cmake -B build -DGGML_CUDA=0 -DGGML_BLAS=0 -DGGML_VULKAN=0
3cmake --build build --config Release -j $(nproc)
4
5# run server
6# single CPU of a dual socket rig configured one NUMA per socket
7numactl -N 0 -m 0 \
8./build/bin/llama-server \
9 --model "$model"\
10 --alias ubergarm/Kimi-K2-Instruct \
11 --ctx-size 98304 \
12 -ctk q8_0 \
13 -fa -fmoe \
14 -mla 3 \
15 --parallel 1 \
16 --threads 128 \
17 --threads-batch 192 \
18 --numa numactl \
19 --host 127.0.0.1 \
20 --port 8080