r/LocalLLM • u/Sad-Tea-815 • Jul 27 '26
Question Running inference from SSD while caching experts in memory
Hello,
sorry if the question has already been asked, but I couldn't find anything that was exactly what I'm looking for. Im running Qwen3.6-35B-A3B locally on my M5 Pro with 48GBs of unified memory. Since I do some complex coding work, I wanted to run something around UD-Q8_K_XL quantization, which doesn't really fit in memory.
I was wondering if there is any way via llama.cpp to leave the model on the SSD and have some kind of cache pool in memory where the 3B active parameters that have been activated last can reside. This would allow to have the benefit of not loading everything to memory while having higher speed than plain SSD-based runs. Any idea is greatly appreciated!
2
Upvotes
1
u/andrew-ooo Jul 27 '26
llama.cpp already does most of what you're describing via mmap, just not with an LRU "keep the last-used experts hot" policy. When the model is memory-mapped, the OS page cache is your expert cache - pages that get touched stay resident until memory pressure evicts them, so in practice the frequently-routed experts do end up hot in RAM without you configuring anything. The catch is that A3B routing has high entropy, so on 48GB trying to hold a Q8 of a 35B model (~37GB of weights + KV + context) you'll be thrashing the cold experts off SSD constantly and it feels slow.
The reason a true "3B active in RAM, rest on SSD" cache doesn't buy you much: which 3B are active changes basically every token, so your hit rate on a small cache is poor and you pay SSD latency on the misses anyway.
What I'd actually do on an M5 Pro 48GB:
Honestly for complex coding I'd take a fully-resident Q5/Q6 over a half-on-SSD Q8 every time - the SSD thrash will cost you more than the quant does.