跳到正文
DEV Community· Alexey Bolshakov·· 7 小時前AI 評分50

在舊硬件上以 CPU 運行 Kimi K3

Kimi-k3-in-c on old hardware

AI 導讀

作者使用純 C99 引擎 kimi-k3-in-c,在沒有 GPU 的舊伺服器上運行 Kimi K3。伺服器配備 2× Xeon E5-2697 v2、約 192 GB RAM 和六部 HDD;下載 1.56 TB checkpoint 耗時 67 小時 17 分鐘。生成 8 個 tokens 耗時 5219 秒,峯值 RSS 為 127.91 GB。

正文

kimi-k3-in-c on old iron

AI translation of the original Russian article: Kimi-k3-in-c на старом железе.

Still poking at aging home servers — on CPU again, because we still don't have GPUs. Same story as running a 32B model on an old Xeon and half a terabyte of GGUFs with no GPU.

YouTube is full of Kimi K3 clips (2.78T parameters, MoE). Almost all of them look generated. I haven't seen a real run there with timings, RSS, and console output. Below is one: my server, my disks, my logs. Date: 27 November 2026.

Official checkpoint moonshotai/Kimi-K3, engine kimi-k3-in-c — plain C99, no BLAS, no GPU.

Hardware

Same ibm host as in the previous post, but the RAM is different. It used to be 64 GiB; then I stuck in six more 32 GB DDR3-1866 ECC Samsung sticks — about 192 GB total, 188.8 GiB visible in the OS. Without that headroom the server preset (~128 GB plan) simply wouldn't fit.

CPU 2× Xeon E5-2697 v2 @ 2.70 GHz, 48 threads
SIMD AVX yes, AVX2 no
GPU none
Disk ZFS on six 2.2 T HDDs (not NVMe)

Proxmox screenshots from that day (download → Hello → GForth):

Proxmox ibm summary: 48× E5-2697 v2, 188.85 GiB RAM

CPU usage ~45% and server load ~25 during K3

Memory ~152 GiB plateaus and network during download

IO pressure stall during download and inference

During generation: CPU ~45% / load ~25 (k3 holds ~24 threads), memory in two plateaus around 152 GiB, network 6–7 MB/s only while downloading. IO stall — spikes on the download, then a long plateau while experts are read from HDD.

How long we waited

Stage Wait
Download checkpoint 1.56 TB (96 shards) three days (67 h 17 min), ~6.4 MB/s
Verify checksums another full pass over the same 1.56 TB
pack-trunk → trunk.bin 108.81 GB ~6 minutes

I started downloading the evening of Nov 23/24 and finished the morning of the 27th. From the hf log: Fetching 119 files … [67:17:02].

Then pack-trunk: the dense part of the model (the trunk) is packed into one file by layer — 93 layers here, largest 2.341 GB. Experts (~1.45 TB) stay on disk; the engine streams them as it goes. This is not GGUF and not “download and plug into llama.cpp”: it runs through its own console client. The README assumes NVMe. I have spinning rust (not even SSD — proper platter drives, though server-grade: 6× EXOS 2.4 Tb) and a CPU without AVX2, so of course it wasn't going to be fast. Even compiling the binary for this CPU didn't work out of the box. Luckily there are tests, and with some AI help, around attempt #25, I finally found the right build flags.

Smoke test: Hello

I typed Hello. It answered , I am a 20 year old. So basically it just continued my phrase.

./bin/k3 /ibm_bulk/k3model --trunk /ibm_bulk/k3trunk --preset server \
  --tok /ibm_bulk/k3model --prompt 'Hello' --incremental

24 threads, server preset. Memory plan ~128 GB; 89 of 93 layers pinned in RAM. The model answered: , I am a 20 year old. Eight tokens took 5219 seconds — about an hour and a half. Average almost 11 minutes per token. First (cold) token: 833 seconds; the rest a flat 625–629. Peak RSS 127.91 GB. Disk read for the run: ~207 GB experts and ~132 GB trunk. I/O was only 13.8% of wall time; the rest was the CPU grinding.

