lyogavin/airllm
Disk-backed layer streaming for LLMs that won't fit in GPU memory
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
AirLLM is a Python inference library built around disk-backed execution. AutoModel.from_pretrained(...) takes a Hugging Face model ID or a local path and prepares per-layer shards. During each decode step, the runtime streams those layers through the GPU rather than keeping the full checkpoint resident. Weight residency is therefore driven by layer size rather than total checkpoint size, but runtime state such as the KV cache still needs memory.
The inference code and examples sit under air_llm/. Integration uses PyTorch tensors and a Transformers-style tokenizer and generate flow. The root manifest points Transformers at Git and lists bitsandbytes==0.39.0, which is relevant to optional weight compression. That root pin is not a substitute for checking the installed package and selected model together. profiling_mode exposes timings, while the documented prefetch option overlaps loading and compute only for AirLLMLlama2.
Key Capabilities & Differentiators
AutoModel provides a common loading entry point for examples spanning Llama, Qwen, ChatGLM, Baichuan, InternLM, and Mistral. Chat models use their tokenizer's chat template, and Transformers TextStreamer can surface tokens during generation. Example VRAM figures include ~4 GB for full-precision Llama 3.x 70B and ~12 GB for DeepSeek-V3. These are configuration-specific fit figures, not throughput guarantees or universal memory budgets.
Layer streaming works without quantization. Optional 4-bit or 8-bit blockwise compression reduces the amount of weight data read; in v4.0.1 it applies only to matrices, leaving one-dimensional tensors such as norm weights and biases unquantized. Streamed LoRA is a separate fine-tuning path for the supported Qwen variants: frozen base weights stream from disk, adapters stay on GPU, and the example scripts accept either plain-text training records or instruction pairs with loss applied only to the completion.
Trade-offs & Limitations
Choose AirLLM when running a specific checkpoint matters more than generation speed. GPU-resident runtimes avoid rereading weights at every decode step, so a smaller model or an acceptable quantized checkpoint that fits in VRAM is a better starting point for interactive or concurrent inference. AirLLM frees up VRAM at the cost of storage reads and weight transfers; compression can reduce bytes read, but it does not remove that per-step work. Streaming text makes progress visible, not faster.
Size the system with separate budgets for peak disk usage during conversion, host memory, GPU runtime state, and sustained read bandwidth. A low VRAM figure alone does not establish that the model fits the whole machine or meets latency targets. Benchmark with the actual checkpoint, prompt lengths, and expected concurrency. AirLLM is Apache-2.0, but checkpoint licenses and gated-access terms must be reviewed separately.
Hardware & Deployment Guide
Start with pip install airllm in a Python environment with PyTorch and a working GPU runtime for the chosen platform. Install a compatible bitsandbytes build if using compression. Local checkpoints avoid fetching model weights at startup; for gated Hugging Face downloads, pass hf_token. Initial conversion needs space for the original files and new shards. Use layer_shards_saving_path to place shards on an appropriately sized drive. Enable delete_original only if you are willing to remove the source copy. On macOS, the MLX and PyTorch path is Apple Silicon only and limited to LlamaForCausalLM and MistralForCausalLM.
v3.3.0 added Flash-Next streaming with its n-gram table mapped from a file on the host. v4.0.0 introduced streamed LoRA; the Flash-Next path needs a Transformers build that includes qwen4_exp. v4.0.1 corrected the NF4 free-space check to multiply by the estimated compressed size ratio (~0.28×), rather than divide by it. For a reproducible rollout, record the working package versions and model revision, then smoke-test both initial shard creation and generation before staging a large checkpoint.
AutoModel.from_pretrained accepts Hugging Face IDs and local paths; layer_shards_saving_path selects where converted shards go.profiling_mode reports timing; configurable prefetching is documented only for AirLLMLlama2.LlamaForCausalLM and MistralForCausalLM.Local model evaluation and occasional generation on a single GPU when the required checkpoint exceeds VRAM and sufficient disk capacity and bandwidth are available.
You need predictable interactive latency, sustained concurrent throughput, or a turnkey HTTP service, or an acceptable model already fits entirely in VRAM.
Quick Start & Installation
pip install airllmComparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| airllm ★ | 43.9k | +344 | Jupyter Notebook | Apache-2.0 | Disk-backed layer streaming for LLMs that won't fit in GPU memory |
| ollama | 189k | +703 | Go | MIT | Go-based LLM serving layer for local model management and inference |
| BitNet | 42.6k | +106 | C++ | MIT | Native C++ kernels for running compatible 1.58-bit LLMs on local CPUs |
| nano-vllm | 16.7k | +95 | Python | MIT | A compact vLLM-style Python engine for offline GPU batch inference |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/lyogavin/airllm.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about airllm
Is AirLLM a drop-in replacement for an HTTP inference server?
AutoModel.from_pretrained with a Hugging Face model ID or a local checkpoint path, then use the tokenizer and generate. For chat models, apply the tokenizer's chat template. TextStreamer prints tokens as they arrive; it does not expose a network endpoint.Does the ~4 GB figure for a 70B model tell me what hardware to buy?
Can I use or redistribute AirLLM in a commercial self-hosted product?
When should I use AirLLM instead of a quantized model that fits in VRAM?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy