AirLLM is a library designed to enable the inference and training of massive large language models (LLMs) on hardware with limited VRAM by streaming model layers from disk to the GPU one at a time. By keeping only a single layer resident in video memory, the framework significantly reduces memory requirements without necessitating quantization, distillation, or pruning. For instance, the library can run a 70B Llama 3 model on just 4GB of VRAM, the 671B DeepSeek-V3 on approximately 12GB, and the 2.8T Kimi K3 model on under 4GB. For specialized architectures like the 125B Qwen3.8-Flash-Next MoE, it utilizes file-mapping for the 51B n-gram embedding and streams decoder layers to achieve a memory footprint of 5.95GB on an RTX 4090. Beyond inference, AirLLM supports training via a streaming method where frozen weights are loaded layer-wise while adapters remain on the GPU; this allows for training the 125B Qwen3.8-Flash-Next on 6GB of VRAM (e.g., an RTX 3060 Ti) and the 27B Qwen3.8 dense model on roughly 2GB at a sequence length of 512. The library also supports 4-bit and 8-bit block-wise quantization to further accelerate inference speeds by up to 3x.

Read original