Single-Machine Inference for Trillion-Parameter MoE Models: Memory Tiering and Expert Offloading

    Running a trillion-parameter mixture-of-experts model on a single machine requires balancing limited GPU memory with much larger host-memory and persistent-storage tiers. This article examines tensor placement, expert offloading, reported inference results, bandwidth estimates, and deployment considerations, while explaining the limits of a single-user benchmark.

    1. The Challenge: Model Size Exceeds GPU Memory

    Mixture-of-experts (MoE) models have a large total parameter count but activate only a small subset for each token. In one publicly reported test, the model had 896 routed experts and activated 16 experts per token, including two shared experts. The active parameter count was approximately 104 billion. Storing all parameters at 16-bit precision required roughly 5.6 TB, while the quantized model files occupied about 865 GB.

    This creates a fundamental mismatch. Computation uses only a subset of the parameters at a time, but any routed expert may be needed during inference. All parameters therefore need to remain readily accessible. Typical GPUs provide only tens of gigabytes of memory—far less than the model requires.

    The practical approach is to distribute the model across storage tiers according to access patterns, rather than attempting to load the entire model onto one type of device.

    2. Roles of the Three Storage Tiers

    A single-machine deployment can use three broad storage tiers:

    Tier Typical capacity Bandwidth and latency Suitable contents
    GPU memory Tens of GB Highest bandwidth, lowest latency Attention-related tensors, shared experts, KV cache
    Host memory Hundreds of GB Moderate bandwidth Frequently accessed routed experts
    Persistent memory or high-capacity storage TB scale Higher latency Less frequently accessed routed experts and cold data

    This arrangement follows two principles. First, attention and shared experts are accessed for every token, making them good candidates for the fastest tier. Second, routed-expert access is sparse: only a small subset is used at each step, so those experts can reside in larger, slower tiers.

    In the reported deployment, two GPUs with a combined 48 GB of memory handled only attention computation. Approximately 5.5% of the model’s size remained on the GPUs. Routed-expert tensors stayed on the CPU side: 45 of the 94 model shards, totaling about 414 GB, were placed in a memory-backed filesystem, while the remaining shards stayed on persistent memory.

    3. Designing a Tensor Placement Strategy

    One placement heuristic is to rank tensors by access frequency relative to size, giving smaller, frequently accessed tensors priority in faster tiers.

    1. function place_tensors(tensors, available_gpu_memory, available_host_memory):
    2. sort tensors by (access_frequency / size) in descending order
    3. for each tensor:
    4. if tensor belongs to attention or shared experts
    5. and available_gpu_memory is sufficient:
    6. place tensor in GPU memory
    7. else if available_host_memory is sufficient:
    8. place tensor in host memory
    9. else:
    10. place tensor in the persistent-memory tier
    11. return placement

    Two additional details matter in practice.

    First, expert popularity is not fixed. Tracking access counts over a time window can help determine which experts should remain in host memory and when their placement should change.

    Second, shard boundaries should align with expert boundaries wherever possible. This reduces the need for a single expert read to span multiple storage tiers.

    4. Interpreting the Reported Results

    The deployment reported the following performance:

    • Generation throughput: 3.11 tokens per second.
    • Prompt evaluation throughput: 16.8 tokens per second.
    • Improvement over the previous persistent-memory-only placement: approximately 41% for generation and 26% for prompt evaluation.
    • Agreement with the earlier estimate: generation throughput fell within the developer’s predicted range of 2–4 tokens per second.

    These figures imply approximate throughput for the previous configuration:

    1. Generation: 3.11 / 1.41 ≈ 2.2 tokens/s
    2. Prompt evaluation: 16.8 / 1.26 ≈ 13.3 tokens/s

    However, this was an individual test rather than a standardized benchmark. Context length, batch size, quantization precision, and system load can all significantly affect results. The numbers illustrate the direction of improvement, but they should not be used directly as a basis for hardware selection.

    5. Estimating the Performance Bottleneck

    The generation phase, or decode, is often limited by memory bandwidth. For each generated token, the system must read the parameters activated for that step. A rough estimate is:

    1. Bytes read per token ≈ Active parameters × Average bits per parameter / 8
    2. Theoretical throughput ceiling (tokens/s)
    3. ≈ Effective bandwidth / Bytes read per token

    Using the reported figures, the active parameters account for approximately:

    1. 104 / 2,800 ≈ 3.7% of total parameters

    Applying that proportion to the quantized model size gives roughly 32 GB of parameter reads per token. At the measured 3.11 tokens per second, the implied effective read bandwidth is around 100 GB/s.

    This is an order-of-magnitude estimate, but it highlights an important point: improving generation speed depends on increasing the effective bandwidth available to active experts, not merely adding storage capacity.

    Prompt evaluation, or prefill, processes the input sequence and has higher arithmetic intensity. GPU parallelism can play a larger role in this phase. Decode and prefill therefore need to be analyzed and optimized separately.

    6. Deployment Considerations

    Capacity planning. Start with the model file size, then account for the KV cache, runtime overhead, and memory reserved for the operating system. Longer contexts substantially increase KV-cache usage and may consume GPU memory that could otherwise hold experts.

    Memory-backed filesystem risks. Data stored in a RAM-backed filesystem is lost after a power failure or restart and must be reloaded from persistent storage, increasing startup time. It also consumes host memory and competes with other processes for resources.

    NUMA affinity. On multisocket systems, memory-access latency depends on whether data and execution threads reside on the same NUMA node. Binding threads and memory allocations to appropriate nodes can reduce cross-node traffic.

    Quantization strategy. Different tensors have different sensitivity to reduced precision. Attention layers and routing layers should be evaluated separately before selecting their quantization bit widths, rather than applying one setting uniformly to the entire model.

    Monitoring. Track tier hit rates, actual read bandwidth, tokens per second, and time to first token. These metrics help identify whether placement, bandwidth, or another part of the system is limiting performance.

    7. Limitations and Future Directions

    This approach still has clear limitations.

    First, a single reported test without a reproducible benchmark makes comparisons difficult. Second, concurrent requests compete for experts and memory bandwidth, potentially turning scheduling into a new bottleneck. Third, longer contexts expand the KV cache and reduce the GPU memory available for other tensors.

    Further optimization can focus on two areas:

    • Tensor-specific quantization: choose precision separately for different tensors to improve the balance between model size and accuracy.
    • Expert-aware prefetching: use expert access frequency to move likely needed experts from slower tiers into faster memory before they are requested, reducing wait time.

    The central lesson is that single-machine inference for trillion-parameter sparse models is a memory-hierarchy problem as much as a compute problem. Capacity makes the model accessible; placement and effective bandwidth determine how quickly it can generate tokens.