SSD streaming: LRU cache behaves pathologically during prefill
During prefill, the activated weights per batch may be larger than the expert cache. When this happens I see a flat 0% hit rate, because the LRU replacement policy always evicts an expert between its allocation and its next use. Prefill is disk-bound as a result.
I did some experiments, and a simple trick that helps quite a bit is to temporarily freeze cache allocations after the first prefill batch. For remaining batches you still query the cache, still use cached experts, but anything not in the cache is filled from disk and immediately discarded after use. This avoids the pathological LRU cycling and ensures you get to hit the cached experts. Enabling cache allocations for the first batch is still useful for cache warming, especially when prefilling from 0 with a cold cache.
This trick increased my prefill from ~110 t/s to ~400 t/s running the Q2 quant of GLM-5.3 Flash on an RTX Pro 6000 using CUDA 13.1. I can provide a patch if it's interesting but I think there's enough info here to have an agent evaluate the idea.
Other issues: I looked at #503 which sounded related from the title, but on closer inspection it seems to be a problem with different cache arenas for different quantisation types, and not about this more general LRU problem.
Source: antirez/ds4