When GPU Memory Runs Out, Persistent Memory Fills the Gap: Running Trillion-Parameter LLMs on CPUs Alone

    This article explores how to run trillion-parameter large language models using only CPUs and high-capacity persistent memory (PMEM) when GPU memory is insufficient. It explains why memory capacity, not compute, becomes the first constraint at this scale, outlines the capability boundaries and two working modes of PMEM, and describes a capacity-first hardware strategy covering CPU selection, memory tiering, channel population, and cooling. It also sets realistic performance expectations for offline throughput rather than real-time interaction, and offers guidance on which scenarios fit this approach and which do not. Readers will learn the core trade-off of trading time for cost, along with the practical engineering challenges of cooling, bandwidth calibration, and scheduling.

    1. The Starting Point: Trillion-Parameter Models Push the Memory Wall Higher

    Once model parameter counts reach the trillion scale, the first constraint on the inference side is no longer compute but whether the model can fit at all. Even after aggressive quantization, a top-tier model still needs roughly 610GB of available memory to load and run inference. That figure exceeds the GPU memory ceiling of most single machines, and splitting across multiple cards introduces communication overhead and engineering complexity.

    At the same time, memory component prices are in an upward cycle, so stacking traditional memory modules to reach more than 600GB is extremely expensive. The problem therefore reduces to a general engineering question: can large-capacity, storage-class memory with a lower cost per unit of capacity carry the resident demand for model weights and the KV cache, leaving expensive GPU memory or RAM only for the parts that truly need low latency?

    2. The Technical Foundation: The Capability Boundaries of Persistent Memory

    Persistent memory (PMEM) is a component tier that sits between memory and storage. It offers byte-addressability, random read/write, and data persistence across power loss. A common deployment form is high-capacity persistent memory in a DIMM form factor, with hundreds of gigabytes per module; once multiple channels are fully populated, a single machine can easily reach the TB level. It has two typical operating modes:

    • Memory Mode: Completely transparent to the layer above and recognized as ordinary memory. It is the easiest way to expand capacity, but data consistency depends on the software layer.
    • App Direct Mode: Maps persistent memory as an independent persistent address space, letting the application explicitly decide which data goes where, so the placement of tensors, weight shards, and caches can be controlled precisely.

    For large-model inference, the second mode is more valuable: weights are read-only and their access pattern is predictable. Keeping weights resident in persistent memory while placing activations and temporary buffers in ordinary RAM is a natural hot/cold tiering. The illustrative pseudocode below only expresses the tiering idea and is not tied to any specific interface:

    1. # Pseudocode: weights stay resident in high-capacity persistent memory, activations use ordinary RAM
    2. weights = pmem_region.alloc_tensor(shape=W_SHAPE, dtype=INT4) # cold data, large capacity, low cost
    3. weights.load_from_checkpoint(ckpt_path)
    4. def forward(x):
    5. act = ram_scratch.alloc(shape=ACT_SHAPE) # hot data, small capacity, low latency
    6. for layer in layers:
    7. act = layer.matmul(x, weights[layer.id]) # weights are streamed in from persistent memory
    8. return act

    3. Hardware Configuration Approach: Enough Compute, Capacity First

    The core of this kind of setup is not chasing peak compute but putting the budget into capacity and bandwidth. A reference configuration logic:

    1. Processor: A server-grade CPU with ample cores and many memory channels is sufficient. During inference, a large amount of time is spent reading weights and waiting on memory access, so the benefit from core count is far smaller than the benefit from memory channels and capacity.
    2. Tiered memory capacity: Small-capacity high-speed memory handles runtime buffers, while large-capacity persistent memory keeps weights resident. The capacity ratio of the two is best calibrated by measurement based on “weight footprint : runtime footprint,” to avoid high-speed memory being crowded out by weights.
    3. Populate all channels: Persistent memory bandwidth is strongly tied to channel count, and leaving slots empty significantly reduces effective bandwidth, which further slows down already-modest inference speed.
    4. Cooling design (the most easily overlooked hard requirement): High-capacity persistent memory draws substantial power and generates considerable heat at full load, so active cooling is mandatory. In practice, there have been cases of heat scorching adjacent memory modules and, in extreme situations, damaging the slots. Recommended practices include: adding directional turbo fans to the memory area to create forced airflow, separating hot and cold zones inside the chassis, and bringing memory temperature into monitoring and alerting thresholds.
    1. # Example: bring memory temperature into routine monitoring (the command is only a generic-form illustration)
    2. watch -n 5 'sensors | grep -i -E "dimm|mem"'

    4. Performance Reality: Set Expectations on “Offline Throughput,” Not “Real-Time Interaction”

    Performance must be viewed honestly. With this CPU-only plus large-capacity persistent memory combination, at extreme quantization (1-bit) inference runs at less than one token per second, and moving to 3-bit quantization drops the speed further to around 0.75 tokens per second. By that math, a task generating 50,000 tokens takes well over ten hours.

    These numbers point to three things:

    • Interactive conversation is not viable: No one can accept response latency measured in hours.
    • Offline batch processing is viable: Scenarios that do not chase timeliness, such as overnight batch runs, corpus generation, offline evaluation, and data-labeling assistance, can trade extremely low cost per unit of capacity for simply “getting it to run.”
    • Quantization precision and speed are coupled: A lower bit width saves memory but is not necessarily faster, because memory-access and unpacking overhead can cancel out the gains, so the inflection point must be determined by measurement.

    5. Implementation Advice: When to Use It and When Not To

    Scenarios suited to this approach: budget-sensitive cases, tasks that can be queued, latency-insensitive workloads, and one-time loading of very large weights for batch inference. Scenarios not suited: online services, products that require streaming output, and production pipelines with SLA requirements.

    On the engineering side, three capabilities must be filled in: first, observability, turning memory temperature, bandwidth utilization, and queue wait time into monitoring and alerting metrics; second, task orchestration, using a message queue or job scheduler to handle long-running tasks and avoid synchronous-call timeouts; third, a cost model, converting hardware depreciation, power, and cooling costs into cost per million tokens, then comparing against elastic cloud resources.

    If you would rather not build your own data center and cooling, a cloud route is also an option: on Baidu AI Cloud you can select memory-optimized instances, a container platform, and object storage on demand, using elastic resources to absorb peak tasks and placing long-tail batch processing in off-peak hours, which is usually more cost-effective than a one-time heavy-asset investment.

    6. Conclusion

    “Using high-capacity persistent memory when GPU memory runs out” is essentially an architectural trade-off of trading time for cost. It cannot break the laws of physics, but in offline, queueable, cost-sensitive scenarios it genuinely turns a trillion-parameter model that originally could not run into an executable batch task. The real engineering difficulty lies not in whether it can fit, but in the three “unglamorous but decisive” matters of cooling, bandwidth calibration, and scheduling design.