Accelerating Trillion-Parameter MoE Inference with Two Consumer GPUs

    This case study examines how two 24 GB consumer GPUs, CPU-based expert computation, and tiered weight storage can support local inference for a 2.8-trillion-parameter MoE model. It explains the division of work between devices, the impact of moving weight shards into a RAM disk, and reported performance of 3.11 tokens per second for generation and 16.8 tokens per second for prompt evaluation. It also outlines opportunities for quantization, expert prefetching, and caching.

    Introduction: The Challenge of Running Very Large Models Locally

    As mixture-of-experts (MoE) architectures become increasingly common in large language models, total parameter counts have reached trillions and beyond. One publicly described large-scale MoE model, for example, has 2.8 trillion parameters. Storing all of those parameters at 16-bit precision would require approximately 5.6 TB.

    The model has hundreds of expert networks—896 in this example—but activates only 16 experts per token, including two shared experts. Approximately 104 billion parameters participate in computation for each token. This sparse activation creates an opportunity for lower-cost inference: although the complete model is enormous, each forward pass uses only a fraction of its parameters.

    Memory capacity remains a major constraint. Two consumer GPUs with 24 GB of VRAM each provide just 48 GB in total. Against the approximately 865 GB working-set estimate cited for this configuration, that represents only about 5.5%.

    The central question is therefore not how to fit the entire model into VRAM, but how to use that limited VRAM effectively.

    1. Tiered Weight Storage: Combining Persistent Memory and a RAM Disk

    When a model cannot fit into GPU memory, a common approach is to keep its weights on larger, less expensive storage and access them as needed. This creates a three-tier hierarchy:

    • GPU memory, or VRAM: The fastest and smallest tier, best reserved for compute-intensive tensors with high reuse.
    • System RAM and a RAM disk, such as tmpfs: A lower-capacity alternative to storage that can provide hundreds of gigabytes of space for frequently accessed expert weights.
    • Persistent memory or high-speed SSD storage: A larger, lower-cost tier with higher access latency, suitable for less frequently accessed expert shards.

    In the case examined here, the relevant weights were organized into 94 shards totaling 414 GB. Of those shards, 45 were placed in a RAM disk, while the rest remained in persistent memory.

    Compared with the earlier arrangement, which kept all of these weights in persistent memory, the revised placement increased generation throughput from approximately 2.2 to 3.11 tokens per second—an improvement of about 41%. Prompt evaluation reached 16.8 tokens per second, approximately 26% faster.

    These results highlight an important practical lesson: storage bandwidth and access latency can be major bottlenecks in MoE inference. Moving frequently accessed weights from a slower tier into a RAM disk reduces the time spent waiting for expert data.

    2. Compute Offloading: Assigning Each Device the Right Work

    With GPU memory covering only a small fraction of the model’s storage requirements, loading all weights onto the GPUs is not an option. Instead, the workload is divided according to its computational characteristics.

    GPU-Based Attention

    Attention involves substantial matrix multiplication, with high computational density and strong parallelism. These operations are well suited to GPUs.

    Offloading attention-related work—including query, key, and value projections and attention-score computation—uses GPU compute capacity while keeping the memory footprint manageable. In the configuration described, the attention-related tensors fit within the combined 48 GB of VRAM.

    CPU-Based Expert Computation

    The MoE feed-forward network consists of many experts, with the router selecting only a small subset for each token.

    Expert weights remain on the CPU side, backed by the RAM disk and persistent memory. The system accesses the selected experts’ weights as needed and performs their computation on the CPU, avoiding the need to place those weights in VRAM.

    Although CPUs offer much less compute throughput than GPUs for this type of workload, activating only 16 experts per token keeps the amount of computation substantially below what a dense pass through the full model would require.

    Minimizing Cross-Device Transfers

    The key to this heterogeneous design is minimizing data movement between devices. Hidden states move between the GPU and CPU, while the much larger expert weights remain close to where their computation takes place.

    The following pseudocode illustrates the division of responsibilities:

    1. # Pseudocode: heterogeneous inference flow
    2. hidden = embedding(tokens) # CPU side
    3. for layer in layers:
    4. hidden = gpu_attention(hidden) # GPU: attention computation
    5. expert_ids = router(hidden) # Select experts
    6. for eid in expert_ids: # Activate 16 experts per token
    7. w = load_expert(eid) # Load from RAM disk/persistent memory
    8. hidden += expert_forward(hidden, w) # CPU-side expert computation
    9. output = lm_head(hidden)

    This is a conceptual outline of the data flow rather than a complete model implementation.

    3. Measured Performance and Realistic Expectations

    Before testing, the participants in this experiment estimated that GPU-assisted generation would reach between 2 and 4 tokens per second. The measured result of 3.11 tokens per second fell near the middle of that range, consistent with their initial performance estimate.

    For developers, the broader lesson is to estimate throughput before investing in hardware. Relevant inputs include:

    • GPU memory bandwidth.
    • System memory bandwidth.
    • Persistent-memory read throughput.
    • The amount of weight data that must be accessed for each inference step.

    Together, these factors can help establish plausible upper and lower performance bounds.

    Prompt evaluation was substantially faster than generation: 16.8 tokens per second versus 3.11 tokens per second. This is consistent with the different execution patterns of the two stages.

    Prompt processing can handle multiple tokens in parallel, spreading weight-access costs across more computation. Autoregressive generation has a sequential dependency between tokens, leaving fewer opportunities to amortize those costs.

    The results therefore need to be interpreted by workload stage. Prompt throughput alone does not describe the responsiveness users will experience during token-by-token generation.

    4. Opportunities for Further Optimization

    The configuration leaves several avenues for improvement.

    Tensor-Specific Quantization

    Different tensor groups can use different quantization precision levels. For example, less frequently activated experts could use more aggressive low-bit quantization to reduce storage requirements and loading time, while attention weights retain higher precision to help preserve output quality.

    Quantization is an established approach to reducing inference costs, but its effects on model quality need to be evaluated layer by layer.

    Expert Prefetching and Caching

    Locality in expert routing may provide opportunities to predict which experts will be needed and load their weights in advance. Prefetching and caching can reduce the amount of storage latency exposed on the inference path.

    Expanding the RAM Disk

    If sufficient system RAM is available, moving additional frequently accessed shards into the RAM disk could reduce dependence on the slower storage tier and bring performance closer to the limits imposed by memory bandwidth.

    Conclusion

    This case study demonstrates how sparse activation can make local inference feasible for an extremely large MoE model without placing its full weights on GPUs.

    The architecture combines three decisions:

    • Run attention on the GPUs.
    • Execute routed experts on the CPU.
    • Distribute expert weights across a RAM disk and persistent memory.

    With two consumer GPUs assisting a much larger CPU-side memory and storage setup, the reported configuration achieved 3.11 tokens per second for generation on a 2.8-trillion-parameter model.

    The result does not mean that two consumer GPUs alone can hold or run the entire model. Rather, it shows how a carefully partitioned heterogeneous system can use limited VRAM to accelerate a workload whose weights reside primarily elsewhere.

    For developers and organizations exploring very large models locally, this offers a practical way to balance hardware cost and inference performance. Where greater compute elasticity is required, similar workloads can also be deployed on cloud GPU instances, with object storage and container platforms supporting on-demand scaling and reducing the operational burden of maintaining dedicated hardware.