Local MoE LLM Deployment: VRAM, Bandwidth, and Quantization Tuning in Practice
Sparse Mixture-of-Experts (MoE) models look attractive for local deployment because only a small slice of their parameters runs per token, yet their full weight footprint still has to be stored somewhere. This article explains how to budget CPU RAM and GPU VRAM separately for a model such as 35B-A3B, how a simple bandwidth model explains why local decode throughput often lands at ten-something tokens per second on 16GB of RAM plus 8GB of VRAM, why 4-bit quantization plus mixed CPU/GPU scheduling makes the model usable, and how to handle KV cache growth in long conversations. It also includes a practical tuning checklist, a troubleshooting table, and FAQ answers.
1. Why “small activation” MoE Models Suit Local Deployment
Over the past few years, gains in large language model quality have come largely from steadily growing parameter counts, and training and inference costs have grown with them. For an individual developer or a small, lightweight team with one consumer-grade GPU and 16GB of system RAM, “bigger” almost always means “won’t run.”
Sparse Mixture of Experts (MoE) changes that picture. The model contains a large number of expert subnetworks, and each token is routed through only a small fraction of them. The total parameter count is therefore huge, while the parameters actually touched in a single forward pass are few. Such models are usually labeled as “total parameters – active parameters”, for example “35B-A3B”: about 35 billion total parameters, roughly 3 billion activated per token. For a direct comparison (all figures assume FP16, 2 bytes per parameter):
| Model type | Weight size (FP16) | Parameters active per token | Relative compute |
|---|---|---|---|
| Dense 7B | ~14GB | ~7B | 1× |
| Dense 27B | ~54GB | ~27B | ~3.9× |
| Sparse 35B-A3B | ~70GB | ~3B | ~0.43× |
The compute of a sparse model is in the same range as a 7B dense model, which is why people say a dense model several times larger than the active parameter count is needed to match it. But inference cost is more than compute: storage, memory bandwidth, and quantization quality all shape the actual experience. To know whether a local deployment will run at all, and how fast, you need a sensible resource-estimation method first.
2. First, Be Clear: Few Active Parameters ≠ Low Resource Needs
2.1 Three Kinds of Resources, Three Different Kinds of Arithmetic
Sparse activation is often misread as “resource consumption scales down proportionally.” That is not accurate. Compute, storage, and memory bandwidth behave completely differently:
- Compute is determined by active parameters: each token only has to complete the matrix operations corresponding to a few hundred million to a few billion parameters.
- Storage is determined by total parameters: any token may be routed to any expert, so all expert weights must be resident, or at least kept readily readable.
- Decode throughput is usually bound by effective memory bandwidth: for every token generated, the weights of the currently activated experts, the shared attention weights, and the KV cache all have to be read from main memory. Scheduling and CPU-GPU communication also take their share. Bandwidth is the primary ceiling, but not the only factor.
In a local setup, moving data between CPU, system RAM, and GPU memory is often the dominant cost. Only by planning the RAM and VRAM budget around the full set of weights will you avoid overflow while loading the model, or constant paging during inference.
2.2 Estimating CPU-Resident RAM and GPU VRAM Separately
CPU-side RAM and GPU-side VRAM are two independent budgets and should be estimated separately:
CPU-resident RAM (GB) ≈ CPU-side weights + KV cache + runtime overheadGPU VRAM (GB) ≈ GPU-side weights + KV cache + runtime overhead
Using a 4-bit quantized 35B-A3B model as the example, with general rules of thumb for everything else:
| Component | How to estimate | Reference value |
|---|---|---|
| 4-bit quantized weights | 35B × 0.5 byte | ~17.5GB |
| Group quantization metadata | Extra data such as scale factors | Typically adds a few percentage points to about 10%, must be measured |
| Long-context KV cache | Determined by layer count, KV head count, head dimension, precision, and context length | Usually hundreds of MB to a few GB at tens of thousands of tokens |
| Framework runtime overhead | Compute graphs, communication buffers, etc. | A few hundred MB to about 1GB |
| Total | — | ~19–23GB |
In a machine with “16GB RAM + 8GB VRAM”, one workable allocation is: place the weights of several attention layers, plus the weights on their activation path, in the 8GB of VRAM, and keep the remaining ~17GB of expert weights on the CPU side; reserve KV cache space on both sides, plus a few hundred MB to 1GB of runtime overhead. Because the total weight size far exceeds VRAM, and cannot all fit into 16GB of RAM alongside the KV cache either, the viable path for this class of model is quantization + mixed scheduling: some layers live in VRAM, the rest are computed on the CPU, and the inference framework moves data between CPU and GPU automatically.
A more aggressive option is on-demand loading: when weight files are mapped into memory with memory mapping, the system can leave the pages of experts that are only accessed later in secondary storage and keep only part of the experts resident. This lowers the resident memory requirement, at the cost of paging latency the first time a page is touched. Parallel-compute scenarios need an additional assessment of peak VRAM usage and inter-core communication overhead on top of this.
3. The Decode Bottleneck: Bandwidth Models and a Realistic Analysis
3.1 Why Compute Is Usually Not the Bottleneck During Decode
LLM inference typically splits into two phases:
- Prefill: all input tokens are processed at once. Matrix operations are large and highly parallel, so the phase is mainly compute-bound; sparse models only compute the activated experts, which is a clear advantage.
- Decode: output tokens are generated one at a time. Each step handles a single token and does very little arithmetic, so nearly all the time goes into reading weights. This is a classic memory-bandwidth-bound workload.
3.2 The Bandwidth Model and a More Realistic Formula
A commonly cited upper bound for decode speed is:
Decode speed upper bound ≈ effective memory bandwidth ÷ bytes of activated expert weights per token
It is worth stressing that this formula only accounts for reading the activated expert weights; it does not include reads of the shared attention weights or the KV cache. It is therefore an optimistic upper bound, and real decode speed is usually lower. A closer approximation is:
Decode speed upper bound ≈ effective memory bandwidth ÷ (bytes of activated expert weights per token+ bytes of shared attention weights+ bytes of KV cache read)
The closer the denominator gets to “total parameter reads”, the more conservative the estimate. The advantage of a sparse model is that the activated expert weight term is far smaller than the total parameters, so it can still run reasonably fast under a bandwidth limit.
3.3 Working Backwards from a Real Configuration (Example)
Consider an illustrative example: on a machine with “16GB RAM + 8GB VRAM”, running a 4-bit quantized 35B-A3B model through an inference framework that supports CPU/GPU hybrid execution, long conversations reach roughly ten-something tokens per second in decode (actual numbers vary with hardware, quantization, and framework version, so measure yourself):
- The activated expert weights read per generated token are about 3B × 0.5 byte ≈ 1.5GB/token.
- If the overall rate reaches 16 token/s, that works out to 16 token/s × 1.5GB/token = 24GB/s.
- Effective bandwidth of dual-channel memory is typically only 60–70% of theoretical peak. If effective bandwidth is about 30GB/s here, then roughly 6GB/s of bandwidth budget remains for KV cache reads, expert weight paging, and similar overhead. Note that this is a “bandwidth budget”, not a measured figure; actual usage has to be confirmed by profiling, and a budget should never be equated with real consumption.
What this back-calculation tells us:
- Whether the GPU participates in compute is not the deciding factor: the bottleneck is the overall effective bandwidth of the bus, not GPU compute power.
- The bottleneck can be quantified: CPU-GPU data movement, paging, and scheduling directly eat into an already tight byte stream.
- Optimization has a clear direction: reduce the bytes moved per token, and improve bandwidth utilization.
3.4 Comparing Correctly with Hosted Services
Users often feel that local models are “slower than cloud models.” The essential difference lies in bandwidth tiers: centralized cloud deployments typically use accelerator cards with high-bandwidth memory, sometimes keeping all weights resident in VRAM, and can reach decode throughput more than an order of magnitude higher. Local consumer hardware is limited by memory channels and bus bandwidth, so a gap in experience is normal. When comparing, use the same set of metrics:
| Metric | Meaning | What to focus on locally |
|---|---|---|
| Time to first token (TTFT) | Time from sending the request to receiving the first token | Prefill time for long contexts, weight paging |
| Decode speed (token/s) | Tokens generated per second during output | Effective bandwidth, expert read path |
| Long-context stability | How speed and memory usage change as context grows | KV cache growth, memory pressure |
| Output quality | Difference from the unquantized model | Quantization error, representativeness of calibration data |
Also, if you connect a third-party client to the local service, the “last hop” still goes through the HTTP layer: streaming transport, the network stack, and client-side rendering all add latency, and none of it can be removed by optimizing the model.
4. Long Contexts: Dual Pressure from KV Cache and Prefill
Take a fully specified illustrative scenario: on a 16GB RAM + 8GB VRAM machine, using a 4-bit quantized 35B-A3B model behind a CPU/GPU hybrid inference framework, decode speed falls back to ten-something tokens per second at 4 conversation turns with about 23,000 tokens of context. Combined with the bandwidth model above, KV cache reads are now stacked on top of weight reads and can no longer be ignored; paging and scheduling overhead also grow with context length.
KV cache size can be estimated as:
KV cache ≈ 2 × layers × KV heads × head dimension × bytes per element × context length
Some models have fewer KV heads than query heads (grouped-query attention). Quantizing the KV cache to 8-bit reduces its footprint further. In practice, long-context optimization focuses on three things:
- Control context growth: summarize and compress multi-turn conversations, or set a sliding window when not needed, so the KV cache does not grow without bound.
- Enable prefix caching: fixed prefixes such as system prompts and documents can reuse cached KV, avoiding repeated prefill.
- Watch prefill speed: during prefill all activated experts take part, so the longer the input, the more noticeable TTFT becomes; split the input into segments when necessary.
5. Quantization Strategy: Trading Accuracy Against Speed
Quantization is the core tool in resource-constrained settings. Common formats, roughly from lowest to highest precision:
| Precision level | Reference weight size for a 35B model | Positioning |
|---|---|---|
| 4-bit | ~17–18GB | The main option for running a model of this size on consumer hardware |
| 5–6-bit | ~22–26GB | A middle ground when memory headroom is comfortable |
| 8-bit | ~35GB | Hard for ordinary personal devices; mostly seen server-side |
Higher precision brings the model closer to its original behavior, but bandwidth demand rises as well, and decode speed drops accordingly. Whether to prioritize accuracy or speed depends on the business scenario:
- Accuracy-sensitive: structured information extraction, code generation, math reasoning — try 5–6-bit or higher.
- Speed-sensitive: chit-chat, rewriting, summarization, and other tasks that tolerate error well — 4-bit is usually enough.
- Always measure: different quantized versions of the same model can differ noticeably. After quantization, run at least two kinds of validation: a general language-understanding benchmark to confirm core capabilities have not degraded noticeably, and a comparison on a high-quality, business-specific sample set that focuses on the failure-prone areas such as format compliance, long-instruction following, and numeric computation.
6. A Practical Deployment and Tuning Checklist
6.1 Resources and Scheduling
- Layered VRAM and RAM: put frequently accessed parts such as attention layers in VRAM first, and distribute expert weights according to access frequency.
- On-demand loading: load expert weights on demand to avoid a memory peak from loading everything at once; combined with memory-mapped files, this reduces cold-start time.
- Threads and memory channels: CPU-side computation should make full use of all memory channels; set thread counts and NUMA affinity sensibly to avoid cross-node access.
- Avoid competing with the OS: close unnecessary background processes, and configure swap carefully so weights are not swapped out and repeatedly trigger page faults.
- Multi-GPU deployment: when a single card cannot hold the model, split it across cards — but under PCIe interconnect, activations must be transferred across cards every token, and the bandwidth loss needs to be measured.
6.2 Serving and Observability
If you wrap the local model as an HTTP service for applications to call, illustrative pseudocode looks like this (parameter names are placeholders only; follow the actual documentation of the framework you use):
run_inference \--model local_model.Q4 \--gpu-layers 28 \ # Layers placed on GPU: smaller value when VRAM is tight--threads 6 \ # CPU compute threads: too many cause contention--ctx-size 24576 \ # Context window: directly tied to KV cache usage--parallel 2 # Concurrency slots: each uses its own KV cache, reserve memory
A minimal validation sequence: first load the model and confirm the weights are fully loaded with no overflow; then set the context with --ctx-size and observe KV cache usage; finally measure steady-state decode speed with repeated generations on a fixed input (ignoring the first token), take several runs, and use the median. Adjust the number of GPU layers and thread count gradually under memory pressure, changing only one variable at a time; concurrency slots multiply KV cache usage by their count, so keep concurrency low when single-machine resources are tight.
Worth tracking: time to first token; decode speed; system RAM and VRAM usage; page fault count; request failure and timeout rates. A troubleshooting checklist:
| Symptom | Likely cause | Suggested action |
|---|---|---|
| Rising page faults, fluctuating speed | Insufficient memory, weights being swapped out | Lower --ctx-size or concurrency, or switch to a smaller quantization level |
| Persistently low decode speed | Insufficient effective bandwidth or a detouring read path | Adjust --gpu-layers, set NUMA affinity, reduce cross-card transfers |
| Excessive time to first token | Long-context prefill plus cold-start paging | Enable prefix caching, shorten the input, process in segments |
| Memory overflow as concurrency rises | KV cache multiplied per concurrent request | Lower --parallel, or shorten the context |
6.3 Choices When Extending to the Cloud
If the business is going to move from local to cloud, decide whether cloudification is worthwhile against these conditions instead of copying a generic product wholesale:
- Containerized inference: when you need to reuse the same runtime environment locally and in the cloud, use containers to unify dependencies and startup.
- Weight version management: when multiple weight versions need canary rollout and rollback, bring in object storage and version management.
- Monitoring and alerting: when you need to track TTFT, decode speed, and failure rate over the long term, connect logs and monitoring.
- Elastic scaling: when request volume has obvious peaks, use a message queue to absorb spikes, and define scaling trigger thresholds in advance (queue length, P99 latency, etc.) before going to the cloud.
6.4 Integrating into a Business Application
For applications such as AI-assisted coding and knowledge Q&A, the model is only one link in the chain. Local models suit scenarios where data must stay on the internal network, concurrency is low, and higher latency is tolerable. If the business needs a stable high-concurrency service, compare the total cost of local deployment versus cloud hosting — including hardware investment, operational effort, and scaling elasticity — before deciding.
7. Common Misconceptions and Key Takeaways
A few misconceptions about locally deploying this class of model are worth clearing up:
- “Small active parameters means small memory needs” — storage is determined by total parameters, so the budget must be calculated over the full set of weights.
- “A discrete GPU always makes it faster” — decode throughput is usually bound by effective bandwidth, and shuttling data back and forth between CPU and GPU can actually slow things down.
- “Quantization is lossless” — quantization costs accuracy and has to be measured against the business scenario.
- “Longer context always means a better experience” — the KV cache grows linearly with context, so long contexts raise both memory usage and time to first token.
Overall, the value of sparse models like “35B-A3B” lies in this: computing cost close to a small model, in exchange for knowledge capacity and expressive power close to a large one. On consumer devices with 16GB RAM and 8GB VRAM, combined with 4-bit quantization, mixed RAM/VRAM scheduling, and sensible context management, they can already handle everyday tasks such as conversation, summarization, and coding assistance. Understanding three principles — compute is determined by active parameters, storage by total parameters, and decode throughput mainly by bandwidth (plus KV cache, shared weights, and scheduling overhead) — is what takes local deployment from “it runs” to “it’s usable”.
8. FAQ
How much VRAM/RAM does local MoE deployment actually need? Budget VRAM and RAM separately. For 35B-A3B at 4-bit, weights are about 17–18GB, and roughly 19–23GB with the KV cache and runtime included. 8GB of VRAM cannot hold all the weights, so the usual approach is hybrid scheduling: some layers in VRAM, the rest computed on the CPU side.
Why is local MoE decode slow? Decode is memory-bandwidth-bound, so throughput is mainly constrained by effective bandwidth, further reduced by KV cache reads, CPU-GPU movement, and scheduling overhead. The upper-bound bandwidth formula only counts activated expert weights, so real speed will be lower.
4-bit or 5–6-bit quantization — how to choose? For accuracy-sensitive tasks (code, math, extraction), prefer 5–6-bit; for speed-sensitive tasks (chat, summarization), 4-bit is usually enough. Different quantized versions of the same model can differ noticeably, so always test format compliance and numeric computation with your own business samples.
Why does a long conversation get slower over time? The KV cache grows linearly with context length, occupying memory, increasing bytes read per token, and pushing up time to first token. Control it with context summarization, sliding windows, prefix caching, and KV quantization.
