How to Run Trillion-Parameter LLMs When You Don't Have Enough VRAM

    This article explains how to run trillion-parameter large language models when GPU memory is insufficient. It covers why capacity, not compute, is the first bottleneck, how to build a tiered memory architecture that places weights by access frequency, and how persistent memory, memory mapping, and quantization trade bandwidth and time for capacity. It also addresses cooling, power, realistic throughput expectations, and a reusable low-cost inference checklist for offline workloads.

    1. Where the Problem Starts: Why Trillion-Parameter Models Fail on Capacity First

    The first constraint in LLM inference is not compute but capacity. A 2.8-trillion-parameter model, even with extreme 1-bit quantization, still has a theoretical weight size in the hundreds of gigabytes. Real deployment also adds KV Cache, runtime buffers, framework overhead, and page-alignment loss. As a result, “at least 600GB of usable memory” is a practical floor, not a comfortable margin.

    There is an engineering fact that is often overlooked: when capacity is insufficient, the system does not degrade gracefully. It either fails outright or starts swapping heavily. A VRAM overflow triggers allocation failures; with a unified memory mechanism, it shows up as a throughput collapse. So the first step is not to pick the fastest hardware, but to work out the triangle of capacity, bandwidth, and cost.

    2. Memory Tiering: Put Weights at the Right Level

    A workable architecture usually has three tiers:

    • Compute tier: CPU or accelerators, responsible for matrix multiplication and attention computation;
    • High-speed tier: local memory, holding hot layers, KV Cache, and temporary tensors;
    • Large-capacity tier: persistent or remote memory, holding cold weights.

    The key principle is to place data by access frequency. High-frequency operators such as attention and normalization should stay in the high-speed tier as much as possible; the large weight blocks in feed-forward layers can be streamed in layer by layer. In engineering, memory mapping maps weight files directly into addressable regions, avoiding a full one-time copy:

    1. import mmap, numpy as np
    2. with open("weights.bin", "r+b") as f:
    3. mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
    4. # Read layer i on demand, avoiding a full load
    5. layer = np.frombuffer(mm, dtype=np.uint8, count=size_i, offset=offset_i)

    The sample code only illustrates the idea of mapping on demand and fetching layer by layer. The actual offsets and types depend on the weight format.

    3. Persistent Memory: A Realistic Option for Low-Cost, High Capacity

    Second-generation persistent memory modules have a large supply in the second-hand market, with common per-module capacities from 128GB to 512GB. Fully populating multiple channels can easily cross the TB threshold, at a cost significantly lower than traditional memory of the same capacity. There are two typical ways to use it:

    • Memory mode: transparent to upper layers, with larger capacity but performance limited by the medium;
    • Application-direct mode: exposes the device as a separate persistent region, with software explicitly deciding where data lands.

    For inference, application-direct mode is more controllable: weights reside in the persistent region as files and are mapped into the address space layer by layer at runtime, while the OS page cache and prefetch policy determine the actual pace of data movement. It is worth emphasizing that the write endurance and read latency of this medium differ from traditional memory. It should be used in a “read-mostly, write-rarely” manner, and high-frequency mutable state should not be placed on it.

    4. Quantization and Precision: Trading Bandwidth for Capacity

    Quantization is the first lever for the capacity problem. 1-bit quantization compresses weights to the limit, at the cost of precision loss and more complex dequantization computation; 3-bit quantization is a compromise between quality and size. The empirical rule is that each drop in bit width significantly reduces capacity pressure, but increases the number of decoding instructions executed per token, so speed may actually be slower.

    Therefore, “more memory-efficient” and “faster” are not equivalent. If the goal is offline throughput, low-bit quantization can be prioritized; if output quality is sensitive, go back to higher bits and accept longer runtime.

    5. Cooling and Power: An Underrated Hard Constraint

    Large-capacity persistent memory draws non-trivial power at full load, with concentrated heat that is hard to dissipate. In practice, three things must be done:

    1. Active air cooling: add directional fans to the memory area to create stable airflow;
    2. Temperature monitoring: place temperature sensors near memory and motherboard slots, with threshold alerts;
    3. Power verification: confirm that the PSU’s 12V output and the motherboard’s power phases can support full load.

    When cooling is insufficient, high temperature conducts to adjacent memory and slots, and in extreme cases causes irreversible damage. Treating cooling as “optional” is the most common reason such setups fail.

    6. Performance Expectations: Calculate Latency Before Deciding

    With a pure CPU, low-bit, large-capacity medium combination, inference speed is typically below one token per second. Generating 50,000 tokens means more than ten hours. This is not something tuning can solve; it is an architecture-positioning issue:

    • Real-time conversation: not applicable;
    • Late-night offline batch processing, data labeling, long-document summarization: cost-effective.

    The decision formula can be simplified to: is it acceptable = does the task have a hard latency requirement. If not, trading time for cost is valid.

    7. Deployment Advice: A Reusable Low-Cost Inference Checklist

    • Do a capacity budget first: weight size + KV Cache + runtime overhead, with 20% headroom;
    • Then assess bandwidth: confirm the high-speed tier can cover the hot layers;
    • Layer the quantization strategy: high precision for sensitive layers, low bits for redundant layers;
    • Prefer application-direct mapping, loading layer by layer;
    • Put cooling and monitoring in place before powering on and stress testing;
    • Use a queue to take on offline tasks, with logging and monitoring alerts for long-running task tracking.

    If a cloud approach is used, large model weights can be placed in object storage and pulled on demand by a container platform, with a message queue handling task queuing and logging and monitoring alerts providing observability for long-running tasks, balancing elasticity and cost.

    8. Conclusion

    The threshold for trillion-parameter models is essentially an economics problem of capacity and bandwidth. When VRAM is insufficient, the right approach is not to pile on the most expensive hardware, but to restructure memory tiering, trade quantization for space, trade time for cost, and include cooling and observability in the design baseline.