Running Large Models on a Single Machine: A Sharding Strategy with Dual GPUs and Persistent Memory
This article presents a practical sharding strategy for running extremely large MoE models on a single machine, combining dual consumer GPUs with persistent memory and DRAM-based tmpfs. It breaks down the capacity calculations, hardware composition, and the key decision of placing high-frequency expert shards on faster DRAM, along with estimation methods for KV cache and a checklist for production readiness.
Clarifying the Capacity Baseline
The 2.8 trillion parameter count mentioned in the title refers to the total parameter size of a Mixture-of-Experts (MoE) model. MoE models only activate a subset of experts per inference step, so the total parameter count determines storage requirements while the active parameter count determines compute per token. These two figures must be considered separately.
With 16-bit (2 bytes) storage per parameter, full-precision weights would total approximately 2.8 × 10¹² × 2 bytes = 5.6 TB. This represents the theoretical size of the original model, not the actual size used in practical testing.
The model file used in actual testing was approximately 865 GB, which corresponds to an average bit-width of about 865 × 8 ÷ 2800 ≈ 2.47 bits per parameter. This indicates the test used a quantized version. The original test did not specify the quantization method, so it is essential to verify your own file size, bit-width, and quantization format before attempting to reproduce the results.
The following table summarizes the different capacity figures referenced in this article:
| Item | Capacity | Percentage of Reference Base |
|---|---|---|
| Full weights (16-bit) | ~5.6 TB | Reference base |
| Quantized model file | ~865 GB | ~15% of full weights |
| Two GPU VRAM | 48 GB | ~5.5% of quantized file; ~0.86% of full weights |
| DRAM tmpfs shards | ~414 GB | ~48% of quantized file |
| Remaining persistent memory shards | ~451 GB | ~52% of quantized file |
Hardware Configuration
The test machine uses second-generation persistent memory, which falls under the Intel Optane product category. Persistent memory offers large capacity and retains data after power loss. However, its latency and bandwidth are significantly lower than DRAM.
Intel discontinued the Optane product line in 2022. If purchasing second-hand or surplus equipment, verify three things: compatibility with the motherboard and memory controller, firmware version, and availability of spare parts and warranty support. If reliable procurement is not possible, the approach must be re-evaluated—do not assume the hardware will remain replaceable long-term.
On this basis, the machine was equipped with two consumer-grade GPUs, each with 24 GB of VRAM, totaling 48 GB. The GPUs only handle attention computation, while the expert networks still run on the CPU side. This setup is more accurately described as a hybrid approach combining consumer GPUs with discontinued persistent memory.
The original test did not provide verifiable benchmark links. The figures referenced here are based on the original report, and you should remeasure everything on your own hardware.
Sharding Strategy: High-Frequency Data on DRAM
The model is divided into 94 shards. Among these, 45 shards totaling approximately 414 GB are placed in a tmpfs memory disk, which consumes DRAM. The remaining shards stay on persistent memory.
The allocation is based on access frequency. Shared experts and frequently routed experts are accessed far more often than others. Placing this data on higher-bandwidth DRAM reduces pressure on persistent memory. The original test reported DRAM bandwidth in the tens of GB/s, while persistent memory bandwidth was noticeably lower. Exact figures depend on the platform, so measure on your own system.
Use the following criteria to make sharding decisions:
- Access frequency: Shared experts and high-frequency experts should be prioritized for DRAM.
- Expert hit rate: Count actual routing outcomes from real inputs—do not rely only on theoretical values.
- Capacity: The DRAM tmpfs must leave headroom for the system and other processes.
- Bandwidth: Compare sequential and random read performance between the two storage types.
- Power-loss recovery target: If reloading after power loss is unacceptable, ensure persistent data integrity.
What Is Lost on Power Outage
Shards in tmpfs are volatile. After a power outage or reboot, these shards disappear entirely and must be recopied from persistent storage or the original model file. tmpfs must never be the only copy.
Shards on persistent memory survive power loss, but an interruption during a write may leave incomplete data. The platform’s power-loss protection strategy must also be verified. After loading, perform integrity checks—do not assume data is intact by default.
GPU VRAM is cleared on power loss with no persistent state; models must be reloaded after every restart.
Estimating KV Cache
KV cache grows with context length and concurrent requests. For standard multi-head attention, estimate it with the following formula:
KV cache size ≈ 2 × number of layers × number of KV heads × head dimension × context length × bytes per element × number of concurrent requests
Read the number of layers, KV heads, and head dimension from the model configuration file—do not rely on memory. Models using compressed attention structures will have a different formula and must be derived according to that model’s specific implementation.
Verifying Quantization
Quantized models need output-quality validation, not just successful loading. Follow these steps:
- Check file size and bit-width to confirm they match the stated quantization format.
- Select a fixed set of prompts, generate outputs before and after quantization, and compare the differences.
- Use metrics such as perplexity or task accuracy to quantify quality loss.
- Review loading logs to confirm no missing layers or errors.
Performance Figures and Their Conditions
The original test reported a ~41% improvement in single-generation speed, but it did not provide the baseline, tokens per second, batch size, context length, quantization method, or software versions. Without these details, this number cannot be treated as a conclusion. If you measure your own improvement, record the following:
- Configuration and speed of the control group
- Test batch size and context length
- Quantization method and hash of the model file
- CPU, GPU, and memory models and counts
- Driver, framework, and OS versions
- Number of test runs and variance
Pre-Production Checklist
- Confirm the model’s total parameter count, active parameter count, and quantization bit-width.
- Estimate KV cache for maximum concurrency using the formula, with headroom reserved for VRAM and system memory.
- Compare outputs before and after quantization; confirm quality loss is acceptable.
- Confirm persistent memory procurement channel, firmware version, and spare parts availability.
- tmpfs shards have a clear reload path and are not the only copy.
- Perform a planned power-loss or reboot drill and record recovery time.
- Prepare a rollback plan—can switch to the previous version or CPU-only inference.
- Set up monitoring and alerts for VRAM, RAM, temperature, and latency.
Whether this approach is suitable for production depends on the outcome of each checklist item. Until all items are verified, treat it as an experimental environment, not a stable service.
