Views
No views yet
ik_llama.cpp imatrix Quantizations of moonshotai/Kimi-K2-Instruct-0905ik_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 for those.smol here simply means the routed experts recipe uses the same quantization for down as well as (gate|up) tensors.Q8_0 1016.117 GiB (8.504 BPW)
smol-IQ5_KS 632.664 GiB (5.295 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq5_ks
24blk\..*\.ffn_(gate|up)_exps\.weight=iq5_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq6_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ5_KS.gguf \
42 IQ5_KS \
43 192smol-IQ4_KSS 485.008 GiB (4.059 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq4_kss
24blk\..*\.ffn_(gate|up)_exps\.weight=iq4_kss
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq6_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ4_KSS.gguf \
42 IQ4_KSS \
43 192IQ4_KS 553.624 GiB (4.633 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq5_ks
24blk\..*\.ffn_(gate|up)_exps\.weight=iq4_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 1 -m 1 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-IQ4_KS.gguf \
42 IQ4_KS \
43 192IQ3_KS 420.558 GiB (3.520 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq4_kss
24blk\..*\.ffn_(gate|up)_exps\.weight=iq3_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-IQ3_KS.gguf \
42 IQ3_KS \
43 192smol-IQ3_KS 388.258 GiB (3.249 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq3_ks
24blk\..*\.ffn_(gate|up)_exps\.weight=iq3_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ3_KS.gguf \
42 IQ3_KS \
43 192IQ2_KL 358.419 GiB (3.000 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq3_k
24blk\..*\.ffn_(gate|up)_exps\.weight=iq2_kl
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-IQ2_KL.gguf \
42 IQ2_KL \
43 192smol-IQ2_KL 329.195 GiB (2.755 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq2_kl
24blk\..*\.ffn_(gate|up)_exps\.weight=iq2_kl
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 1 -m 1 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ2_KL.gguf \
42 IQ2_KL \
43 192IQ2_KS 289.820 GiB (2.425 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq2_kl
24blk\..*\.ffn_(gate|up)_exps\.weight=iq2_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 1 -m 1 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-IQ2_KS.gguf \
42 IQ2_KS \
43 192smol-IQ2_KS 270.133 GiB (2.261 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq2_ks
24blk\..*\.ffn_(gate|up)_exps\.weight=iq2_ks
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ2_KS.gguf \
42 IQ2_KS \
43 192smol-IQ1_KT 218.936 GiB (1.832 BPW)1#!/usr/bin/env bash
2
3custom="
4## Attention [0-60] (GPU)
5blk\..*\.attn_k_b\.weight=q8_0
6blk\..*\.attn_v_b\.weight=q8_0
7
8# Balance of attn tensors
9blk\..*\.attn_kv_a_mqa\.weight=q8_0
10blk\..*\.attn_q_a\.weight=q8_0
11blk\..*\.attn_q_b\.weight=q8_0
12blk\..*\.attn_output\.weight=q8_0
13
14## First Single Dense Layer [0] (GPU)
15blk\..*\.ffn_down\.weight=q8_0
16blk\..*\.ffn_(gate|up)\.weight=q8_0
17
18## Shared Expert [1-60] (GPU)
19blk\..*\.ffn_down_shexp\.weight=q8_0
20blk\..*\.ffn_(gate|up)_shexp\.weight=q8_0
21
22## Routed Experts [1-60] (CPU)
23blk\..*\.ffn_down_exps\.weight=iq1_kt
24blk\..*\.ffn_(gate|up)_exps\.weight=iq1_kt
25
26## Token embedding and output tensors (GPU)
27token_embd\.weight=iq4_k
28output\.weight=iq6_k
29"
30
31custom=$(
32 echo "$custom" | grep -v '^#' | \
33 sed -Ez 's:\n+:,:g;s:,$::;s:^,::'
34)
35
36numactl -N 0 -m 0 \
37./build/bin/llama-quantize \
38 --custom-q "$custom" \
39 --imatrix /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/imatrix-Kimi-K2-Instruct-0905-Q8_0.dat \
40 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-384x14B-Instruct-safetensors-0905-BF16-00001-of-00046.gguf \
41 /mnt/data/models/ubergarm/Kimi-K2-Instruct-0905-GGUF/Kimi-K2-Instruct-0905-smol-IQ1_KT.gguf \
42 IQ1_KT \
43 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-0905 \
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-0905 \
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