Accelerating Inference for a 2.8 Trillion-Parameter MoE Model with Tiered Storage

    This article walks through a practical approach to speeding up inference for a 2.8 trillion-parameter Mixture-of-Experts (MoE) model when GPU memory is far smaller than the model itself. It explains why memory capacity and bandwidth, not raw compute, become the bottleneck, how a three-tier architecture across GPU memory, a tmpfs RAM disk, and persistent memory is organized, and why keeping routed expert tensors on the CPU side improves throughput. It also clarifies why prompt evaluation and token generation benefit by different margins, and outlines further optimization directions for teams working under tight hardware budgets.

    1. The Memory Gap Behind Trillion-Parameter Models

    Once model parameters reach the trillion scale, the first constraint on inference is no longer compute but memory capacity and bandwidth. Take a Mixture-of-Experts (MoE) model with roughly 2.8 trillion total parameters: if all parameters are stored at 16-bit precision, the weight files alone need about 5.6 TB. A pair of consumer GPUs offers only 48 GB of combined VRAM, roughly 5.5% of the model’s file size. The traditional idea of “fitting the model into VRAM” breaks down completely, so inference has to be built on tiered storage.

    Two sets of metrics need to be distinguished. The first is activated parameters: the architecture has 896 experts, and each token activates only 16 of them (2 of which are shared experts), for about 104 billion activated parameters per token. The second is total parameters, which determine storage and loading cost. The value of MoE lies in using sparse activation to keep the compute within a manageable range, but the price is that the weights must stay resident on media that is large enough and fast enough to address.

    2. A Three-Tier Architecture: VRAM, RAM Disk, and Persistent Memory

    The core of this practice is to split the weights into 94 shards (about 414 GB in total participating in scheduling) and place them across three types of media according to access frequency:

    • GPU VRAM: holds only attention-related computation and tensors, aiming for the lowest latency;
    • tmpfs RAM disk: holds 45 shards, using memory bandwidth to serve high-frequency access;
    • Persistent memory: holds the remaining shards and routed expert tensors, providing large-capacity, low-cost resident space.

    The placement logic can be abstracted into the following pseudocode, where the focus is “heat first, capacity as fallback”:

    1. # Illustrative: place shards by access heat and media capacity
    2. def place(shards, gpu_mem, ram_disk, pmem):
    3. plan = {"gpu": [], "tmpfs": [], "pmem": []}
    4. for s in sorted(shards, key=lambda x: x.heat, reverse=True):
    5. if s.size <= gpu_mem.free() and s.is_attention:
    6. plan["gpu"].append(s) # most latency-sensitive
    7. elif s.size <= ram_disk.free():
    8. plan["tmpfs"].append(s) # bandwidth first
    9. else:
    10. plan["pmem"].append(s) # capacity fallback
    11. return plan

    3. Offloading Strategy: Keeping Routed Experts on the CPU Side

    The key trade-off in this build is to keep the routed expert tensors on the CPU side, upgrading the medium from “pure persistent memory” to “persistent memory plus RAM disk,” while the GPU handles only attention computation. The gains come from two aspects: avoiding repeated movement of expert weights over the PCIe link, and spreading bandwidth pressure across two paths instead of a single medium. Measured results were about 3.11 tokens/s for generation and about 16.8 tokens/s for prompt evaluation, roughly 41% and 26% higher than the previous pure persistent-memory approach, in line with the estimated range of 2 to 4 tokens per second after GPU acceleration.

    4. Why Prompt Evaluation and Generation Speed Improve by Different Margins

    Prompt evaluation is a compute-intensive, parallelizable prefill stage that is more sensitive to bandwidth and parallelism, so the bandwidth gains from the RAM disk can be released more fully. Token-by-token generation is a memory-access-intensive, highly serial decode stage constrained by the amount of weights read per step, so its gains are more modest. Understanding this is necessary to set reasonable expectations: tiered storage mainly alleviates “capacity and bandwidth” and does not remove the serial bottleneck of the decode stage.

    5. Directions for Further Optimization

    • Custom quantization: choose differentiated precision for different tensors to compress weight size while keeping accuracy loss under control;
    • Re-estimating shard heat: dynamically adjust the shard ratio between tmpfs and persistent memory based on the real request distribution;
    • Overlapping compute and transfer: let prefetching of the next shard run in parallel with computation of the current shard;
    • Elastic scaling: migrate the same tiered approach to the cloud, using general-purpose capabilities such as object storage for weights, a container platform to orchestrate inference processes, and monitoring and alerting to track throughput and VRAM levels.

    6. Conclusion

    This approach shows that when VRAM is far smaller than the model size, inference performance depends on the quality of tiered placement and offload path design rather than the peak compute of a single card. With VRAM usage at about 5.5%, the coordination of RAM disk and persistent memory delivers roughly a 40% speedup in generation, offering a reusable engineering path for teams with limited budgets.