okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

albedocmake: strata_kernels links strata_kernels_cpu (iq_kernels.cu reads the latent colscale table from expert_layout.cpp; strata-q36ref failed to link)a4af4df61

main
1 file

files

README.md2.9 KiB

Faster prompt reading (engine 0.1.13)

RTX 5070 12 GB, Ryzen 5 7600, 64 GB DDR5. 32K-token prompt (bench/prompts/long/32k-01-code-agent.ids), one-shot engine, --expert-cache auto, greedy. Numbers are prompt tokens/s.

What changed, step by step

StepWhatResult
BuffersThe attention half and the MoE half of a layer share one scratch region (~260 KB less per prompt token)bit-identical; chunk 4096 borrows 1.78 GiB instead of 2.84
PLE rowsThe next chunk's PLE rows are read from the model file on a thread while the GPU worksbit-identical; 762 -> 790 at chunk 4096
Chunk size--prefill auto: the largest of 8192 / 6144 / 4096 / ... whose buffers fit in the cache slots it may borrow; a request borrows only what its own prompt needsQ2_0: 4096 791, 6144 878, 8192 973
Host copiesExperts the arena could not pin are copied to pinned buffers by helper threads instead of the launching threadbit-identical; IQ3_S at 4096: 551 -> 652
PLE blockComputed for the whole chunk (two GEMMs) instead of token by tokenQ2_0 981 -> 1053, IQ3_S 831 -> 940
Expertsllama.cpp's MMQ kernels (weights stay quantized, int8 tensor cores) instead of dequantize-to-FP16 + cuBLASQ2_0 1052 -> 1130, IQ3_S (8192) 932 -> 1014
StreamingAt chunks of 2048+ every non-resident expert streams in a fixed order through a ring, so the next layer's arrive while the current layer's attention runsbit-identical; Q2_0 1130 -> 1290, IQ3_S -> 1208

Tried and dropped: cuBLAS grouped GEMMs for the experts (faster in isolation, slower inside the engine: 770 vs 790).

Before and after

engine 0.1.12 (--prefill 2048)engine 0.1.13 (--prefill auto)
Q2_0, 32K prompt5721,290
IQ3_S, 32K prompt3831,208
Server, Q2_0, 128K context, 999-token prompt353438
Server, 6,927-token prompt5291,077
Server, 28,584-token prompt5841,249

Output speed is unchanged (the decode path is the same). Short prompts (a few hundred tokens) go through the verify windows as before.

Quality

Against the 8192-chunk FP16 pathSame top-1Mean KLPerplexity (reference 9.21)
Chunk 6144, same code (the yardstick)89.8%0.339.18
MMQ experts85.9%0.388.63