Running a Trillion-Parameter Model Without a GPU: Using Persistent Memory for CPU-Based Inference

    When model weights exceed GPU VRAM capacity, large-scale inference typically requires expensive multi-GPU setups. This article explores a practical alternative: running a trillion-parameter Mixture-of-Experts (MoE) model on a server platform using large-capacity persistent memory (PMem) and multi-core CPUs only. We break down the hardware choices, memory modes, quantization strategies, and software optimizations that make this approach feasible, and discuss its performance expectations and ideal use cases for cost-sensitive research and offline batch processing.

    Background: When VRAM Can’t Hold Trillion-Parameter Weights

    The parameter count of large language models (LLMs) is growing at a staggering pace. As models reach trillion or even multi-trillion parameter scale, a critical question confronts developers: where do the model weights live?

    Take common Mixture-of-Experts (MoE) architecture models as an example. Their total parameter count can easily reach trillions. Even with aggressive quantization, the resulting weight files far exceed the VRAM capacity of a single—or even multiple—consumer-grade GPUs. The conventional approach—stacking more GPUs or renting cloud compute—carries significant cost, placing it out of reach for many individual developers and small teams.

    Recently, an interesting home-lab experiment from the community demonstrated another path: using no GPU at all. Instead, large-capacity non-volatile persistent memory serves as the storage medium for model weights, with inference carried out entirely by multi-core CPUs. The experimenter successfully ran an MoE model with approximately 2.8 trillion total parameters on a single server platform, proving the viability of this route. This article provides a systematic technical breakdown of the approach.

    Core Concept: Letting “Secondary-Tier Storage” Carry the Weights

    Why the MoE Architecture Fits This Approach

    MoE models have a defining characteristic: not all parameters are engaged during each forward pass. A routing mechanism dynamically activates a small subset of “expert” sub-networks for every token. In practice, the number of active parameters involved in computation may represent only a small percentage of the total.

    This means the inference process’s bandwidth requirements are concentrated on the activated weights, not the full parameter set. As long as the active experts’ data can be fed to the CPU at an acceptable latency, inference can proceed continuously. This weakens the constraint that the storage medium must be extremely fast. Persistent memory offers lower bandwidth and higher latency than DRAM, but it is significantly faster than traditional solid-state drives—and crucially, its capacity can be very large.

    What Is Persistent Memory?

    Persistent Memory (PMem) is a class of memory products built on new storage-class memory technology. Physically, it resembles server memory modules and plugs directly into the motherboard’s memory slots. Single-module capacities reach 128GB, 256GB, or even 512GB. Its core characteristics include:

    • Large capacity: Far exceeds the density of standard DRAM modules; a single platform can easily scale to terabytes.
    • Byte-addressable: The CPU can access it directly as memory, rather than in blocks like a disk drive.
    • Intermediate performance: Latency is several times higher than DRAM, and bandwidth is lower, but it remains more than an order of magnitude faster than NVMe SSDs.
    • Non-volatile: Data persists across power cycles (though in inference scenarios, this is secondary; the primary value lies in its capacity and byte-addressability).

    It’s important to note that PMem requires specific platform support, typically pairing with specific generations of server-grade multi-core processors.

    Hardware and Working Mode Selection

    Hardware Platform

    The experiment utilized a server-grade processor with 40 physical cores, paired with multiple large-capacity persistent memory modules. Such combinations are commonly available at attractive prices on the secondhand data-center equipment market—a popular choice for hobbyist labs building large-memory platforms. Total budget is far below that of an equivalent multi-GPU solution in terms of VRAM capacity.

    Memory Working Mode: App Direct Is the Key

    Persistent memory typically supports two main operating modes:

    1. Memory Mode: DRAM acts as a cache layer for persistent memory. The operating system sees a single “large memory” block, and hardware handles hot/cold data promotion automatically.
    2. App Direct Mode: DRAM and persistent memory appear as two separate address spaces at the software level. Applications explicitly decide where data resides.

    This experiment chose App Direct Mode for a straightforward reason: inference workloads are highly sensitive to data placement. The model’s embedding layer, attention-related caches, and routing weights—the “hot data”—should be locked into DRAM. Meanwhile, the massive expert weights can reside on persistent memory, loaded on demand. Relying on hardware auto-scheduling may not align with inference access patterns, potentially introducing unpredictable latency spikes.

    In App Direct Mode, the operating system exposes persistent memory devices as mappable address spaces. Applications can use memory-mapped files (mmap) to map model weight files directly into that space, loading pages on demand without reading the entire file into DRAM up front.

    Software Stack and Inference Configuration

    Inference Framework Selection

    The experiment used a widely adopted open-source CPU inference framework (common local inference toolchains support similar capabilities). The typical advantages of such frameworks include:

    • Native CPU inference support with deep optimizations for mainstream instruction sets (AVX2, AVX-512, AMX, etc.).
    • Memory-mapped model loading, naturally complementary to PMem’s App Direct mode.
    • A rich selection of quantization formats, allowing flexible trade-offs between precision and size.
    • Targeted optimizations for MoE architectures, such as lazy loading of expert weights.

    Quantization Strategy

    Even placing a trillion-parameter model on terabytes of PMem makes full-precision (FP16/FP32) storage impractical; quantization is mandatory. A common pragmatic compromise:

    • Low-bit quantization (4-bit or even lower) for the bulk of expert weights to maximize size reduction.
    • Higher bit-widths retained for precision-sensitive, frequently activated components (e.g., attention layers, shared experts).
    • A mixed-precision quantization scheme minimizes accuracy loss while keeping total size manageable.

    Quantization yields a dual benefit: it reduces both storage capacity requirements and the volume of data that must be fetched during each inference step, directly improving throughput.

    Threading and NUMA Tuning

    CPU-based inference performance depends heavily on thread configuration. A few key lessons:

    • Match thread count to physical cores: Hyper-threading typically provides no benefit for dense matrix-computation workloads; set the thread count to the number of physical cores (40 in this case).
    • NUMA affinity: On dual-socket (or multi-socket) platforms, ensure threads access data primarily from the local NUMA node to avoid cross-node bandwidth penalties. When necessary, bind the inference process to a single NUMA node.
    • Huge pages: Enabling Transparent Huge Pages (THP) reduces TLB misses, which can help workloads that repeatedly scan large weight blocks.

    A representative startup configuration (parameters shown as common examples):

    1. # Typical startup approach for a general-purpose inference engine (illustrative)
    2. ./inference-engine \
    3. --model /mnt/pmem/models/moe-model-q4.bin \
    4. --threads 40 \
    5. --mlock false \
    6. --mmap true \
    7. --ctx-size 4096

    Here, --mmap enables the framework to read weights from persistent memory via memory mapping, avoiding a full load into DRAM.

    Performance Expectations and Use Cases

    To be candid: inference speed with this approach cannot match GPU-based systems. Limited by PMem bandwidth and CPU compute, token generation throughput typically lands in the single-digit tokens-per-second range. This makes it suitable for:

    • Offline batch processing: Nightly batch generation, data annotation, long-document summarization, and other tasks with low real-time sensitivity.
    • Research and validation: Individual developers exploring large-model behavior, testing prompts, or running small-scale evaluations.
    • Cost-sensitive scenarios: Total hardware cost (used server plus PMem) is far below that of an equivalent GPU solution in terms of VRAM.

    It is not suited for real-time conversational applications, high-concurrency online services, or other latency-sensitive production workloads. For demanding throughput and response-time requirements, a more realistic option is using cloud-hosted large-model inference APIs, which avoid the operational overhead of self-managed hardware and offer usage-based pricing.

    Summary and Takeaways

    The value of this experiment is not in “how fast it runs,” but in proving a concept: GPU VRAM is not the only path to running large models. By combining DRAM for hot data, persistent memory for the full weight set, CPU compute, and MoE’s sparse activation to reduce bandwidth pressure, the barrier to running extremely large models locally is significantly lowered.

    Three practical takeaways for developers:

    1. Understand model architecture before choosing hardware: It’s precisely the sparse activation property of MoE models that makes slower, high-capacity storage viable; dense models could not replicate this approach as effectively.
    2. A tiered storage mindset applies to inference too: Treating inference as a data-movement problem—placing data by access frequency—is a general methodology for cost optimization.
    3. Older hardware can find a second life: Retired multi-socket servers paired with large-capacity persistent memory offer a high-value compute base for personal AI experimentation.

    As inference frameworks continue to improve support for CPU and heterogeneous memory, and as more efficient quantization algorithms emerge, running large models “without a GPU” is evolving from a hobbyist curiosity into a more broadly accessible practice for developers.