DeepSeek V4.1 Flash on M3 Ultra nearly doubles decode to 31 t/s with first public DSpark Metal port

IngeniousIdiocy · reddit · 2026-09-15

A developer forked antirez/ds4 and built the first public DSpark Apple Metal implementation for DeepSeek V4.1 Flash (Q4) on a 512GB M3 Ultra, sustaining a real 91-minute agent turn: 101k tokens decoded, 4.6M prefilled at 99.5% cache hit, 56 tool calls with zero mistakes.

vs upstream ds4 (same machine, Q4): decode 8k ctx 16.6→31.3 t/s; 300k ctx 14.0→28.3 t/s; prefill 62k 737→813 t/s; disk KV cache restore 0.23s vs 31s cold; DSpark speculative decode 40.5 t/s on code, 41.3 t/s on agent turns.

Key techniques: decode is bandwidth-bound (14GB weights/token, 50 t/s ceiling) with hundreds of small dispatches as the bottleneck — layers merged into one command buffer, 384-expert router as one dispatch, fused shared-expert kernels, 770 re-round dispatches removed. The compressed-attention 512-block selection chain caused 98% of long-context slowdown; layers now score only admitted blocks with bounded radix select, so 300k decodes at 90% of the 8k rate. Prefill gained only 10% (compute-bound; Metal GEMM at 23-24 TFLOPS). DSpark shares one weight stream across 6 verify rows (177→112ms/block, 213→337GB/s) with exact speculative sampling at temperature >0. Output is byte-identical to upstream under greedy decode, with SHA-256 manifests to reproduce.

Original post →

More from coding & agent

coding & agent channel →