Skip to content

Run frontier MoE models on hardware you already own β€” pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

docs(experiments): the CPU read ceiling, llama.cpp, determinism, and a refuted hypothesis

Nicolas3159c0f7c9a4
diff --git a/docs/experiments/glm52-4xa6000-2026-08-02.md b/docs/experiments/glm52-4xa6000-2026-08-02.md
index 277e3433..35d00803 100644
--- a/docs/experiments/glm52-4xa6000-2026-08-02.md
+++ b/docs/experiments/glm52-4xa6000-2026-08-02.md
@@ -144,10 +144,49 @@ attention breakdown: projection/RoPE 4.592 s
output projection 6.261 s
```
-**Attention is 64 % of decode; expert compute is 19 %; disk is 5 %.** This reorders every
-placement question in this report. Expert residency, tiering and pinning together govern
-under a fifth of the time β€” a *perfect* expert placement, costing zero, would buy at most
-~19 %.
+> **Read that with the caveat below.** The run above generated ~750 tokens. Fresh runs at
+> the same `CTX` but **64 generated tokens** invert the ranking: `expert-matmul` 46 %,
+> attention 26 %. The attention share grows with the KV as the answer gets longer, so
+> "attention is 64 % of decode" is true of a long generation and misleading as a general
+> statement. Both numbers are reported here rather than one being deleted, because the
+> *dependence on generation length* is the finding.
+
+At 64 generated tokens, `CTX=32768`, best configuration (S3 below), 29.76 s total:
+
+| | | share |
+|---|---|---|
+| expert-matmul | 13.75 s | 46.2 % |
+| attention | 7.80 s | 26.2 % |
+| disk wait | 3.94 s | 13.3 % |
+| other | 4.26 s | 14.3 % |
+
+and with `PROF=1`, the breakdown that matters most:
+
+```
+P0-EXEC: routed CPU 10.967s / 19.67 GB/s (10158 row) | routed GPU critical 1.666s
+ | router 1.809s | residual P2P 0.000s / 0 hop | orchestration 2.449s
+```
+
+### The number that sets the ceiling on this host
+
+**The CPU-side routed expert path sustains 19.67 GB/s.** This host's 8-channel DDR4-2400
+sustains ~85 GB/s. The path therefore uses **23 % of available memory bandwidth**, which is
+the quantified form of the "4–5 cores of 24 busy" observation above.
+
+That single figure caps the machine, independently of everything else in this report:
+
+```
+expert weights touched per token = 8 experts Γ— 20.1 MB Γ— 75 layers = 12.1 GB
+of which non-resident (54.4 %) = 6.6 GB
+
+at 19.67 GB/s (measured) β†’ 333 ms/token β†’ 3.0 tok/s ← the ceiling today
+at 85 GB/s (DDR4 saturated) β†’ 77 ms/token β†’ 13.0 tok/s ← the hard ceiling
+```
+
+Everything else β€” placement, tiering, pinning, context, KV width β€” is bounded above by
+those two lines. Whether the 19.67 GB/s is a broken parallelisation or simply what 4–5
+cores can pull is an open question with a cheap answer (an `OMP_NUM_THREADS` sweep watching
+that same counter), and it is the single most valuable measurement still outstanding.
Two consequences worth stating plainly:
@@ -403,7 +442,69 @@ That re-test needs a copy-heavy prompt and, unlike this one, needs the acceptanc
logged. This run did not capture it (`acceptance: not reported` in all three conditions),
which is a defect of the harness, not of the engine.
-## 10. Build notes (Linux, CUDA)
+## 10. Two flags, and a hypothesis of mine that did not survive
+
+`COLI_CUDA_ATTN_SHARD` and `COLI_CUDA_PIPE_SHARD` had never been measured separately. A
+service carrying both ran at 1.70 tok/s while a one-shot run without them ran at 1.14 β€” a
+49 % gap I attributed to the flags, reasoning that a layer's attention tensors land on one
+device via the round-robin at `colibri.c:1691`, so one GPU works while three wait.
+
+Measured, four conditions, `.coli_usage` restored before each:
+
+| | tok/s | |
+|---|---|---|
+| S0 Β· neither | 1.97 | β€” |
+| S1 Β· `ATTN_SHARD` only | 2.05 | +4.1 % |
+| S2 Β· `PIPE_SHARD` only | 2.06 | +4.6 % |
+| **S3 Β· both** | **2.15** | **+9.1 %** |
+
+**+9 %, not +49 %.** Both flags are worth having and they compose, but they do not explain
+the gap I invoked them for. That gap was an artefact: the 1.14 run generated ~750 tokens
+(an `NGEN` that did not take effect β€” the engine ran to EOS) against 64 here, and attention
+grows with the KV. I was comparing two different generation lengths and calling the
+difference a flag.
+
+## 11. Determinism on 4 GPUs
+
+Six identical requests, `temperature 0`, production configuration:
+
+```
+6 runs -> 1 distinct output (338 bytes, md5 e86d393c506f, all six)
+```
+
+**Token-identical.** Cross-device FP reduction order does not drift on this host, which
+makes byte-for-byte comparison a usable acceptance test for changes to the CUDA path β€”
+relevant to #399, where the CUDA follow-up was to be gated on exactly such a check.
+
+## 12. Against llama.cpp, same model, same class of disk
+
+`unsloth/GLM-5.2-GGUF UD-IQ4_NL` (348 GB, 9 shards) on `nvme0n1`; colibri's container on
+`nvme1n1`. **Both are KINGSTON SNV2S1000G**, so there is no disk asymmetry. Same prompts,
+same wall-clock method, colibri stopped and the page cache dropped before each run.
+
+| | prefill | decode | VRAM |
+|---|---|---|---|
+| **llama.cpp** `-cmoe` (all experts in RAM) | **239 tok/s** | **1.58 tok/s** | **26 GB** |
+| **colibri** production config | 198 tok/s | 1.56 tok/s | 176 GB |
+
+**llama.cpp matches colibri's decode and beats its prefill by 20 %, using 26 GB of VRAM
+against 176.** And that is llama.cpp's *least* favourable configuration β€” `-cmoe` keeps
+every expert on the CPU and leaves the four GPUs almost entirely unused.
+
+This is not a like-for-like architectural comparison: colibri places individual experts and
+llama.cpp cannot, because GGUF fuses all 256 experts of a layer into one `ffn_*_exps`
+tensor. The point is narrower and harder to argue with β€” **on this host, the per-expert
+placement machinery is not currently buying anything over keeping the experts in RAM and
+letting the CPU read them.** Which is consistent with Β§5: the limiter is the 19.67 GB/s
+CPU-side read, and both engines are subject to it.
+
+Two configurations that would have let llama.cpp use its VRAM failed to load, for a
+reason worth recording: `-ncmoe 45` requested a **73 GB** buffer on a 48 GB card.
+llama.cpp splits by *layer count*, not by bytes, and MoE layers weigh ~4.6 GB against a few
+hundred MB for dense ones, so an even layer split is a wildly uneven byte split. Re-running
+with the cursor pulled back.
+
+## 13. Build notes (Linux, CUDA)
`nvcc` 12.6 + gcc 13 fails with `identifier "_Float32" is undefined`;
`-allow-unsupported-compiler` produces 100 errors. The `BUILD-cuda-glibc241.md` recipe works
@@ -418,7 +519,7 @@ make glm CUDA=1 CUDA_ARCH=sm_86 CUDA_HOME=~/cuda13
The web dashboard needs Node β‰₯ 20.12 (`styleText` from `node:util`); Ubuntu 24.04 ships
18.19, so `npm run build` fails on a stock install.
-## 11. Final configuration
+## 14. Final configuration
```sh
CTX=32768 # 131072 also fine: βˆ’23 % decode, prefill unchanged (Β§5)