Open-source layer-wise inference

AirLLM-Runs Models on Modest Hardware

AirLLM streams model weights one layer at a time. Run compatible 70B models on a 4 GB GPU and process prompts locally after setup.

4 GBVRAM for 70B
405Bon 8 GB VRAM
3×faster with compression
AirLLM running a 70B model in a terminal with 3.71 GB peak VRAM
Layer 47 of 83loaded · computed · released
Peak VRAM 3.71 GB70B model, 4-bit shards
AirLLM AutoModel Python example in a code editor
What is AirLLM

A memory-light engine for very large language models

AirLLM is an open-source Python library that runs inference on large language models without loading the whole model into GPU memory.

Instead of holding every parameter at once, AirLLM splits a model into its individual transformer layers, stores them as shards on your SSD and moves them through the GPU one after another. Each layer is loaded, computed and released before the next arrives, so peak memory equals one layer plus a small set of activations. The result is striking: models that normally demand data-centre hardware run on an ordinary desktop or laptop.

Created by the developer lyogavin and released under the Apache-2.0 licence, AirLLM AI works with Llama, Qwen, DeepSeek, Mistral, ChatGLM, Gemma, Phi and, from version 3.1, Moonshot AI's 2.8-trillion-parameter Kimi K3.

Apache-2.0Free and open source
Pythonpip install AirLLM
v3.1FP8 and MoE support
Features

Everything AirLLM brings to modest hardware

Six capabilities that turn an everyday GPU into a workbench for frontier-scale models.

CORE

Layer-wise inference

AirLLM keeps only a single transformer layer in VRAM at any moment. A 70B model whose weights total around 140 GB runs within roughly 4 GB of graphics memory, and the results match conventional inference because every layer still performs exactly the same calculation.

peak VRAM ≈ largest layer + activations
SPEED

Block-wise 4-bit and 8-bit compression

Compress stored weights to shrink every shard. Because AirLLM quantizes weights only and keeps activations at higher precision, accuracy loss stays small while disk reads fall sharply, delivering up to three times faster generation.

AutoModel.from_pretrained(repo, compression="4bit")
THROUGHPUT

Smart prefetching

While the GPU computes one layer, AirLLM already reads the next from disk. Overlapping input and computation keeps the graphics card busy and trims idle time from every token. It is enabled by default.

prefetching=True  # default
SIMPLICITY

One AutoModel for every family

A single loader detects the architecture and selects the right implementation, whether you point it at Llama 4, Qwen3, DeepSeek-V3, Mixtral, Phi-4, Gemma or a local fine-tuned checkpoint.

from airllm import AutoModel
SCALE

Expert-level MoE streaming

For mixture-of-experts models, AirLLM loads only the experts the router selects for each token. That is how DeepSeek-V3 (671B), Qwen3-235B and the 2.8T-parameter Kimi K3 become reachable on consumer hardware.

router → top-k experts → load → compute → release
PLATFORMS

Linux, Windows and macOS

Run with NVIDIA CUDA on Linux and Windows, with the MLX backend on Apple silicon Macs, or on CPU when no GPU is available. The same Python code works across all of them with minimal changes.

CUDA · MLX · CPU
How it works

A model on a conveyor belt

Every token travels through the same four-stage loop, layer after layer, until the next word appears.

01

Split

On first use, AirLLM divides the checkpoint into per-layer shards and saves them to your fastest drive.

02

Load

The next layer's weights move from SSD into GPU memory, while prefetching prepares the one after it.

03

Compute

The GPU runs that layer and hands a small set of activations to the next stage.

04

Release

The layer is freed, memory returns to its baseline and the loop continues until the token is complete.

Why memory stays flat

Transformer layers depend only on their own weights and the output of the layer before them. AirLLM exploits that independence: no layer needs its neighbours in memory, so VRAM use is set by the single largest layer rather than the whole model.

time per token ≈ total shard size ÷ disk read speed

The trade-off is time. Each new token reads every layer again, which is why fast NVMe storage and compression matter far more for AirLLM speed than raw GPU power.

nvidia-smi showing AirLLM using 3.7 GB of a 4 GB GPU while streaming layers
Installation

From zero to first token in four steps

AirLLM installs like any Python package. Prepare a clean environment, add CUDA-enabled PyTorch and you are ready.

