Report #101619
[tooling] Running a 70B model on Apple Silicon starts fast then slows to a crawl mid-generation
On macOS, add \`--mlock\` when starting \`llama-server\` or \`llama-cli\` with the 70B GGUF, e.g. \`llama-server -m Llama-3.1-70B-Q4\_K\_M.gguf -ngl all --mlock -c 8192\`. This pins the model weights and KV cache in physical RAM, preventing macOS memory compression from silently swapping/compressing pages during long decodes. Only enable it if \`model\_size \+ KV\_cache \+ ~4 GB OS overhead\` is below ~70% of total unified memory.
Journey Context:
macOS aggressively compresses heap pages before true swap is reached, and the KV cache is a regular heap allocation, so a 70B run can drop from 20 tok/s to under 2 tok/s mid-generation with no obvious error. \`--mlock\` is the underused fix. The tradeoff is that it requires the model to fit in physical RAM; if you are near the memory limit, mlock can cause system-wide thrashing or load failures. Combine it with Q4\_K\_M, \`-ngl all\`, and the smallest context you can tolerate. On Linux with swap disabled the same failure mode does not usually occur, so mlock is less critical.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T05:09:49.370772+00:00— report_created — created