How to Run Trillion-Parameter Models on Persistent Memory When GPU Memory Runs Out
This article explains how to run trillion-parameter models on a single server when GPU memory capacity becomes the bottleneck. It covers a capacity-first storage tier design using persistent memory, the four-stage CPU-only inference pipeline, the trade-offs between low-bit quantization, precision, and throughput, and the engineering risks around cooling, power, and stability. It also outlines which workloads fit this offline approach and offers a decision checklist for evaluating whether it matches your latency and throughput requirements.
1. The Real Bottleneck at Trillion-Parameter Scale Is Capacity, Not Compute
When a model reaches the trillion-parameter range, the first constraint to surface is usually capacity rather than compute. Even with aggressive low-bit quantization, weights can still occupy hundreds of gigabytes, which already exceeds the total GPU memory available on most single machines. Splitting the model across multiple cards is possible, but it introduces communication overhead, shard-tuning complexity, and a larger failure domain.
This leads to a counter-intuitive route: since accelerator memory is expensive and limited in capacity, can we fit all the weights into a single machine using a larger, lower-cost memory medium and run inference on the CPU? This approach trades speed for two things: very low capacity cost and engineering simplicity.
The positioning must be clear: this is not a real-time conversational solution. It targets offline tasks that can tolerate waiting.
2. A Capacity-First Storage Tier Design
Capacity-constrained deployments commonly adopt a tiered design:
- Tier 1: High-speed cache and local memory near the compute units, holding the tensor shards currently being computed.
- Tier 2: Large-capacity persistent memory, acting as an extensible “slow memory” tier that holds the vast majority of the weights.
- Tier 3: Block or object storage for cold data, checkpoints, and dataset archives.
The value of persistent memory lies in combining byte-addressability with large capacity. Unlike traditional block devices, it does not require fixed block-size translation through a block device driver. Compared with conventional memory modules, it offers a lower cost per unit of capacity. Together, these properties make it feasible to place a model directly into the memory address space.
There are two common configuration modes. In one, persistent memory extends conventional memory capacity transparently to upper-layer software. In the other, application-direct mode exposes persistent memory as an independent persistent region, leaving the software to decide which tier data lives in. The latter offers more control but requires the program to manage data placement explicitly.
The following is a schematic abstraction of the tiered access logic (not a specific API, only illustrating the idea):
# Pseudocode: decide tensor placement by hot/warm/cold accessHOT, WARM = "local_memory", "persistent_region"def place(tensor):if tensor.access_frequency == "high":return HOT # high frequency: keep in local memoryreturn WARM # low frequency: place in the large persistent regiondef forward(layer):weights = place(layer.weights)return matmul(layer.input, weights) # placement is transparent to compute
3. The CPU-Only Inference Pipeline
Running an ultra-large model purely on CPU can be broken into four stages:
- Weight loading: read quantized weights from storage into the persistent region and establish an addressable mapping.
- Chunk scheduling: split weights into cache-friendly blocks by layer or operator, avoiding touching all data at once.
- Compute: perform matrix multiplication on CPU vector units using low-bit weights with dequantization.
- Write-back: write intermediate activations and generated results back, persisting them when needed to support resume-from-checkpoint.
The deciding factor for performance is not how many cores the CPU has, but how many bytes must be moved per generated token. With a fixed total weight size, memory bandwidth and medium latency directly set the ceiling. This is why throughput in such systems is often below one token per second: a task generating fifty thousand tokens taking more than ten hours is normal behavior, not a misconfiguration.
4. Trading Precision for Throughput
Low-bit quantization is a prerequisite for this route. The common patterns are:
- The lower the bit width, the smaller the weights and the more parameters that fit.
- The lower the bit width, the more noticeable the quality loss from dequantization and accumulated error.
- Raising the bit width from extremely low to slightly higher increases size only modestly, but may further reduce speed.
The practical recommendation is to first use a small evaluation set to confirm the minimum acceptable precision, then work backward to a capacity budget, rather than buying hardware first and picking precision afterward.
5. Engineering Risks: Cooling, Power, and Stability
Large-capacity persistent memory draws significant power and generates considerable heat at full load, and this is the most commonly underestimated factor. Engineering must ensure:
- Active cooling: provide forced airflow for the memory region to prevent heat from accumulating inside the chassis.
- Thermal isolation: temperature-sensitive memory modules should not sit directly next to high-heat media, or they may be damaged as a side effect and, in extreme cases, the slot itself may be harmed.
- Power headroom: size the system power supply for peak rather than average load, with sufficient margin.
- Monitoring and alerts: set threshold alerts for temperature, power, and error counts, and reduce load or shut down on anomalies.
To achieve similar capabilities in the cloud, you can typically combine general-purpose services: use a container platform to host the inference process, monitoring and alerting to collect temperature and throughput metrics, object storage to hold checkpoints, and a logging service to retain the execution trace of long-running tasks. For this kind of offline batch inference, Baidu AI Cloud also recommends making architecture choices on the premise of “capacity and cost first, latency-insensitive.”
6. Applicability and a Decision Checklist
Suitable scenarios: overnight offline batch processing, batch dataset labeling and cleaning, long-document summarization and archiving, evaluation regression, and data generation for model distillation.
Unsuitable scenarios: online customer service, code completion, and any interaction that requires a first-token response within seconds.
Decision checklist:
- Is the target latency greater than minutes?
- Has the total weight size been precisely estimated at the target precision?
- Do you have forced-air cooling and temperature monitoring?
- Have you designed for resume-from-checkpoint and failure retries?
- Can you accept throughput below one token per second?
7. Conclusion
“Use large-capacity persistent memory when GPU memory is insufficient” is essentially trading time for capacity and engineering rigor for stability. It reminds developers that the first-order problem in deploying large models is often capacity and cost, not peak compute. Get these four things solid—tiered storage, low-bit quantization, cooling and power, and offline scheduling—and a trillion-parameter model can run on an ordinary server, as long as you are willing to wait.
