Running Large MoE Models on a Single Consumer GPU: VRAM and System Memory Trade-Offs
Deploying a large mixture-of-experts model on a consumer GPU requires more than adding up VRAM and system RAM. This article explains how to verify model size, account for pinned-memory limits, balance expert residency against KV cache capacity, and investigate slow loading—with caveats for interpreting the reported performance figures.
1. Start with the Model’s Actual Size
FP8 weights use approximately one byte per parameter. In the reported test, the model’s weight files totaled roughly 140 GB, suggesting approximately 140 billion parameters. Although the original report’s title referred to nearly 300 billion parameters, 300 billion FP8 parameters would require roughly 300 GB. Those figures are inconsistent, so this article uses the observed 140 GB file size as its baseline.
Before deployment, check the total size of the model files rather than relying solely on parameter count. File size determines how much memory and storage you need to reserve; parameter count provides only a rough indication.
2. Account for System RAM and VRAM Separately
A system with 32 GB of VRAM and 192 GB of RAM has 224 GB in total, apparently enough for a 140 GB model. But that sum overstates the memory available for GPU-accessible weight storage. Host memory used for direct GPU access must be pinned, or page-locked, and the operating system and driver impose limits on that allocation.
On Windows, WDDM places limits on GPU-accessible pinned memory. The 96 GB estimate in the original report was an observation from one setup, not a universal limit. The limit can vary with the driver version and system configuration.
When checking memory limits:
- Windows: Task Manager’s GPU page displays “Shared GPU memory,” but this is not the same as the pinned-memory quota. Confirm applicable limits against the driver version and vendor documentation.
- Linux:
ulimit -lshows the per-process limit on locked memory. The original report also providesgrep -i mlock /proc/meminfoto inspect locked-memory usage; note that this case-sensitive command may not match theMlockedfield.
If the model’s weights exceed the combined capacity of VRAM and available pinned memory, some expert weights remain in pageable memory. Accessing those weights requires additional data movement, reducing throughput.
The original report cited more than 20 tokens/s on Linux and approximately 14 tokens/s on a constrained Windows setup for similar models. However, the model versions, frameworks, and test settings were not consistent. These results illustrate a possible trend, not a controlled comparison.
For a long-running service, prefer a native Linux server. Windows may be more suitable for offline workloads. For example, it could be acceptable if your task tolerates throughput below 5 tokens/s and requires no more than a 32K context. These are illustrative thresholds, not deployment guarantees; use measurements from your own workload.
3. Allocate VRAM Between Speed and Context Length
In a deployment that splits the model across GPU and host memory, two major consumers compete for VRAM:
- KV cache: Memory usage grows with context length.
- Resident expert layers: Keeping more expert layers in VRAM reduces weight transfers and improves speed.
Allocating more VRAM to one leaves less for the other. The original report provided these reference figures:
| Context length | Reported throughput | Test details |
|---|---|---|
| 64K | Approximately 14 tokens/s | Full model name, framework version, batch size, and input/output lengths were not provided |
| 128K | Approximately 8.3–9.4 tokens/s | Same limitations |
Doubling the context from 64K to 128K reduced throughput by approximately 30–40%. The direction of the trade-off is useful, but the specific numbers need to be verified under consistent test conditions.
Estimate KV Cache Memory
For a conventional attention configuration:
KV cache bytes = 2 × number of layers × number of KV heads × head dimension × context length × bytes per element × concurrent sequences
Consider a hypothetical configuration—not the actual model configuration—with 60 layers, 8 KV heads, a head dimension of 128, a 64K context, and one concurrent sequence:
- FP8 KV cache, at 1 byte per element: Approximately 8.05 GB
- FP16 KV cache, at 2 bytes per element: Approximately 16.1 GB
Models using compressed attention architectures such as MLA require a different calculation. Use the relevant parameters in the model’s configuration file.
Calculate the Space Available for Experts
Use the following budget before loading the model:
Total VRAM − driver and system usage − KV cache − resident non-expert layers and activation buffers = VRAM available for expert layers
Calculate this budget first, then decide how much of the expert stack to keep resident. Doing so reduces trial and error.
4. Loading Time Makes Configuration Changes Expensive
The original report stated that a full load took approximately 15 minutes, but did not identify the storage device or its measured read speed.
For 140 GB of weights, 15 minutes corresponds to an average rate of approximately 156 MB/s. PCIe 5.0 NVMe SSDs commonly advertise sequential read speeds above 10 GB/s. At that rate, reading 140 GB sequentially would theoretically take only around a dozen seconds. A much longer load therefore likely involves more than sequential disk reads: small random reads, format conversion, memory registration, or framework initialization may account for much of the time.
To locate the bottleneck, measure three stages separately:
- Disk reads: Use tools such as
fiooriostat. - Loading into system RAM
- Transferring data to VRAM
Measure cold and warm starts separately as well. On Linux, clearing the page cache requires root privileges; the command given in the original report is:
echo 3 > /proc/sys/vm/drop_caches
Reading model weights does not itself consume an SSD’s write endurance, and RAM does not have a comparable write-wear concern. The main cost of repeated loading is time.
Reduce Repeated Loads
- Decide whether the workload prioritizes throughput or context length before starting the load, and select the configuration accordingly.
- Set aside a dedicated period for parameter exploration rather than repeatedly changing settings during normal use.
- Validate the configuration logic with a shorter context or smaller model before loading the full model.
