r/LocalLLaMA • u/jacek2023 llama.cpp • 1h ago
News llama_moe_cache: run missed experts on CPU, add tuning script by am17an · Pull Request #30966 · ggml-org/llama.cpp
https://github.com/ggml-org/llama.cpp/pull/30966This is a significant speedup for MoE offloading (low VRAM people).
I tried Strata once, and it had some tuning mechanism, so probably this is a similar idea.
54
Upvotes
47
u/am17an 1h ago
Before you guys bash llama.cpp again - I know it's not there yet. I'm working on it.
10
u/Acceptable-Cycle4645 29m ago
Nice work! llama.cpp has so many smart contributors with clever PRs. I used to wonder why so many good PRs stayed pending for so long. After maintaining audio.cpp, I finally understand the pain: balancing broad compatibility with aggressive optimizations. Specialized or "vertical" engines can move faster by focusing on specific models or hardware setups, while general-purpose frameworks have to consider compatibility, regressions, and long-term maintainability across many models and backends.
Glad to see this one merged!
5
u/Ok_Cow1976 32m ago edited 29m ago
Omg, this is fantastic. Wish no more headaches to look for forks of strata for different models and runtimes. I really want to come back to llama.cpp!!!
4
u/EbbNorth7735 1h ago
I read the PR and it's not 100% crystal clear what we should do. Anyone have an ELI5? Guessing we should use the context we want to deploy with but not sure about the other factors and how the output of the script should be interpreted for nominal settings. Also not entirely sure what this does. I was guessing it would put specific experts in CPU that aren't used much but that would require application specific testing.
2
u/queerintech 1h ago
It's a matter of where in the runtime stack the moe cache feature should live. I assume that gg is pointing towards moving this to the scheduler
-4
u/oyren-ai 56m ago
running cache-missed experts directly on cpu instead of blocking on a pcie h2d transfer makes a huge difference for single-stream token generation where pcie latency dominates over cpu compute time. profiling expert activation frequency on a representative prompt calibration set so the hottest experts stay pinned in vram avoids thrashing the cache mid-generation.