AirLLM: Running 70B+ Foundation Models on 4GB to 8GB GPUs

Layer-by-Layer Offloading, Memory Compression, and Production Reality


1. Executive Summary: The Memory Bottleneck

Running a 70-Billion parameter foundation model in 16-bit precision requires over 140 GB of GPU VRAM—typically demanding two to four enterprise NVIDIA A100 or H100 GPUs costing upwards of $30,000 to $80,000.

AirLLM is an open-source inference library that shatters this barrier:

flowchart LR
    SSD["Fast NVMe SSD\n(70B Weights: 70GB - 140GB)"] -->|1. Stream Layer N| RAM["Host System RAM"]
    RAM -->|2. PCIe Transfer| VRAM["GPU VRAM (4GB - 8GB)\n(Only Active Layer N Loaded)"]
    VRAM -->|3. Compute Forward Pass| GPU["CUDA Tensor Cores"]
    GPU -->|4. Free Layer N & Repeat| SSD

2. The Core Mechanism: Layer-by-Layer Inference

Standard inference engines (like vLLM or Ollama) load all 80 transformer layers into GPU memory at startup. When VRAM runs out, the operating system throws an Out-Of-Memory (OOM) error.

In contrast, AirLLM decomposes the neural network:

  1. Model Sharding: Weights remain on local NVMe disk in compressed safetensors format.
  2. Sequential Streaming: Layer 1 is read from disk into host RAM, transferred across the PCIe bus into GPU VRAM.
  3. Execution: The input hidden states are multiplied by Layer 1 weights.
  4. Immediate Deallocation: Layer 1 is unloaded from VRAM, and Layer 2 is streamed in.
  5. Output: After traversing all 80 layers, the single output token is generated.

3. The Honest Trade-Offs: When to Use & When to Skip