CPU-Only LLM Inference with Persistent Memory: Running a 2.8-Trillion-Parameter Model
A community member reports running a 2.8-trillion-parameter large language model on a home lab server with no discrete GPU. The setup uses a 40-core server CPU and discontinued persistent memory modules. The article covers the memory configuration, quantization and caching changes, measured token generation speeds, and the bottlenecks that limit this approach.
1. Persistent Memory and the Memory Limits of Very Large Models
To understand the technical basis of this experiment, it helps to first review what persistent memory is. Traditional dynamic random-access memory (DRAM) offers very high read and write speeds, but its capacity is limited and its contents are lost when power is removed. NVMe solid-state drives (SSDs) offer large, non-volatile capacity, but their read and write latency is higher. Persistent memory fills the gap between the two. Built on non-volatile memory architectures such as 3D XPoint, it offers lower latency and higher bandwidth than SSDs, and individual modules can reach 128 GB to 512 GB or more.
A model with 2.8 trillion parameters needs hundreds of gigabytes or even terabytes of memory, even with aggressive quantization. Consumer and entry-level server motherboards rarely provide enough DRAM slots or capacity for that. Persistent memory offers large capacity for model weights and context caches, which makes it a lower-cost alternative to expensive GPU memory.
2. Architecture: A CPU-Only Inference Setup
The setup uses a 40-core, 3rd-generation server-grade multi-core CPU platform with several large-capacity persistent memory modules. At the software level, it uses a widely used open-source inference framework optimized for CPUs.
The key to the hardware and system configuration is the memory mode. Persistent memory typically supports several operating modes. This experiment used App Direct mode. In this mode, DRAM and persistent memory do not merge into a single unified virtual memory pool. Instead, software sees them as two separate memory pools. This gives software control over where data is placed. Frequently accessed hot data can stay in fast DRAM, while large cold data such as model weights can sit in persistent memory. This balances capacity and speed.
3. Performance Optimization: Quantization and Caching
On a CPU with large persistent memory, inference speed is mainly limited by memory bandwidth. To run the model on this limited hardware, the experimenter used two key techniques: model quantization and changes to caching.
1. Quantization
Quantization reduces the precision of model parameters, which lowers memory use and computation. The experimenter tested both 1-bit and 3-bit quantization. 1-bit quantization compresses the model as much as possible and greatly reduces the memory bandwidth needed to read it. 3-bit quantization retains more model precision, but its more complex data structure did not improve speed in a CPU-only environment.
2. Caching
At the start of testing, direct access (DAX) was enabled. This feature lets applications bypass the operating system’s page cache and read and write persistent memory directly. It reduces memory copy overhead. However, in LLM inference, the system lacks intelligent cache scheduling, so frequently accessed token generation data cannot benefit from fast DRAM caching.
The experimenter then disabled direct access. This restored the operating system’s file system cache, so frequently used data was cached automatically in DRAM. The change produced an immediate speed improvement. It confirmed that a hot-data cache layer built on top of slower, high-capacity storage is necessary.
4. Measured Results and Bottleneck Analysis
The setup made the model run, but the measured performance is still at the hobbyist experiment stage and does not meet production standards.
With 1-bit quantization and direct access enabled, the model generated about 0.85 tokens per second. After direct access was disabled and hot data could use the DRAM cache, speed rose to 1.50 tokens per second, an increase of about 76%. In a separate 3-bit quantization test, speed dropped to 0.75 tokens per second. At that rate, generating 50,000 tokens would take about 18.5 hours.
Two factors mainly limit this slow generation speed. First, persistent memory bandwidth is far lower than the memory bandwidth of modern GPUs, such as HBM, so it cannot supply the data throughput that large matrix operations in LLM inference require. Second, CPUs lack the highly parallel compute units designed for GPUs, such as Tensor Cores, for tensor calculations.
5. Conclusion and Outlook
Although the speed falls short of practical expectations, the experiment is technically meaningful. It shows that without expensive GPUs, a large-capacity persistent memory and multi-core CPU setup can exceed GPU memory limits and load and run a model with trillions of parameters. For offline batch jobs, model evaluation, or personal research where latency is not a concern, this approach offers a very low-cost option.
In broader industry use, enterprises could apply this approach with Baidu AI Cloud’s general-purpose compute instances, object storage, and container platform to build a hybrid storage architecture. Intelligent scheduling would cache hot data in high-bandwidth memory and move cold data to cost-effective storage media. This could help control costs while improving LLM inference efficiency. As memory interface technologies and CPU instruction sets continue to evolve, the performance of running very large models on CPUs may see further improvement.
