Large-Scale MoE Inference on a Single Machine: Heterogeneous Memory and GPU Partitioning
This article examines single-machine inference for very large MoE models by separating parameter storage from computation. It reviews a setup that uses tmpfs, persistent memory, and discrete GPUs, covering shard placement, CPU/GPU work partitioning, reported throughput gains, measurement caveats, and tmpfs data-safety risks. It also explains why a 2.8-trillion-parameter model at 16-bit would require about 5.6 TB of weights while the referenced run loaded only about 865 GB, and why that gap matters for reproducibility.
Very large MoE models continue to grow in parameter count. For a model with 2.8 trillion total parameters, storing every parameter at 16-bit precision (2 bytes) would require about 5.6 TB of weights. That size far exceeds the VRAM of common GPUs and also exceeds the memory capacity of most single machines. Single-machine inference therefore has to solve two problems first: where to place the parameters and which hardware performs the computation. This article summarizes a practice based on heterogeneous memory and discrete GPUs, and it explains the measurement-basis issues involved so readers can judge what is reusable.
Placing Model Shards Across Different Media
Model files are usually split into multiple shards, which are then assigned to different storage media according to access characteristics. In this practice, about 94 shards totaled about 865 GB of loaded data. Of these, 45 shards (about 414 GB) were placed in a tmpfs RAM disk built from volatile memory, while the remaining shards were kept in persistent memory.
The basic allocation principle is to place shards that are frequently accessed or latency-sensitive during inference in tmpfs, and to place less frequently accessed shards in persistent memory. tmpfs offers high read/write bandwidth and low latency, but its data resides in memory, is lost after power loss or reboot, and consumes system memory. Persistent memory has lower bandwidth than a RAM disk but offers larger capacity and retains data after power loss.
One measurement-basis issue needs to be clarified first. At 16-bit precision, the full weights of 2.8 trillion parameters would be about 5.6 TB, while the loaded volume in the original material is only about 865 GB. The gap is large, and the material does not explain the reason. Reasonable explanations include quantization or compression of the files, loading only part of the tensors, or a different statistical scope. Before reproducing the setup, confirm the actual size and precision of the model files.
For the GPU side, this practice used two discrete GPUs with a total of 48 GB of VRAM. Based on the 865 GB loaded volume, VRAM accounts for about 5.5%; based on the full 5.6 TB, it accounts for only about 0.9%. The VRAM share is small, but when the computation assigned to it is chosen appropriately, it can still deliver a measurable improvement.
Dividing Work Between CPU and GPU
An MoE model consists of many routed experts. In the original example, the model has 896 experts, and each token activates 16 experts during inference, 2 of which are shared experts.
The original material reports about 104 billion activated parameters. If all experts are assumed to have the same size, then based on 2.8 trillion total parameters and an activation ratio of 16/896, the activated parameters would be about 50 billion. The two numbers differ by a factor of two, and the material does not explain whether the difference comes from shared experts, non-expert parameters, or another configuration. This article does not adopt either number as a conclusion; use the actual parameters in the model configuration file.
Routed experts are large, and each token accesses only a small subset of them, resulting in a sparse access pattern. The material therefore keeps them on the CPU side. Compared with placing everything in persistent memory, the combination of “persistent memory plus tmpfs” reduces bandwidth pressure when reading expert data. The material does not provide separate measurement data for this comparison, so it can only be treated as a directional conclusion.
Attention computation is handled by the GPU. Attention requires high compute and memory bandwidth, and its computation pattern is regular, making it suitable for parallel execution on GPUs. Offloading attention to the GPU uses GPU parallelism and also reduces the CPU’s computation burden.
The core logic of this division is: keep the sparse and very large portion on the memory side, and assign the compute-intensive portion to the GPU.
Measured Results and Reading Caveats
On top of the original pure-persistent-memory setup, adding the GPU and RAM disk produced the following reported results. Generation speed was 3.11 tokens per second, about 41% higher than the pure-persistent-memory setup. Prompt evaluation (prefill) speed was 16.8 tokens per second, about 26% higher.
These numbers need to be read with limitations in mind. The material does not record the following information: batch size, input and output length, quantization precision, specific models and bandwidth of the CPU, memory, persistent memory, and GPU, inference framework version, test tool, or number of repetitions. Generation speed and prefill speed measure different stages and should not be directly added together or substituted for each other. Therefore, this data only shows the performance of that specific configuration at that time and cannot be directly generalized to other environments.
The material also mentions an industry estimate that speed with GPU acceleration would be between 2 and 4 tokens per second. The result falls within this range, but the material does not give the source of the estimate, so it cannot serve as strong validation.
The material explains the improvement as follows: the RAM disk reduces data movement latency, and the GPU accelerates attention computation; the prefill improvement indicates that the GPU and high-bandwidth RAM disk work well together when processing input sequences in parallel. These explanations are reasonable, but the material does not provide component-level measurements, so it is not possible to determine how much each factor contributes.
Risks and Further Optimization Directions
When using tmpfs, data safety is the first concern. A RAM disk stores data in memory, so the data is lost after power loss or reboot, and it consumes system memory.
