How to Run Trillion-Parameter LLMs with Persistent Memory When VRAM Is Not Enough
This article explains a practical engineering approach for running trillion-parameter large language models when GPU memory cannot hold the model: a tiered memory design that combines fast memory with persistent memory, application direct mode placement, low-bit quantization, and CPU inference. It covers how persistent memory works, capacity and bandwidth planning, software and threading considerations, realistic throughput expectations, engineering risks such as cooling and data integrity, and a cost evaluation method for deciding between persistent memory, more DRAM, or cloud compute. The focus is offline batch workloads rather than real-time interaction.
1. The Starting Problem: Trillion-Parameter Models Do Not Fit
When model size reaches the trillion-parameter scale, the first barrier to inference is not compute but capacity. Even with aggressive low-bit quantization, weights and runtime caches still require hundreds of gigabytes of available memory. Building that capacity from conventional DRAM modules is expensive, and motherboards often lack enough slots and channels. The VRAM on consumer or professional GPUs falls far short of the requirement.
The common industry solution is to turn “memory” from a single tier into a hierarchy: fast but small and expensive VRAM or DRAM sits at the top, while large, cheap, higher-latency persistent memory sits below, with the runtime moving data on demand. This approach is especially valuable in scenarios that do not require real-time responses, such as offline inference, batch scoring, and long-document processing.
2. Hardware Approach: Expanding the Memory Pool with Persistent Memory
Persistent memory is a medium between memory and storage. It typically comes in DIMM form factors, is byte-addressable, and retains data after power loss. It has two typical operating modes:
- Memory mode: hardware and firmware combine persistent memory and DRAM into one large memory pool. The operating system sees “more memory,” which is transparent to upper-layer software, but data consistency is guaranteed by platform mechanisms and software cannot precisely control which tier data lands in.
- Application Direct mode: persistent memory is exposed as an independent persistent region, and the runtime can explicitly decide where weight tensors are placed. This keeps truly hot data in fast memory and cold shards in the persistent region.
Running very large models typically favors the latter, because access patterns during inference are highly predictable: each layer’s weights are used only once, which is a classic streaming read that matches persistent memory’s profile of decent sequential bandwidth and higher random latency.
A simplified illustration of tiered placement (pseudocode, conveying the idea only):
# Hot data (KV cache, temporary activations) goes in fast memorykv_cache = alloc_fast_memory(max_tokens * kv_per_token)# Cold data (weight shards) is mapped read-only into the persistent regionweights = map_persistent_region(path="/mnt/pmem/model shards", mode="readonly")for layer in model.layers:w = weights[layer.index] # streamed read, used oncex = layer.forward(x, w) # activations stay in fast memory
Three engineering points matter here. First, capacity planning must leave runtime headroom, since activations, caches, and framework overhead exist beyond the weights. Second, the read/write granularity and alignment of the persistent region affect effective bandwidth, so large sequential accesses are recommended. Third, persistent media has limited write endurance, so inference should be read-mostly, and high-frequency writes such as logs and checkpoints should not be placed in the same region.
3. Software Stack: CPU Inference and Low-Bit Quantization
With no usable VRAM, inference falls back to the CPU backend. The key to CPU inference is not peak compute but memory bandwidth and cache hit rate, so the practical points include:
- Low-bit quantization: compressing weights to 1–4 bits significantly reduces capacity and bandwidth pressure, but the lower the precision, the more output quality fluctuates. A common practice is extremely low-bit quantization for weights, higher precision for activations, and mixed-precision compensation in critical layers.
- Operator and thread configuration: match thread count to physical cores and memory channels, and avoid jitter from hyperthreading and cross-NUMA access. On dual-socket platforms, weight shards and execution threads should stay on the same NUMA node to reduce cross-node memory access.
- Batching and streaming output: token-by-token autoregressive decoding is limited by the need to re-read all weights at every step, so tokens generated per second is usually very low. Increasing concurrent batch size amortizes the cost of reading weights but raises memory usage.
It should be clear that low-bit quantization is not lossless compression. Evaluation must look at both quality metrics and throughput metrics, not just whether the model runs.
4. Performance Expectations: Why It Is Slow
The combination of pure CPU and persistent memory often generates below one token per second, and speed drops further when precision increases from 1 bit to 3 bits. The reason is straightforward: a single decoding step must read all weights once, so the speed ceiling is roughly “available bandwidth divided by bytes read per step.” Generating a long text of tens of thousands of tokens can take more than ten hours.
The correct positioning of this approach is therefore offline batch processing: running data labeling, batch summarization, offline evaluation, and corpus cleaning overnight, trading time for cost. If the business needs real-time conversation, the right move is to switch to accelerator cards with large VRAM, multi-GPU parallelism, or a mature managed inference service, rather than forcing it on a CPU.
5. Easily Overlooked Engineering Risks
- Cooling: high-capacity persistent memory draws substantial power at full load. Insufficient cooling conducts heat to adjacent memory and slots, which in severe cases causes memory errors, slot deformation, or even burnout. Active air cooling is a hard requirement, airflow should blow directly over the memory area, and temperature monitoring with alerts should be in place.
- Power and motherboard compatibility: not all platforms support persistent memory, and capacity, channel count, and firmware settings all affect whether it works. Check the platform’s compatibility list before purchasing.
- Data consistency: persistent regions retain data across power loss, which is both an advantage and a risk. Keep verifiable copies of model files and validate them after loading to avoid silent corruption that produces abnormal output.
- Observability: build monitoring and logs for memory bandwidth, temperature, queue wait time, and per-token latency to help identify whether the bottleneck is bandwidth, quantization operators, or scheduling.
6. Cost and Selection Evaluation
Break total cost into four parts: media cost, platform cost (motherboard, CPU, slots), power and cooling cost, and time cost. The advantage of persistent memory lies mainly in media unit price, but trading cheap media for usable capacity requires platform support, adequate cooling, and workloads that tolerate long runtimes. A practical decision flow is: first estimate total capacity for weights and runtime, then estimate bytes read per step and target throughput, and finally calculate electricity cost as “task duration × electricity price” and compare it against buying high-speed memory or renting cloud compute.
For a cloud-based approach, you can choose a container platform to host the inference service, object storage for models and results, a message queue for task distribution, and logging and monitoring services for observability, turning heavy capital investment into elastic spending.
7. Conclusion
When VRAM cannot hold a trillion-parameter model, the viable engineering path is “tiered memory + Application Direct + low-bit quantization + CPU inference,” trading capacity for cost and time for throughput. It is not suited to real-time interaction, but it has a clear cost-performance logic in offline batch scenarios. In deployment, place cooling, compatibility, and data validation on the same level of importance as model precision, and use quantifiable capacity, bandwidth, and electricity cost models to drive selection decisions.
