Inferring a 2.8-Trillion Parameter MoE Model with Dual GPUs and Tiered Memory

    This article analyzes a community-driven architecture for deploying a 2.8-trillion parameter Mixture-of-Experts (MoE) model using dual consumer-grade GPUs and a tiered CPU memory system. It examines the hardware layout, corrects metric discrepancies, evaluates reported performance data, and highlights implementation risks and optimization opportunities.

    Introduction

    As large language models (LLMs) cross the trillion-parameter threshold, VRAM capacity has become the primary bottleneck for deployment. Although Mixture-of-Experts (MoE) models activate only a subset of experts per token, the entire set of weights must still reside in an accessible storage medium. Recently, an enthusiast shared a solution in the community: using two consumer-grade GPUs for attention computation while keeping expert tensors on the CPU side, with weights distributed across persistent memory and a tmpfs-based RAM disk. This article outlines the architecture and performance data based on the shared information, while noting which figures remain unverifiable.

    1. Clarifying the Numbers

    Before diving into the architecture, three sets of figures need clarification.

    1. Storage Size and Precision Mismatch. Storing 2.8 trillion parameters entirely in 16-bit precision requires approximately 5.6 TB (2.8 trillion × 2 bytes). However, the author’s actual core model file is 865 GB. Calculating roughly: 865 GB × 8 ÷ 2.8 trillion ≈ 2.5 bits, meaning an average of about 2.5 bits per parameter. This indicates the file has undergone low-bit quantization or mixed-precision processing, rather than 16-bit storage. The original text later claims “currently stored in 16-bit precision,” which contradicts this. The following analysis uses the quantized 865 GB file as the baseline.

    2. Unverifiable Active Parameter Count. The model has 896 experts, activating 16 per token, of which 2 are shared experts. If expert weights constitute the vast majority of total parameters, the activation ratio is 16/896, or about 1.8%, corresponding to 2.8 trillion × 1.8% ≈ 50 billion parameters. The original text states the active parameters are around 104 billion, showing a significant discrepancy. This might be because non-expert components (attention layers, embeddings, etc.) account for a higher proportion, or the expert scale differs from the description. Without the parameter count for a single expert and non-expert layers, it is impossible to determine which explanation is correct.

    3. VRAM Coverage Ratio. The two GPUs have a combined 48 GB of VRAM, accounting for about 5.5% of the 865 GB model file (48 ÷ 865). The GPUs can only accommodate attention-related tensors; the vast majority of expert weights must be served by the CPU-side memory subsystem.

    2. Architecture Breakdown

    The solution can be broken down into four steps.

    Step 1: Task Division. Attention computation is latency-sensitive and highly parallelizable, so it is executed on the GPUs. Expert routing computation depends on dynamic routing results and faces high memory access pressure, so it remains on the CPU side.

    Step 2: Model Shard Placement. The original approach splits the model into 94 shards, placing 45 in a tmpfs RAM disk and the rest in persistent memory. tmpfs uses system physical memory, offering high read/write bandwidth and low latency, so the author placed the most frequently accessed parts here. The author speculates this “might correspond to shared experts or routing weights,” but provided no evidence, so this remains an assumption. The specific rules for shard division were not disclosed.

    Step 3: Prefetching and Data Transfer. The original text mentions data transfer between the CPU and GPU relies on the PCIe bus, but it does not specify whether prefetching is used or describe the pipeline implementation. The author suggests prefetching and overlapping compute with communication as future optimization directions, but it remains unclear if the current version has implemented these.

    Step 4: Fallback and Fault Tolerance. The original text describes no fallback mechanisms. For instance, how to recover if tmpfs content is lost, or how to handle a failed shard read, are not addressed.

    3. Interpreting Performance Data

    The author published two sets of data and compared them with previous solutions.

    Solution Generation Speed (token/s) Prompt Evaluation Speed (token/s) Notes
    Previous pure PMEM solution Not disclosed Not disclosed Only relative improvement ratios provided
    Current heterogeneous solution 3.11 16.8 Author’s measured test

    Compared to the previous solution, generation speed increased by about 41%, and prompt evaluation speed increased by about 26%. The 3.11 token/s falls within the author’s prior estimate of 2 to 4 token/s.

    However, these figures currently have several shortcomings:

    • The original text does not specify the model version, quantization configuration, or inference framework.
    • It lacks hardware details: GPU and CPU models, persistent memory and tmpfs capacities, batch size, and context length.
    • No measurement commands or testing methodology are provided.
    • No generation quality evaluation results, such as perplexity or task accuracy, are given.

    Therefore, the 3.11 token/s should be understood as a reported value from the author’s specific environment and cannot be directly used to predict performance on other hardware.

    Regarding performance attribution, the original text attributes the speedup to two factors: tmpfs replacing some persistent memory access, and GPUs taking over attention computation. However, the author did not measure the contributions separately, so the 41% improvement cannot be broken down into specific factors.

    Mechanistically, autoregressive generation processes only one token per step and is primarily limited by memory bandwidth. Moving high-frequency shards to the RAM disk reduces read latency for those parts. The prompt evaluation phase processes multiple tokens at once, resulting in higher compute density, making the benefits of GPU-accelerated attention computation more pronounced. The original text also notes that cross-device PCIe transfers and the inherent latency of persistent memory still bottleneck evaluation speed.

    4. Pre-Deployment Risks

    tmpfs is volatile storage. Power loss, system reboots, or memory failures will cause tmpfs content to be lost. Recovery requires reloading approximately 45 shards from persistent media, significantly increasing startup time. This time should be accounted for during deployment, and it must be ensured that the original model files are stored on reliable storage.

    tmpfs consumes system memory. Shards placed in the RAM disk occupy physical memory, reducing available space for other processes. On machines with limited total memory, this overhead can cause frequent system paging.

    Persistent memory latency is higher than standard DRAM. While persistent memory offers advantages in capacity and cost per unit, its latency and bandwidth are lower than DRAM. The access latency for low-frequency experts will directly impact generation speed.

    Quantization introduces precision loss. The 865 GB file has undergone low-bit processing, but the original text provides no precision evaluation. Before use, output quality should be tested on target tasks rather than focusing solely on speed.

    Cross-PCIe data transfer. Data transmission between the CPU and GPU introduces additional latency. The larger the transfer volume, the more noticeable this overhead becomes.

    5. Future Optimization Directions

    1. Tensor sensitivity-based mixed-precision quantization. The author plans to analyze the sensitivity of different tensors to precision. Routing networks and shared experts would retain higher precision, while less frequently used experts would use 8-bit or 4-bit quantization. This direction reduces storage footprint and the volume of shard transfers between the RAM disk and persistent memory. This has not yet been implemented, and its impact on quality requires separate evaluation.

    2. Heterogeneous communication optimization. By optimizing tensor transfer batching and employing pipeline prefetching to overlap computation and data transfer, some memory access latency can be hidden. This is a proposed direction by the author, though no implementation details or performance data are provided in the original text.

    3. Multi-node scaling. If a single machine cannot meet concurrency demands, multi-node deployment can be considered. When choosing a cloud platform or building a self-hosted cluster, decisions should be based on measured throughput, latency, and cost, rather than just hardware specifications.

    6. Frequently Asked Questions

    How to solve the VRAM wall? This case presents one approach: placing attention computation on the GPU and distributing expert weights across large-capacity CPU-side memory. This trades bandwidth for capacity, making it suitable for scenarios where high generation speed is not a strict requirement.

    How to choose CPU+GPU heterogeneous inference? The key is the model’s compute-to-memory-access ratio. Attention computation typically suits GPUs, while the access pattern of expert weights dictates the required bandwidth and capacity of the CPU-side memory. Benchmarking with the target model should be done before hardware selection.

    What to consider when tiering persistent memory and tmpfs (hot/cold)? The most important factors are data volatility and capacity consumption. tmpfs will lose data, and persistent memory has higher latency. Before tiering, clearly identify which data can be lost and quickly recovered, and ensure sufficient system memory is reserved.

    7. Conclusion

    This case demonstrates that running ultra-large MoE models on machines with limited VRAM is feasible, but at the cost of lower generation speeds, more complex data layouts, and longer recovery times. The original text contains metric discrepancies, and some performance data lacks testing conditions. Therefore, before referencing this approach, one should first verify the model precision and active parameter count, and then conduct benchmark tests on their own hardware.