While the engine was pinning the trunk, it took about fifteen minutes to the first token: RSS climbed from zero to ~119 GiB and then barely moved. The log shows 100% cache hit, but true resident hits on experts already in RAM: zero. Every token is read from disk again.

Full tmux output below — pack plus the run. You don't usually get this in those YouTube clips.

packing trunk from 96 shards -> /ibm_bulk/k3trunk
indexing 96 safetensors shards...
indexed 2628 trunk tensors; skipped 494592 routed-expert metadata entries
  packed 10/93 layers, 12.90 GB, 38 s (339 MB/s)
  packed 20/93 layers, 24.31 GB, 77 s (315 MB/s)
  packed 30/93 layers, 36.14 GB, 116 s (312 MB/s)
  packed 40/93 layers, 47.55 GB, 154 s (308 MB/s)
  packed 50/93 layers, 59.38 GB, 193 s (308 MB/s)
  packed 60/93 layers, 70.79 GB, 231 s (307 MB/s)
  packed 70/93 layers, 82.62 GB, 272 s (304 MB/s)
  packed 80/93 layers, 94.02 GB, 310 s (303 MB/s)
  packed 90/93 layers, 105.86 GB, 350 s (303 MB/s)
  packed 93/93 layers, 108.81 GB, 359 s (303 MB/s)

wrote /ibm_bulk/k3trunk/.../trunk.bin: 108.81 GB across 93 layers
largest layer run: 2.341 GB  <- the streaming slot size
published packed trunk in /ibm_bulk/k3trunk

root@ibm:/ibm_bulk/kimi-k3-in-c# ./bin/k3 /ibm_bulk/k3model --trunk /ibm_bulk/k3trunk --preset server --tok /ibm_bulk/k3model --prompt 'Hello' --incremental
threads: 24
config: /ibm_bulk/k3model/config.json (nested shape) | hidden=7168 layers=93 vocab=163840 | 24 MLA + 69 KDA | experts 896 top16 shared2 | latent=3584
[TOK] 163584 ranks (max id 163583) + 16 added tokens | kimi=1 rankbpe=1
  tokenized: 5 bytes -> 1 ids
  KV cache : 23.70 MB for 10 positions (2.37 MB/position)
Kimi K3, pure C, released checkpoint
  model    : /ibm_bulk/k3model
  prompt   : 1 tokens, generating 8
  preset   : server (trunk 110.00 GB / expert cache 13.00 GB)

indexed 497220 tensors from 96 shards in 1.82 s
trunk on disk : 110.00 GB total (STREAMED from /ibm_bulk/k3trunk, not held in RAM)

memory plan
  trunk (STREAMED) 110.00 GB
  embed + lm_head  4.70 GB (resident)
  expert cache     13.00 GB
  recurrent state  626.25 MB
  buffers          8.02 MB
  KV cache         23.65 MB
  TOTAL            128.36 GB
  available        166.11 GB

trunk stream: 108.81 GB packed, 89/93 layers PINNED (107.74 GB), ring 2 x 0.87 GB
              pinned LARGEST FIRST; the ring slot is sized to the largest UNPINNED layer (0.84 GB
              of a 2.34 GB maximum)
              reads use O_DIRECT (page cache bypassed), pread in parallel 64 MiB chunks
              deterministic hit rate 95.7% (a cyclic scan defeats LRU, so a pinned SET is used instead)
trunk streaming enabled from /ibm_bulk/k3trunk in 0.0 s
embedding, final norm and lm_head: 4.70 GB in 7.0 s

peak RSS after loading weights: 4.80 GB  (the plan above is a forecast, this is measured)
expert cache: 740 slots x 17.56 MB = 12.99 GB (0.90% of the 1.45 TB expert pool)

recurrent state for 93 layers: 626.25 MB

incremental decode: KV cache 23.65 MB for 24 MLA layers at 10 positions