Terminal output of pip install AirLLM completing successfully
  1. Create a virtual environment

    Keep AirLLM's dependencies separate from other projects. Python 3.10 or 3.11 is the most reliable choice.

    python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate
  2. Install PyTorch with CUDA

    Use the official index that matches your NVIDIA driver, then confirm the GPU is visible. Mac users can skip this step.

    pip install torch --index-url https://download.pytorch.org/whl/cu124 python -c "import torch; print(torch.cuda.is_available())"
  3. Install AirLLM

    Add bitsandbytes if you plan to use 4-bit or 8-bit compression. To work from source, extract the ZIP and run pip install -e . inside air_llm.

    pip install -U airllm pip install -U bitsandbytes # optional, for compression
  4. Run your first model

    Start with a 7B model to confirm everything works, then move up to 70B and beyond.

    from airllm import AutoModel model = AutoModel.from_pretrained("Qwen/Qwen2.5-7B-Instruct") ids = model.tokenizer(["Hello, airllm!"], return_tensors="pt")["input_ids"].cuda() out = model.generate(ids, max_new_tokens=30, use_cache=True, return_dict_in_generate=True) print(model.tokenizer.decode(out.sequences[0]))
Use cases

Where AirLLM earns its place

AirLLM favours depth over speed. These are the situations where that trade pays off.

Private local assistant built on AirLLM summarising a contract
Privacy

Confidential document analysis

Lawyers, clinicians and analysts can ask a 70B model about sensitive files without uploading a single word. Once the weights are downloaded, AirLLM runs fully offline.

Benchmark notebook comparing AirLLM compression modes
Research

Evaluating large models on a budget

Benchmark Llama, Qwen or DeepSeek at original precision on a university workstation instead of waiting for scarce cluster time.

Overnight AirLLM batch job summarising reports
Automation

Overnight batch processing

Queue hundreds of summaries, classifications or translations before leaving the office and collect high-quality results in the morning.

Chart showing flat VRAM usage across 83 AirLLM layers
Learning

Teaching how LLMs really work

Students can watch memory stay flat while layers stream, making transformer architecture tangible on classroom hardware.

AirLLM download

Get the official AirLLM source

Download the latest main-branch archive straight from the official GitHub repository. It includes the Python package, setup script, README and example notebooks.

  • Packageairllm-main.zip
  • LicenceApache-2.0, free
  • PlatformsLinux · Windows · macOS
  • RequiresPython 3.9+ and PyTorch

Prefer pip? Run pip install airllm instead.

Compatibility & comparison

Where AirLLM runs and how it compares

AirLLM complements tools such as Ollama rather than replacing them. The right choice depends on model size and how long you can wait.

Linux + NVIDIA CUDAWindows 10 / 11 + CUDAmacOS on Apple silicon (MLX)CPU-only (slow)WSL2
AspectAirLLMOllamallama.cppvLLM
VRAM for a 70B model≈ 4 GB≈ 40 GB+ at 4-bit≈ 40 GB+ or CPU offloadMultiple large GPUs
Generation speedSlow, disk-boundFastFast to moderateVery fast
Model formatHugging FaceGGUFGGUFHugging Face
Quantization requiredNo, optionalUsuallyUsuallyOptional
InterfacePython libraryCLI, API, appCLI, serverServer, API
Best forHuge models, small GPUsEveryday local chatLightweight local useProduction serving
Troubleshooting

Quick fixes for common AirLLM issues

Most problems trace back to the PyTorch build, free disk space or storage speed. Open an issue to see the fix.

CUDAtorch.cuda.is_available() returns False
A CPU-only PyTorch build is installed. Uninstall torch and reinstall it from the official CUDA index, for example --index-url https://download.pytorch.org/whl/cu124, then update your NVIDIA driver if needed.
OOMCUDA out of memory on a 4 GB card
Close other GPU applications, lower max_length and max_new_tokens, enable compression="4bit" and set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True.
DISKProcess stops while splitting layers
The drive has run out of space. Point layer_shards_saving_path to a larger NVMe drive, delete partial shard folders and retry. delete_original=True frees space after a successful split.
401Gated repository or unauthorised error
Accept the model licence on Hugging Face, create a read token and pass it with hf_token="hf_...".
SLOWMinutes per token on a mid-sized model
Move shards from HDD or network storage to NVMe, exclude the folder from antivirus scanning, enable 8-bit or 4-bit compression and use a performance power plan.
LIBbitsandbytes import error
Install or upgrade it inside the same environment with pip install -U bitsandbytes, or remove the compression argument if you do not need it.
System requirements

Hardware that keeps AirLLM comfortable

Storage speed shapes the experience more than any other component.

ComponentMinimumRecommendedIdeal for MoE giants
GPUNVIDIA 4 GB VRAM or Apple M1NVIDIA 8 GB or Apple M-series 16 GB+NVIDIA 12–24 GB
StorageSATA SSDNVMe Gen3, 3 GB/sNVMe Gen4/Gen5, several TB
Free disk space2× model size2× model size + 20%Multiple terabytes
System RAM16 GB32 GB64 GB or more
SoftwarePython 3.9, PyTorchPython 3.10/3.11, CUDA 12.xLatest AirLLM release
Operating systemLinux, Windows 10, macOS 13Ubuntu 22.04+, Windows 11, recent macOSLinux on a dedicated workstation
Planning tip: during the first run, the original weights and the generated shards coexist on disk. For a 70B model at 16-bit precision, keep about 300 GB free; 4-bit compression reduces the shards to under 40 GB.
Safety

