Streaming a 341GB model on a 128GB Mac: two macOS fixes made first token 8x faster
Chida82 · reddit · 2026-10-12
Developer Chida82 details two macOS-level fixes in sf-ds4-1flash, his fork of antirez's ds4 running DeepSeek V4.1 Flash on Metal, streaming a 341GB Q2 GGUF from SSD on a 128GB M5 Max.
1. FNOCACHE isn't fully "no cache" on APFS
- Reads not starting on a 16KB page boundary still get partially cached; expert weights sit 3MB apart, so they almost never align. Testing showed 982 of 3731 pages stayed cached, evicting decode weights.
- Fix: read the partial first page separately, then from the boundary.
- Result: first token after an 8K prompt 1.23s → 0.15s; +12.5% when appending 1.5K tokens.
2. Poll a mailbox instead of waiting on the command buffer
- Getting expert IDs via command-buffer completion costs 48µs; spinning on a shared buffer written by the router kernel takes 20µs, applied on every layer of every token. Side finding: GPU writes become CPU-visible when the command buffer ends, not the kernel.
- Result: decode +5.5% at 2K, +6.2% at 8K context.
Vs upstream ds4 (same GGUF, same flags): prefill +45% to +99%; decode 30 tok/s at 2K, 26 at 32K (+62% to +78%); first token 0.15-0.2s vs 2-3s. Logits are bit-checked after every change; output is token-identical.
Caveat: single machine; decode settles around 24 tok/s after an hour of heavy use. Repo: github.com/Chida82/sf-ds4-1flash
More from Infra
- NVIDIA details Kyber Galaxy orbital data center racks: 3.6 exaflops NVFP4 per satellite for SpaceX — sudoraohacker · 2026-12-02
- Export controls may widen US-China AI gap by only 2-3 months, argues analyst — kevinnbass · 2026-12-02
- Amazon Ergo enters most attractive quadrant at $1.64 per Intelligence Index task — ArtificialAnlys · 2026-12-02
- Amazon Ergo takes open-weights crown: 38 on AA Index, 1.1T params (55B active) — ArtificialAnlys · 2026-12-02
- Jensen Huang warns the US risks repeating its "5G mistake" and losing the AI race to China — TinfoilTricorn · 2026-12-02
- Hyperscaler capex consensus keeps being redrawn upward, now at $1.2T — peterwildeford · 2026-12-02