Community implementation: native DeepSeek-V4-Flash-0731 inference in pure C on CPU

#66
by shyringo - opened

I maintain an Apache-2.0 community CPU runtime for DeepSeek-V4-Flash-0731:

https://github.com/shyringo/deepseek-v4-flash-0731-in-c

It runs the native checkpoint directly with C99 and OpenMP, without a GPU, CUDA, PyTorch, or weight conversion. Cold MoE experts stream from NVMe while active experts, hot weights, caches, and working state use RAM.

The full checkpoint is about 166.9 GB on disk. The 8 GB figure is the minimum runnable system-RAM plan, not a claim that all weights fit in memory. The reference measurements used an 18 GiB inference plan on Windows 11 + WSL2 with an Intel Core i5-1340P, 31.65 GiB installed RAM, and a Samsung NVMe SSD:

  • Ordinary open-ended generation: 20.203 s TTFT and 1.705 s/token TPOT (0.59 token/s).
  • Best measured prompt-lookup case with a reusable continuation: 26.748 s TTFT and 0.892 s/token TPOT (1.12 token/s). Every displayed speculative token was verified by the full target model.

For correctness, a four-layer tiny model runs 130 positions and must match an independent Python implementation with maxdiff=0.000000. The full checkpoint also has a fixed 16-token oracle. The repository includes reproducible benchmark records, CI, implementation provenance, and exact quick-start commands.

The project builds on and credits the expert-streaming approach demonstrated by kimi-k3-in-c; reused code, model adaptations, and project-specific optimizations are documented separately in NOTICE and the provenance documentation.

Would this be useful to link under "How to Run Locally" or a community implementations section? Compatibility reports from other CPUs, RAM sizes, and storage devices would also be very welcome.

Sign up or log in to comment