
AirLLM
Run huge LLMs on low-end GPUs with minimal VRAM
Replaces Hugging Face Inference Endpoints, Google Vertex Ai Prediction, Fireworks Ai

Who it's for
Developers who want to build and test applications using large language models but only have access to GPUs with limited VRAM (e.g., 4GB, 8GB) can use AirLLM to run powerful models locally.
User has access to high-VRAM GPUs (e.g., 24GB+) or cloud-based inference services.
Researchers exploring new LLM architectures or fine-tuning existing ones can leverage AirLLM to conduct experiments with larger models on more affordable or available hardware, reducing computational costs.
Research primarily focuses on model training from scratch on large clusters, where VRAM is not a bottleneck.
For deploying LLMs on edge devices or embedded systems where memory and computational resources are severely constrained, AirLLM provides a viable solution to run complex models efficiently.
Deployment targets are high-performance servers or cloud environments with ample resources.
Individuals interested in running the latest open-source LLMs on their personal computers (including Apple silicon Macs) for personal projects, learning, or local AI agents, without needing to purchase expensive professional-grade GPUs.
User is only interested in using cloud-based LLM APIs and does not require local inference.
The problem
The concrete problem AirLLM solves is the high VRAM requirement of large language models, which typically restricts their inference to expensive, high-end GPUs. This limitation prevents developers, researchers, and hobbyists with commodity hardware or edge devices from easily experimenting with, developing, or deploying state-of-the-art LLMs due to prohibitive hardware costs.
How it works
AirLLM allows large language models, including 70B Llama 3.x and 2.8T Kimi K3, to run on GPUs with as little as 4GB of VRAM by streaming one layer or expert at a time.
Implements block-wise quantization-based model compression, which can speed up inference by up to 3 times with almost ignorable accuracy loss.
Supports virtually all popular open LLMs from Hugging Face, including Llama, Qwen, DeepSeek, Mistral, Mixtral, Phi, Gemma, ChatGLM, Baichuan, InternLM, and Yi, through a unified AutoModel interface.
Enables running large language models on Apple silicon devices, making it accessible to a wider range of users.
Provides various configurations such as 4bit/8bit compression, profiling mode, custom layer saving paths, Hugging Face token integration for gated models, prefetching, and an option to delete original models to save disk space.
Features
- Ultra-low VRAM Inference
- 3x Inference Speedup with Compression
- Broad LLM Compatibility
- MacOS Support
- Flexible Configuration Options
How to install
pip install airllm
Recommended for this setup
Strengths
- Exceptional VRAM Efficiency: Dramatically reduces memory usage, allowing very large models (e.g., 70B, 405B, 671B, 2.8T) to run on GPUs with significantly less VRAM than typically required.
- Performance Boost: Offers up to a 3x inference speedup through an optional block-wise quantization-based model compression, enhancing efficiency without major accuracy degradation.
- Wide Model Ecosystem Support: Compatible out-of-the-box with a vast array of popular open-source LLMs from Hugging Face, simplifying integration and usage across different models.
- Ease of Use: Provides a straightforward AutoModel.from_pretrained() interface, making it easy to load and run various models with minimal code changes.
- Accessibility: Extends LLM inference capabilities to more accessible hardware, including commodity GPUs and Apple silicon Macs, democratizing access to advanced AI.
Trade-offs
- Disk Space Requirement: The process of splitting and saving models layer-wise during inference can be disk-intensive, requiring sufficient disk space in the Hugging Face cache directory.
- Specific Dependencies for Kimi K3: Running Kimi K3 requires specific installations like compressed-tensors, flash-attn (CUDA 12 build), and transformers 4.56.x, which might introduce compatibility challenges.
- MacOS Hardware Limitation: MacOS support is currently limited to Apple silicon devices, excluding Intel-based Macs.
- Prefetching Limitation: Prefetching, which improves speed, is currently only supported by AirLLMLlama2 and not universally across all model types.
Tech stack
FAQ
This error most likely indicates that you have run out of disk space. The process of splitting and saving models layer-wise is very disk-consuming. You may need to extend your disk space or clear the Hugging Face cache.
This error typically occurs if you are trying to load Qwen or ChatGLM models using a Llama2 class. Ensure you use from airllm import AutoModel and then AutoModel.from_pretrained(...) to automatically detect the model type.
Some models are gated on Hugging Face and require an API token. You can provide your Hugging Face API token using the hf_token argument when initializing the model, for example: model = AutoModel.from_pretrained("meta-llama/Llama-2-7b-hf", hf_token='HF_API_TOKEN').
If a model's tokenizer lacks a padding token, you can either set one or, more simply, turn off the padding configuration by setting padding=False in your tokenizer call: input_tokens = model.tokenizer(input_text, ..., padding=False).