A 2.78-trillion-parameter Kimi K3 running inference on a single CPU in 8.24 GB of RAM. Portable C99: no BLAS, no framework, no GPU.
C avx2c99cpu-inferencedeep-learningfrom-scratchinference-enginekimi-k3linear-attentionllmllm-inferencemachine-learningmemory-efficientmixture-of-expertsmoemxfp4quantizationsimdsystems-programmingtransformerzero-dependencies
flowchart LR
R["16 expert ids<br/>from the router"] --> P1["phase 1<br/>reserve slots serially"]
P1 --> P2["phase 2<br/>pread in disk order"]
P2 --> P3["phase 3<br/>publish what arrived"]
P3 --> USE["matmul straight<br/>from the nibbles"]
P2 -.->|"queue depth 16,<br/>not 1"| DEV["the device<br/>stays busy"]
style R fill:#E4ECF3,stroke:#5C7C9B,color:#3B372F
style P1 fill:#F2E9D4,stroke:#C0913E,color:#3B372F
style P2 fill:#F4E7D3,stroke:#C07A42,color:#3B372F
style P3 fill:#E7ECDD,stroke:#6E9160,color:#3B372F
style USE fill:#DDEBE7,stroke:#4E8E86,color:#3B372F
style DEV fill:#ECE8E0,stroke:#8C8477,color:#3B372F