STEP   TOKEN      SECONDS      CACHE HIT  READ GB    TOK/S
--------------------------------------------------------------------
0      11         833.25       100.0      25.83      0.001
1      374        627.03       100.0      25.83      0.002
2      1491       626.62       100.0      25.83      0.002
3      261        626.86       100.0      25.83      0.002
4      220        625.41       100.0      25.83      0.002
5      577        625.67       100.0      25.83      0.002
6      1389       625.58       100.0      25.83      0.002
7      3410       628.91       100.0      25.83      0.002
--------------------------------------------------------------------
8 tokens in 5219.3 s, 652.42 s/token average

--- generated text ---
, I am a 20 year old
----------------------

PEAK RSS for the whole run: 127.91 GB   <- quote this, not the plan
layers completed: 93/93; routed expert drops: 0

cache [final step]
  slots        : 740 of 17.56 MB = 12.99 GB arena (740 resident, 0 pinned)
  requests     : 1472  hits 1472 (100.00%)  misses 0  evictions 1472
  of those hits : 1472 came from the batch prefetch, i.e. read from disk
                  this token; TRUE resident hit rate 0.00%
  read from disk: 25.83 GB in 58.18 s (444 MB/s while loading)

wrote k3_run.json
I/O share of wall clock: 13.8%  (trunk 255.4 s + experts 467.1 s + model tables 0.0 s of 5219.3 s)
  both figures are WHOLE-RUN totals over 8 steps
  experts, whole run: 206.64 GB read | 740 of 11776 requests retained in RAM (6.28%) | 11036 evictions
    (retention = requests - evictions; the raw `hits` counter includes
     experts the prefetcher had just read from disk, so it is not a
     measure of avoided I/O)

trunk [final]
  pinned 89/93 layers, ring 2 slots
  binds 744, hits 623 (83.7%), reads 121
  read 132.45 GB in 255.39 s (519 MB/s)
  reads 121 against 121 the walk owes (8 passes, 89 pinned)  -- exact
  bind wall 210.78 s over 744 binds; read 255.39 + widen 5.50 = 260.89 s of device work,
                    of which 50.11 s (19%) overlapped compute on the reader thread

Simple takeaway: it runs. Using it as a chat on this hardware — no.

Same benchmark as the old XEON: factorial in GForth

In the first Xeon post, DeepSeek-R1-Distill-Qwen-32B on 2× E5440 spent six hours “writing” a factorial for gforth and produced broken code. Same idea here, different format: not a long chat, but a continuation with a hard --gen 28 cap (at most 28 new tokens).

Prompt:

\ GForth. Finish this word only. No text after the definition.
: factorial ( n -- n! )
./bin/k3 /ibm_bulk/k3model --trunk /ibm_bulk/k3trunk --preset server \
  --tok /ibm_bulk/k3model --prompt-file /tmp/gforth-fac.txt --gen 28 --incremental

The model finished a recursive definition that actually makes sense:

: factorial ( n -- n! )
  dup 1 > if
    dup 1- recurse *
  else
    drop 1
  then ;

After the semicolon it wandered into markdown. The 28-token limit cut the tail off, but the word itself was already done.

Ran from about 02:13 to 10:54 Moscow time — 31053 seconds, eight hours thirty-seven minutes. The first token ate four hours (14404 s, 277 GB read from disk). After that, a steady ~10 minutes per token. Peak RSS 128.03 GB; experts read nearly a terabyte over the whole run.

I copied the definition onto my laptop and ran it in gforth 0.7.9:

: factorial ( n -- n! )
  dup 1 > if
    dup 1- recurse *
  else
    drop 1
  then ;  ok
1 factorial .s   \ <1> 1
10 factorial .s  \ <2> 1 3628800

1 factorial → 1, 10 factorial → 3628800. It compiles and gives the right answer. I'll call that a win.

On the old XEON with R1 it was long and wrong. Here it's long too — but the code works. The Forth claim isn't empty this time: there's an ok in real gforth.

Takeaway

Hello took a bit over an hour. The Forth factorial — almost nine, four of them on the first token. Useless speed for real work: no AVX2, plain spinning disks.

But the punchline is simple and nice: on the same benchmark where the old Xeon + R1 spent six hours producing dead code, Kimi K3 on a much heavier model produced working Forth — 10 factorial in gforth is 3628800. Slow, but correct.

來源:DEV Community · dev.to