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): correct the V4.1 expert-read record for the regime it ran in

Gawr Gura 0721e761776f28a3
diff --git a/docs/deepseek-v41.md b/docs/deepseek-v41.md
index acaf11ee..235e7640 100644
--- a/docs/deepseek-v41.md
+++ b/docs/deepseek-v41.md
@@ -226,11 +226,40 @@ mirror: a mirror directory may copy any subset of the split's shards.
The two mechanisms answer different questions. `COLI_MODEL_DIRS` asks whether the
bytes can be *stored* across drives; `COLI_MODEL_MIRROR` asks whether they can be
-*read* from more than one place at once. On a host whose decode is not bound by the
-device -- which is what a many-core CPU makes of this engine -- the second one buys
-very little, and the measurement is in
+*read* from more than one place at once. With the CPU side in order -- the OpenMP team
+sized, which `c/coli` already does at launch -- the second one is worth a fifth of the
+expert disk phase and the engine reaches the device's own ceiling; the measurements,
+and the regime in which neither is worth anything, are in
[the experiment record](experiments/dsv41-expert-io-2026-09-14.md).
+### The cheapest resident tier there is
+
+The expert cache has a floor that no cache size can move: a turn's *first* touch of
+each expert it routes. On the released checkpoint a 16-token turn touches 3,371
+distinct experts, and a cache of about 96 slots per layer already sees no capacity
+misses at all -- every miss left is a first read, and only having the bytes resident
+*before the turn starts* removes it.
+
+The engine cannot ask for that, but a filesystem can. Point a partial mirror at RAM:
+
+```sh
+# the 46 non-engram shards carry every routed expert and the dense weights
+mkdir -p /dev/shm/dsv41_ram
+cd <container> && ls model-*.safetensors | grep -v -E -- '-0004[78]-' \
+ | xargs cp -t /dev/shm/dsv41_ram/
+
+COLI_MODEL_MIRROR=/dev/shm/dsv41_ram COLI_DISK_WEIGHTS=1,1000 \
+ SNAP=<container> ./c/deepseek_v41 8 ref.json
+```
+
+Measured on the released checkpoint, 16-token turn, cold cache, `cap=8`: expert disk
+16.05 s -> **4.15 s** (6.19 -> 23.89 GB/s) and the turn 37.3 s -> **25.5 s**, -31.7%,
+token-exact. That is more than a cache four times its size buys -- `cap=384`, which
+holds all 289 GB of experts, still reads 63 GB and spends 11.3 s on disk -- because
+caching during a turn cannot remove a first read and residency before it can. It costs
+287 GiB of RAM for the duration, which is the whole trade; 1,000 is not magic, any
+weight that sends nearly every expert to the RAM copy will do.
+
That needs the destination and the file offset to be block-aligned, and a safetensors
range starts wherever the writer put it. The obvious fix is to bounce each transfer
through an aligned scratch buffer, and it is the wrong one here: an extra copy of every
diff --git a/docs/experiments/dsv41-direct.json b/docs/experiments/dsv41-direct.json
index 24222f46..f69841fc 100644
--- a/docs/experiments/dsv41-direct.json
+++ b/docs/experiments/dsv41-direct.json
@@ -1,17 +1,17 @@
{
- "commit": "5df0e3590dadfe49569518016900c0e178ed1619",
- "model": "deepseek-ai/DeepSeek-V4.1-Flash, released checkpoint, 48 shards 510.3 GB, fp8 dense + fp4 experts, no conversion",
- "command": "SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash [ENV] ./deepseek_v41 8 /tmp/ref.json (25 prompt tokens, 16 generated, cap=8, page cache evicted per run)",
+ "version": 1,
+ "commit": "8eb197e5900e3a30c0ec2e979c48016da6c7ed7e",
+ "model": "deepseek-ai/DeepSeek-V4.1-Flash, released checkpoint, 48 shards, 510.3 GB, fp8 dense + fp4 experts, no conversion",
+ "command": "OMP_NUM_THREADS=32 SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash [ENV] ./deepseek_v41 8 /tmp/ref.json (25 prompt tokens, 16 generated, cap=8, page cache evicted per run, arms interleaved, 3 runs each)",
"prompt_hash": "79a5bcf37f1920a530cfee5ab7a484e00a1d6bb7f19d9a7418beaa53c14b454b",
"hardware": {
- "cpu": "2x Intel Xeon Platinum 8555C, 52 cores/socket, 2 threads/core, 208 CPUs, 4 NUMA nodes",
+ "cpu": "2x Intel Xeon Platinum 8555C, 52 cores/socket, 2 threads/core = 104 physical cores, 208 logical CPUs, 4 NUMA nodes",
"ram": "1007 GiB",
- "storage": "nvme0n1 Samsung MZQL2960HCJR 894 GB ext4 noatime (/mnt/nvme0); md0 = RAID0 of 2x Samsung MZQLB7T6HMLA 7.6 TB ext4 (/mdr5); independent controllers",
+ "storage": "A: Samsung MZQL2960HCJR (nvme0n1, 894 GB) ext4 noatime, /mnt/nvme0. B: 2x Samsung MZQLB7T6HMLA (7.6 TB) in RAID0 (md0) ext4, /mdr5. A and B are independent controllers.",
"os": "Ubuntu 24.04, kernel 6.8.0-31-generic, gcc 13.3.0, -O3 -march=native -fopenmp"
},
"warmup_runs": 0,
- "version": 1,
- "hypothesis": "Reading the routed experts with O_DIRECT instead of through the page cache raises the expert read rate, because the engine already fadvise(DONTNEED)s each expert after reading it and a buffered read therefore copies the bytes twice and keeps nothing.",
+ "hypothesis": "Reading the routed experts with O_DIRECT instead of through the page cache raises the expert read rate and, with the CPU side in order, the decode rate.",
"changed_variables": [
"V41_DIRECT"
],
@@ -21,19 +21,19 @@
},
"samples": {
"tok_s": [
- 0.038093,
- 0.038321,
- 0.03828
+ 0.303721,
+ 0.291333,
+ 0.332364
]
},
- "median_tok_s": 0.03828,
+ "median_tok_s": 0.303721,
"quality": {
- "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included",
+ "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. All runs 16/16, in both regimes. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included, with the engine's OpenMP team set to 32 threads (OMP_NUM_THREADS=32) so the CPU side is not the bottleneck -- see PR #1517 for why that matters",
"passed": true
},
"evidence": {
- "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section 'D0' (3 runs, the engine's own stderr)",
- "sha256": "d5ed80386c99d1cac9c98a0318e4543dbffd7aac3656c2f1fcd78bbc2d05f8cf"
+ "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section '32-D0'",
+ "sha256": "0ff930c3e7e70534a9e1535573115c8406e21ff2bf070e021c43ac2a3a754221"
}
},
"trial": {
@@ -42,19 +42,19 @@
},
"samples": {
"tok_s": [
- 0.038763,
- 0.039144,
- 0.039252
+ 0.436205,
+ 0.427122,
+ 0.429646
]
},
- "median_tok_s": 0.039144,
+ "median_tok_s": 0.429646,
"quality": {
- "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included",
+ "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. All runs 16/16, in both regimes. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included, with the engine's OpenMP team set to 32 threads (OMP_NUM_THREADS=32) so the CPU side is not the bottleneck -- see PR #1517 for why that matters",
"passed": true
},
"evidence": {
- "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section 'P' (3 runs, the engine's own stderr)",
- "sha256": "d14c7edbb19b55840c8967eb51e3abd9e683a22f7676ea0cabb9f263b4b238d5"
+ "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section '32-P'",
+ "sha256": "a60703d6842a7667d1fe59438cf3d3e3a1ca381c598e4cc6c80673ed5b651687"
}
},
"outcome": "improvement"
diff --git a/docs/experiments/dsv41-expert-io-2026-09-14-raw.txt b/docs/experiments/dsv41-expert-io-2026-09-14-raw.txt
index 6bbe7cc4..42950f76 100644
--- a/docs/experiments/dsv41-expert-io-2026-09-14-raw.txt
+++ b/docs/experiments/dsv41-expert-io-2026-09-14-raw.txt
@@ -1,101 +1,201 @@
-Raw per-run engine stderr, filtered to the lines this experiment
-rests on (phase breakdown, mirror split, token verdict). The arms
-interleave P / M3 / D0 / M2; MP was run separately against the same
-reference. Full logs are attached to the PR.
-
---- P run 1/3 (ab_final_P_0.err) ---
+Raw per-run engine stderr for the V4.1 expert-read experiment, filtered to
+the lines it rests on. Arms: P one NVMe, M3 mirror across two filesystems,
+M2 mirror with both copies behind one RAID0 filesystem, D0 buffered reads.
+Two regimes: the engine's default team at the time (208 logical CPUs), and
+OMP_NUM_THREADS=32, which is the CPU side in order. The second regime is the
+one the conclusions rest on; the first is kept because it is what made them
+look the other way. The device sweep is c/iobench and is in the record.
+
+--- shipped-at-the-time default, 208 logical threads: P (one NVMe) ---
+[ab_final_P_0.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 144.55s | decode 16 in 254.02s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.44s, expert matmul 190.64s, attention 111.50s, engram 0.79s
---- P run 2/3 (ab_final_P_1.err) ---
+[ab_final_P_1.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 142.95s | decode 16 in 251.48s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.29s, expert matmul 188.98s, attention 109.95s, engram 0.80s
---- P run 3/3 (ab_final_P_2.err) ---
+[ab_final_P_2.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 143.33s | decode 16 in 249.85s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.27s, expert matmul 186.93s, attention 110.52s, engram 0.80s
---- M3 run 1/3 (ab_final_M3_0.err) ---
+--- 208 threads: M3 (mirror across two filesystems) ---
+[ab_final_M3_0.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
Matching tokens: 16/16
[v41] prefill 25 tokens in 144.35s | decode 16 in 249.62s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 17.00s, expert matmul 189.02s, attention 111.48s, engram 0.77s
MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
---- M3 run 2/3 (ab_final_M3_1.err) ---
+[ab_final_M3_1.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
Matching tokens: 16/16
[v41] prefill 25 tokens in 141.86s | decode 16 in 249.04s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 17.05s, expert matmul 187.93s, attention 110.64s, engram 0.78s
MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
---- M3 run 3/3 (ab_final_M3_2.err) ---
+[ab_final_M3_2.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
Matching tokens: 16/16
[v41] prefill 25 tokens in 140.41s | decode 16 in 249.46s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 17.10s, expert matmul 188.06s, attention 109.57s, engram 0.78s
MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
---- D0 run 1/3 (ab_final_D0_0.err) ---
+--- 208 threads: D0 (buffered reads) ---
+[ab_final_D0_0.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 150.03s | decode 16 in 255.97s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 32.10s, expert matmul 187.96s, attention 110.64s, engram 0.78s
---- D0 run 2/3 (ab_final_D0_1.err) ---
+[ab_final_D0_1.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 149.51s | decode 16 in 253.58s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 31.06s, expert matmul 187.69s, attention 110.64s, engram 0.78s
---- D0 run 3/3 (ab_final_D0_2.err) ---
+[ab_final_D0_2.err]
Matching tokens: 16/16
[v41] prefill 25 tokens in 149.59s | decode 16 in 254.36s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 32.29s, expert matmul 187.38s, attention 109.66s, engram 0.77s
---- M2 run 1/3 (ab_final_M2_0.err) ---
+--- 208 threads: M2 (both copies behind the md0 RAID0) ---
+[ab_final_M2_0.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
Matching tokens: 16/16
[v41] prefill 25 tokens in 144.41s | decode 16 in 252.77s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.51s, expert matmul 189.21s, attention 111.54s, engram 0.79s
MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
---- M2 run 2/3 (ab_final_M2_1.err) ---
+[ab_final_M2_1.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
Matching tokens: 16/16
[v41] prefill 25 tokens in 143.50s | decode 16 in 249.89s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.53s, expert matmul 187.37s, attention 110.39s, engram 0.79s
MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
---- M2 run 3/3 (ab_final_M2_2.err) ---
+[ab_final_M2_2.err]
[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
Matching tokens: 16/16
[v41] prefill 25 tokens in 141.53s | decode 16 in 250.51s (0.06 tok/s)
[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 20.50s, expert matmul 186.65s, attention 109.90s, engram 0.81s
MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
---- MP run 1/3 (ab_mp_MP_0.err) ---
-[MIRROR] probe: primary 4.38 GB/s | mirror 4.65 GB/s
+--- OMP_NUM_THREADS=32: P (one NVMe) ---
+[ab_ab32_P_0.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 10.45s | decode 16 in 13.06s (1.23 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 15.95s, expert matmul 3.14s, attention 1.83s, engram 0.32s
+
+[ab_ab32_P_1.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.32s | decode 16 in 12.86s (1.24 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.09s, expert matmul 3.54s, attention 2.03s, engram 0.34s
+
+[ab_ab32_P_2.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.32s | decode 16 in 12.85s (1.25 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.07s, expert matmul 3.56s, attention 2.01s, engram 0.34s
+
+--- OMP_NUM_THREADS=32: M3 (mirror across two filesystems) ---
+[ab_ab32_M3_0.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 9.04s | decode 16 in 11.36s (1.41 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 12.55s, expert matmul 3.23s, attention 1.92s, engram 0.32s
+MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
+
+[ab_ab32_M3_1.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 9.88s | decode 16 in 10.96s (1.46 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 12.66s, expert matmul 3.59s, attention 2.04s, engram 0.35s
+MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
+
+[ab_ab32_M3_2.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 50% mirror 50%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 9.91s | decode 16 in 11.00s (1.45 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 12.76s, expert matmul 3.60s, attention 2.03s, engram 0.35s
+MIRROR: primary 49.20 GB (15702 reads) | mirror1 49.95 GB (15942 reads) β€” 50% of expert bytes from the mirrors
+
+--- OMP_NUM_THREADS=32: D0 (buffered reads) ---
+[ab_ab32_D0_0.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 18.18s | decode 16 in 21.01s (0.76 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 31.14s, expert matmul 3.34s, attention 2.14s, engram 0.33s
+
+[ab_ab32_D0_1.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 18.77s | decode 16 in 22.76s (0.70 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 32.61s, expert matmul 3.69s, attention 2.47s, engram 0.37s
+
+[ab_ab32_D0_2.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 16.79s | decode 16 in 18.16s (0.88 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 26.28s, expert matmul 3.68s, attention 2.32s, engram 0.35s
+
+--- OMP_NUM_THREADS=32: M2 (both copies behind the md0 RAID0) ---
+[ab_ab32_M2_0.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.46s | decode 16 in 12.99s (1.23 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.36s, expert matmul 3.57s, attention 2.01s, engram 0.34s
+MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
+
+[ab_ab32_M2_1.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.46s | decode 16 in 12.96s (1.23 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.38s, expert matmul 3.54s, attention 2.00s, engram 0.34s
+MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
+
+[ab_ab32_M2_2.err]
+[MIRROR] 2 replicas, split COLI_DISK_WEIGHTS: primary 0% mirror 100%
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.40s | decode 16 in 12.91s (1.24 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.32s, expert matmul 3.50s, attention 2.00s, engram 0.34s
+MIRROR: primary 0.32 GB (102 reads) | mirror1 98.83 GB (31542 reads) β€” 100% of expert bytes from the mirrors
+
+--- OMP_NUM_THREADS=32: P0 (split ratio set, no mirror registered: the ratio is inert, so this differs from M3 in exactly COLI_MODEL_MIRROR) ---
+[ab_p032_P0_0.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 10.49s | decode 16 in 13.76s (1.16 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.05s, expert matmul 3.28s, attention 2.15s, engram 0.34s
+
+[ab_p032_P0_1.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.57s | decode 16 in 14.05s (1.14 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.46s, expert matmul 3.87s, attention 2.46s, engram 0.36s
+
+[ab_p032_P0_2.err]
+Matching tokens: 16/16
+[v41] prefill 25 tokens in 11.55s | decode 16 in 12.85s (1.25 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 16.10s, expert matmul 3.50s, attention 2.11s, engram 0.34s
+
+--- OMP_NUM_THREADS=32: MP (mirror registered, split left to the startup probe) ---
+[ab_mp32_MP_0.err]
+[MIRROR] probe: primary 5.38 GB/s | mirror 5.90 GB/s
[MIRROR] 2 replicas, split measured: primary 48% mirror 52%
Matching tokens: 16/16
-[v41] prefill 25 tokens in 140.86s | decode 16 in 247.87s (0.06 tok/s)
-[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 18.87s, expert matmul 188.76s, attention 107.82s, engram 0.79s
-MIRROR: primary 47.94 GB (15300 reads) | mirror1 51.21 GB (16344 reads) β€” 52% of expert bytes from the mirrors
+[v41] prefill 25 tokens in 10.01s | decode 16 in 11.21s (1.43 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 12.81s, expert matmul 3.53s, attention 2.15s, engram 0.34s
+MIRROR: primary 47.15 GB (15048 reads) | mirror1 52.00 GB (16596 reads) β€” 52% of expert bytes from the mirrors
---- MP run 2/3 (ab_mp_MP_1.err) ---
-[MIRROR] probe: primary 3.98 GB/s | mirror 4.75 GB/s
-[MIRROR] 2 replicas, split measured: primary 46% mirror 54%
+[ab_mp32_MP_1.err]
+[MIRROR] probe: primary 5.70 GB/s | mirror 6.19 GB/s
+[MIRROR] 2 replicas, split measured: primary 48% mirror 52%
Matching tokens: 16/16
-[v41] prefill 25 tokens in 140.77s | decode 16 in 248.17s (0.06 tok/s)
-[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 18.83s, expert matmul 188.86s, attention 107.98s, engram 0.78s
-MIRROR: primary 45.55 GB (14538 reads) | mirror1 53.60 GB (17106 reads) β€” 54% of expert bytes from the mirrors
+[v41] prefill 25 tokens in 10.07s | decode 16 in 12.19s (1.31 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 13.44s, expert matmul 3.73s, attention 2.30s, engram 0.35s
+MIRROR: primary 47.51 GB (15162 reads) | mirror1 51.65 GB (16482 reads) β€” 52% of expert bytes from the mirrors
---- MP run 3/3 (ab_mp_MP_2.err) ---
-[MIRROR] probe: primary 3.92 GB/s | mirror 5.01 GB/s
-[MIRROR] 2 replicas, split measured: primary 44% mirror 56%
+[ab_mp32_MP_2.err]
+[MIRROR] probe: primary 5.37 GB/s | mirror 5.63 GB/s
+[MIRROR] 2 replicas, split measured: primary 49% mirror 51%
Matching tokens: 16/16
-[v41] prefill 25 tokens in 140.28s | decode 16 in 245.26s (0.07 tok/s)
-[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 17.14s, expert matmul 185.97s, attention 108.36s, engram 0.80s
-MIRROR: primary 44.07 GB (14064 reads) | mirror1 55.09 GB (17580 reads) β€” 56% of expert bytes from the mirrors
+[v41] prefill 25 tokens in 10.10s | decode 16 in 13.27s (1.21 tok/s)
+[v41] experts: 4956 hits, 5274 misses, 99154.6 MB read | disk 13.72s, expert matmul 3.89s, attention 2.73s, engram 0.39s
+MIRROR: primary 48.17 GB (15372 reads) | mirror1 50.99 GB (16272 reads) β€” 51% of expert bytes from the mirrors
diff --git a/docs/experiments/dsv41-expert-io-2026-09-14.md b/docs/experiments/dsv41-expert-io-2026-09-14.md
index e4b7cdd8..6e4fcd5d 100644
--- a/docs/experiments/dsv41-expert-io-2026-09-14.md
+++ b/docs/experiments/dsv41-expert-io-2026-09-14.md
@@ -5,12 +5,32 @@ Two changes to the V4.1 engine are measured here: reading the routed experts wit
drive. Both are about the same fact -- an expert is read once and never wanted again --
and both are ports of mechanisms the V4 and GLM engines already had.
-The short version, and the reason this record exists even though the mechanism ports
-were straightforward: **on this host the engine is not bound by the device.** Disk is
-5% of the turn. `O_DIRECT` takes a third off that 5% and the multi-drive split takes
-a sixth, and after both the turn is **2.3% and 1.4%** shorter respectively. The expert
-matmul and the attention are the other 74%. Any I/O proposal for this engine has to be
-read against that ratio.
+> ## Correction, 2026-09-15: the A/B below ran in the wrong regime
+>
+> Everything in this record was first measured with the engine's default OpenMP
+> team, which on this host is one thread per logical CPU (208). That configuration
+> is pathological for an engine whose per-region work is a few thousand rows:
+> **93% of cycles land inside libgomp**, and the turn takes 409.9 s instead of
+> 43.5 s. See `dsv41-omp-team-2026-09-15.md` and PR #1517.
+>
+> Measured with the team sized (`OMP_NUM_THREADS=32`), the same `O_DIRECT` change
+> is not worth 2.3% -- it is worth **-52% of the disk phase and +63% of decode
+> throughput**, and the disk phase is then 16.0 s of a ~34 s turn rather than 5% of
+> it. Section ["The same A/B with the team
+> sized"](#the-same-ab-with-the-team-sized) has those numbers.
+>
+> The 208-thread numbers are kept because they are real measurements of a real
+> configuration, and because the ratio they produce is exactly the trap: the phase
+> breakdown looks entirely reasonable either way. But the conclusion they were used
+> for -- that I/O cannot matter for this engine -- was wrong, and the device
+> characterisation below is the part that survives unchanged.
+
+The short version, with the correction folded in: **the value of this work depends
+entirely on whether the CPU side has been put in order first.** With the shipped
+thread count the disk is 5% of the turn and neither change is worth 2.5%; with the
+team sized the engine reaches the device's own ceiling and the same changes are worth
+tens of percent. That is not a contradiction, it is a precondition, and it is the
+reason this record now leads with a correction rather than a table.
## Machine
@@ -21,7 +41,7 @@ read against that ratio.
| Storage A | Samsung MZQL2960HCJR (`nvme0n1`, 894 GB), ext4, `noatime`, mounted `/mnt/nvme0` |
| Storage B | 2x Samsung MZQLB7T6HMLA (`nvme1n1`, `nvme3n1`, 7.6 TB each) in RAID0 (`md0`), ext4, `/mdr5` |
| Storage C | yrfs network filesystem (`/ky200t`) -- staging only, never measured |
-| commit | `5df0e35` (`feat/dsv41-expert-io`, based on `dev` at `1efb7c8`) |
+| commit | `8eb197e5` (`feat/dsv41-expert-io`, rebased onto `dev` at `f4aff21`) |
| OS / toolchain | Ubuntu 24.04, kernel 6.8.0-31-generic, gcc 13.3.0, `-O3 -march=native -fopenmp` |
A and B are independent controllers, which is what the two-drive question needs. B is
@@ -144,6 +164,48 @@ bytes; the difference is what backs them. `M2`'s two drives are a RAID0 pair beh
one `md0` device, and serving all reads from it is no faster than one `nvme0n1`.
Adding a second *filesystem* to read from is what helped.
+## The same A/B with the team sized
+
+The arms above were re-run with `OMP_NUM_THREADS=32` -- the team size that puts the CPU
+side in order, now the shipped behaviour via PR #1517. Same container, same 25-token
+prompt, same 16 reference ids, cold cache, arms interleaved, 3 runs each, and again
+**every run token-exact 16/16**.
+
+| arm | expert disk | rate | whole turn | decode | vs `P` |
+|---|---:|---:|---:|---:|---:|
+| `P` one NVMe | 16.07 s | 6.17 GB/s | 37.2 s | 12.86 s | -- |
+| `P0` split ratio set, no mirror (inert) | 16.10 s | 6.16 GB/s | 38.1 s | 13.0 s | +2% |
+| `M3` mirror, second controller | **12.66 s** | **7.83 GB/s** | **34.0 s** | **11.00 s** | disk -21%, decode +17% |
+| `MP` mirror, startup probe picks the split | 13.44 s | 7.38 GB/s | 36.3 s | 12.19 s | disk -16%, decode +5% |
+| `M2` mirror, both copies behind one RAID0 | 16.36 s | 6.06 GB/s | 37.9 s | 12.96 s | +2%, i.e. nothing |
+| `D0` buffered reads | 31.14 s | 3.18 GB/s | 52.7 s | 21.01 s | disk +94%, decode -39% |
+
+Per-run disk times: `P` 15.95 / 16.09 / 16.07 s, `M3` 12.55 / 12.66 / 12.76 s,
+`M2` 16.36 / 16.38 / 16.32 s, `MP` 12.81 / 13.44 / 13.72 s,
+`D0` 31.14 / 32.61 / 26.28 s (the last `D0` run is an outlier; the median is used
+throughout). `P0` exists so the mirror can be compared as one variable: it sets the
+same `COLI_DISK_WEIGHTS=1,1` as `M3` with no mirror registered, where the ratio is
+inert, so `P0` and `M3` differ in exactly `COLI_MODEL_MIRROR`.
+
+Everything the earlier section said changes. `O_DIRECT` is worth **-48% of the disk
+phase and +63% of the decode rate**; the split is worth **-21% and +17%**; and **the
+engine now reaches the device's own ceiling** -- 6.17 GB/s against the 6.34 GB/s
+`iobench` measures one `nvme0n1` at depth 4, which is what the corrected phase
+breakdown means: the disk is 16.1 s of a 37.2 s turn, not 5% of it.
+
+`M3` clearing that ceiling at 7.83 GB/s is the other half of the result: 7.83 is above
+what one device can deliver, so the split is genuinely using two. And it is still
+**two filesystems on independent controllers** that matter, not two drives -- `M2`
+serves every byte from the `md0` RAID0 pair and is indistinguishable from one NVMe.
+The mechanism the 208-thread section inferred is confirmed here with the CPU side out
+of the way, which is the only reason the 208-thread numbers could not show it.
+
+The probe arm (`MP`) lands between the two: it picks a split that drifts a few percent
+run to run (52/52/51% of bytes to the mirror, disk 12.81 / 13.44 / 13.72 s) and gets
+part of the pinned split's benefit with more variance. On a pair of drives that are
+actually equal, pinning `1,1` is the better move -- the docs already recommend that
+without saying why, and the 208-thread runs said the opposite for the wrong reason.
+
## Why: the device was never the limit
`c/iobench`, 5.6 MB blocks (one weight matrix), O_DIRECT, caches evicted, one thread
@@ -175,11 +237,13 @@ was measured on a different device.
## What this does not show
-- **Not a refutation of hypothesis #2.** It is a boundary condition. The docs'
- measurement of this engine is on a host where disk (10.4 s) exceeds matmul (7.6 s);
- there, halving the disk time is worth far more than it is here. The claim this
- record supports is narrower and checkable: *when the host has enough cores that
- compute dominates, independent device bandwidth cannot turn into decode speed.*
+- **It confirms hypothesis #2, and it shows what the hypothesis was missing.** The
+ README's premise -- that independent drives can turn into decode speed -- holds here
+ (7.83 GB/s against a 6.34 GB/s single-device ceiling, -21% series, +17% decode), but
+ *only* once the CPU side is not the bottleneck. The original phrasing is a
+ conditional that reads like an unconditional, and the condition is cheap to state
+ and easy to get wrong: it is not enough that the host has several drives, the engine
+ has to be able to need them.
- **Not a claim about `O_DIRECT` in general.** The project already documents it as
drive-dependent (QLC/DRAM-less drives behave differently). One device class was
measured.
@@ -213,6 +277,14 @@ The container was then checked against the upstream file manifest, size for size
container a second time on an independent controller -- 510 GB duplicated for the
duration of the runs, which is precisely the cost `COLI_MODEL_DIRS` exists to avoid.
+Two thread configurations are reported. The first set of runs used the engine's
+default team (208 logical CPUs) because that is what shipped at the time; the second
+set sets `OMP_NUM_THREADS=32`, which is what the CPU side needs on this host and what
+PR #1517 now does by default (it lands on 104 physical cores; 32 is faster still here
+and is why the override is the documented escape hatch). **The two sets disagree, and
+the second one is the one to use** -- the first is kept because the disagreement is
+the finding.
+
One turn, one arm:
```sh
@@ -220,6 +292,9 @@ make -C c deepseek_v41
SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash ./c/deepseek_v41 8 ref.json
SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash COLI_MODEL_MIRROR=<copy> COLI_DISK_WEIGHTS=1,1 \
./c/deepseek_v41 8 ref.json
+# and with the CPU side in order:
+OMP_NUM_THREADS=32 SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash COLI_MODEL_MIRROR=<copy> \
+ COLI_DISK_WEIGHTS=1,1 ./c/deepseek_v41 8 ref.json
```
`ref.json` carries 25 prompt ids and the 16 reference ids; the engine prints the
diff --git a/docs/experiments/dsv41-mirror.json b/docs/experiments/dsv41-mirror.json
index f657b5e8..9f232a7b 100644
--- a/docs/experiments/dsv41-mirror.json
+++ b/docs/experiments/dsv41-mirror.json
@@ -1,58 +1,61 @@
{
- "commit": "5df0e3590dadfe49569518016900c0e178ed1619",
- "model": "deepseek-ai/DeepSeek-V4.1-Flash, released checkpoint, 48 shards 510.3 GB, fp8 dense + fp4 experts, no conversion",
- "command": "SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash [ENV] ./deepseek_v41 8 /tmp/ref.json (25 prompt tokens, 16 generated, cap=8, page cache evicted per run)",
+ "version": 1,
+ "commit": "8eb197e5900e3a30c0ec2e979c48016da6c7ed7e",
+ "model": "deepseek-ai/DeepSeek-V4.1-Flash, released checkpoint, 48 shards, 510.3 GB, fp8 dense + fp4 experts, no conversion",
+ "command": "OMP_NUM_THREADS=32 SNAP=/mnt/nvme0/DeepSeek-V4.1-Flash [ENV] ./deepseek_v41 8 /tmp/ref.json (25 prompt tokens, 16 generated, cap=8, page cache evicted per run, arms interleaved, 3 runs each)",
"prompt_hash": "79a5bcf37f1920a530cfee5ab7a484e00a1d6bb7f19d9a7418beaa53c14b454b",
"hardware": {
- "cpu": "2x Intel Xeon Platinum 8555C, 52 cores/socket, 2 threads/core, 208 CPUs, 4 NUMA nodes",
+ "cpu": "2x Intel Xeon Platinum 8555C, 52 cores/socket, 2 threads/core = 104 physical cores, 208 logical CPUs, 4 NUMA nodes",
"ram": "1007 GiB",
- "storage": "nvme0n1 Samsung MZQL2960HCJR 894 GB ext4 noatime (/mnt/nvme0); md0 = RAID0 of 2x Samsung MZQLB7T6HMLA 7.6 TB ext4 (/mdr5); independent controllers",
+ "storage": "A: Samsung MZQL2960HCJR (nvme0n1, 894 GB) ext4 noatime, /mnt/nvme0. B: 2x Samsung MZQLB7T6HMLA (7.6 TB) in RAID0 (md0) ext4, /mdr5. A and B are independent controllers.",
"os": "Ubuntu 24.04, kernel 6.8.0-31-generic, gcc 13.3.0, -O3 -march=native -fopenmp"
},
"warmup_runs": 0,
- "version": 1,
- "hypothesis": "Serving the routed experts from a byte-identical copy on an independent controller as well as the primary raises the expert read rate. The split ratio is left to the engine's startup bandwidth probe in both arms, so the only changed key is the mirror itself.",
+ "hypothesis": "Serving the routed experts from a byte-identical copy on an independent controller raises the expert read rate above what one device can deliver.",
"changed_variables": [
"COLI_MODEL_MIRROR"
],
"baseline": {
- "config": {},
+ "config": {
+ "COLI_DISK_WEIGHTS": "1,1"
+ },
"samples": {
"tok_s": [
- 0.038763,
- 0.039144,
- 0.039252
+ 0.422498,
+ 0.402111,
+ 0.419507
]
},
- "median_tok_s": 0.039144,
+ "median_tok_s": 0.419507,
"quality": {
- "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included",
+ "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. All runs 16/16, in both regimes. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included, with the engine's OpenMP team set to 32 threads (OMP_NUM_THREADS=32) so the CPU side is not the bottleneck -- see PR #1517 for why that matters",
"passed": true
},
"evidence": {
- "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section 'P' (3 runs, the engine's own stderr)",
- "sha256": "d14c7edbb19b55840c8967eb51e3abd9e683a22f7676ea0cabb9f263b4b238d5"
+ "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section '32-P0'",
+ "sha256": "e0559d2a8ffb7a5cecfa4371264d86a5fb1d1160a8da8661912db266b2fd42fb"
}
},
"trial": {
"config": {
- "COLI_MODEL_MIRROR": "<dir holding a byte-identical copy>"
+ "COLI_MODEL_MIRROR": "<second byte-identical copy>",
+ "COLI_DISK_WEIGHTS": "1,1"
},
"samples": {
"tok_s": [
- 0.039696,
- 0.039692,
- 0.039938
+ 0.473934,
+ 0.470865,
+ 0.469346
]
},
- "median_tok_s": 0.039696,
+ "median_tok_s": 0.470865,
"quality": {
- "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included",
+ "method": "token-exact vs a 16-token reference stream; the engine exits non-zero on any mismatch. All runs 16/16, in both regimes. tok_s is 16 generated tokens over the whole turn (READY to DONE), prefill included, with the engine's OpenMP team set to 32 threads (OMP_NUM_THREADS=32) so the CPU side is not the bottleneck -- see PR #1517 for why that matters",
"passed": true
},
"evidence": {
- "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section 'MP' (3 runs, the engine's own stderr)",
- "sha256": "c2e1931e7dff2531a38de623a5adebdc1a7ec78bc2f4222246272864d655e7e4"
+ "uri": "docs/experiments/dsv41-expert-io-2026-09-14-raw.txt, section '32-M3'",
+ "sha256": "682ab4b1b9175f502a96b7e4b8007f4bd00b84fed873e383be74e115b20f5506"
}
},
"outcome": "improvement"