Exact GQA KV-Cache + ClassLRU MoE Math for Running 35B Models on 16 GiB VRAM
Disclosure: Drafted and benchmarked with AI assistance by the engineering team at Veristrux Inc. Most OOM crashes when running 30B–35B Mixture-of-Experts models (Qwen3-30B-A3B, Qwen3.6-35B-A3B) on 16 GiB consumer GPUs c
Disclosure: Drafted and benchmarked with AI assistance by the engineering team at Veristrux Inc.
Most OOM crashes when running 30B–35B Mixture-of-Experts models (Qwen3-30B-A3B, Qwen3.6-35B-A3B) on 16 GiB consumer GPUs come from two miscalculations:
- Forgetting ~1.25 GiB of OS compositor + CUDA workspace headroom.
- Offloading whole transformer layers (
-ngl)—which pushes latency-critical attention projections over PCIe—instead of keeping 100% of attention + GQA KV cache in VRAM and offloading only cold routed expert FFN tensors (-cmoe/--moe-cache-mibinllama.cpp v1.0or--n-cpu-moe).
The Exact 16 GiB Split
-
Attention + Shared Routers + Quantized KV (
--cache-type-k f8_e4m3 --cache-type-v q4_1 -np 1): Stays 100% resident in GDDR6/GDDR7. -
Cold Routed Experts: Because only ~3B parameters activate per token, caching hot experts in VRAM (
--moe-cache-mib 6400) while streaming cold experts from dual-channel DDR5 sustains 55–73+ tok/s at 16K–32K context without OOM cliffs. -
Embeddings / Rerankers: Keep RAG encoders on CPU INT8 or NPU (
0 MiBGPU VRAM) so they never fragment the KV allocation.
Try the Open-Core Planner CLI
pip install git+https://github.com/argoness-prime/silicon-tuner.git
silicon-tuner-core --help
- MIT Open-Core VRAM & MoE Calculator: https://github.com/argoness-prime/silicon-tuner
- Full Hybrid Silicon Tuner ($9), Iron Veil Agent Firewall ($5), & Same-Day $5 Express Bugfix/Config Triage: https://argoness-prime.github.io/veristrux/
📰 Read the original article on Dev.to AI
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.