Is AirLLM safe to use?

AirLLM is open-source, readable and runs entirely on your own hardware, which makes it one of the more transparent ways to use large models.

  • Open code under Apache-2.0. The package is small enough to review yourself, and its development history is public on GitHub.
  • Local by design. After the model download, prompts and answers stay on your machine. Set HF_HUB_OFFLINE=1 for strictly offline use.
  • Download from official sources only. Use the GitHub archive linked on this page or PyPI, never re-uploaded copies.
  • Prefer safetensors weights. They cannot execute code when loaded, unlike older pickle-based formats.
  • Isolate with a virtual environment. Keep dependencies contained and update them regularly.
Verifying the AirLLM source with sha256sum and pip show
Runs fully offlineafter the first model download
Pros and cons

An honest look at AirLLM

Strengths

  • Huge models on small GPUs: 70B on 4 GB, 405B on 8 GB.
  • Original precision available: no mandatory quantization, distillation or pruning.
  • Private and offline: nothing leaves your computer.
  • Free and open source under Apache-2.0.
  • Broad model support through a single AutoModel loader.
  • Cross-platform: CUDA, Apple silicon and CPU.

Limitations

  • Slow generation: seconds to minutes per token for large models.
  • Heavy disk use: needs fast NVMe and generous free space.
  • No built-in interface: it is a Python library, not an app.
  • Long first run while weights download and split.
  • Unsuitable for real-time chat with very large models.
  • No GGUF support: needs Hugging Face checkpoints.
FAQs

Questions people ask about AirLLM

AirLLM is an open-source Python library that runs very large language models on small GPUs. It loads one transformer layer at a time instead of the whole model, so a 4 GB graphics card can run a 70B model.

Yes. AirLLM is released under the Apache-2.0 licence, so it is free for personal and commercial use. Individual models you load carry their own licences, which you should check separately.

Use the download section on this page, which links to the official main-branch ZIP on GitHub, or install the published package with pip install airllm.

No. AirLLM is the inference engine. Models are downloaded separately from Hugging Face the first time you load them, or read from a local folder.

Import AutoModel, call from_pretrained with a model repository name, tokenise your prompt and call generate. The installation section shows a complete working example.

No. AirLLM AI refers to the software that runs models. The answers come from whichever model you load, such as Llama, Qwen or DeepSeek.

Only to download packages and model weights. After that it can run completely offline, which is ideal for confidential work.

Yes. AirLLM Windows installations work on Windows 10 and 11 with an NVIDIA GPU. The key step is installing a CUDA-enabled PyTorch build before installing airllm.

Yes, on Apple silicon Macs. AirLLM uses the MLX backend on macOS, and the code is almost identical to Linux. Intel Macs are not supported.

AirLLM speed depends mostly on disk throughput. Large models typically take seconds to around a minute per token on consumer NVMe drives. Compression and faster storage shorten that significantly.

Slightly. AirLLM compresses only the weights using block-wise quantization, so 8-bit output is nearly identical to the original and 4-bit shows minor differences on demanding tasks.

Plan for about twice the model size during the first run, plus a margin. A 70B model at 16-bit precision needs roughly 300 GB free; compressed shards are much smaller.

Yes, CPU inference has been supported since version 2.10, but it is considerably slower. A GPU, even a small one, is strongly recommended.

No, AirLLM is a library. You can build a private browser-based chat interface in a few lines with Gradio, as explained in our AirLLM UI guide.

Llama 2, 3 and 4, Qwen through Qwen3, DeepSeek V2 and V3, Mistral and Mixtral, ChatGLM, Baichuan, InternLM, Phi-4, Gemma and, from version 3.1, Kimi K3.

Yes. AirLLM Kimi K3 support arrived in version 3.1. Because Kimi K3 is a mixture-of-experts model, AirLLM streams only the active experts, though it still needs terabytes of fast storage.

Ollama loads quantized models fully into memory for fast chat. AirLLM streams layers from disk to run far larger models on small GPUs, but more slowly. Many people use both.

No. AirLLM uses standard Hugging Face checkpoints such as safetensors. GGUF files are used by llama.cpp and Ollama.

AirLLM is open source, readable and runs locally. Download it only from GitHub or PyPI, prefer safetensors model files and use a virtual environment to keep dependencies isolated.

The Apache-2.0 licence permits commercial use of AirLLM itself. Each model has its own licence, so confirm the model terms before using outputs in a product.

No. This website is an independent resource that explains the project and links to the official GitHub source. It is not affiliated with AirLLM or its developer.