14 November 2026
شغّل موديل ضخم على كرت شاشة صغير مع AirLLM: متى ينفعك وكيف تبدأ بدون مفاجآتRun a Huge Model on a Small GPU with AirLLM: When It Helps and How to Start Without Surprises
Learn how AirLLM runs a 70 billion parameter model on a 4 GB GPU, what it costs in time and disk, and how to get your first run right.
Who this guide is for
Developers and curious builders with an ordinary GPU who want to try big models on their own machine
Key terms
- Layer
- A model is a stack of layers. Llama at 70 billion parameters has 80 of them, and every word passes through them one by one.
- VRAM
- The memory on the graphics card. The usual way needs the whole model to fit, and a 70B model in full precision is about 140 GB.
- AirLLM
- An open source library that loads one layer onto the GPU, runs it, drops it and loads the next. The card only has to hold one layer.
- Token
- A piece of a word the model writes. Every new token has to pass through all the layers again.
The steps
Step 1
Decide if your job fits AirLLM
AirLLM is not for chat. Every token the model writes reads every layer off your disk again, so answers come out very slowly.
It fits a job you leave running overnight, like summarising files or labelling text, or testing a huge model on your own machine before you rent a server.
Here is my task: [task description]. I have about [count] inputs and each answer needs about [word count] words. Does this suit a slow overnight batch run on a large model, or is a smaller, faster model better? Explain briefly.PromptAsk Claude if your task fitsTip: If you need a reply in seconds, use a small local model or a cloud service instead.
Step 2
Estimate the time before you start
Rough rule: seconds per token is about the model's size on disk divided by your disk's read speed.
Example: a 140 GB model on a fast SSD reading about 7 GB per second is roughly 20 seconds per token. A slower SSD makes it much longer. This is an estimate; your machine decides the real number.
The model is [size in GB] and my disk reads at [speed in GB per second]. I need [number of answers] answers of about [tokens] tokens each. Estimate the total time in hours and say it is an estimate.PromptQuick mathStep 3
Free up disk space
AirLLM splits the model into layers and saves them to disk before the first run, so you need room for the original and the split copy.
For a 70B model in full precision keep well over 100 GB free, ideally twice the model's size. Short on space? delete_original=True removes the original after the split and saves about half.
Tip: A MetadataIncompleteBuffer error usually means the disk ran out.
Step 4
Install AirLLM
You need Python and an NVIDIA GPU, or a Mac with Apple silicon. On a Mac install mlx and torch first; macOS currently runs Llama and Mistral style models only.
Then install the library with one terminal command.
pip install airllmPromptInstallStep 5
Try a small model first
Before the giant one, run a smaller model to check everything works and see the speed on your machine. The same code works for every model; only the name changes.
Put the Hugging Face model name in [model name]. Gated models need an hf_token.
from airllm import AutoModel model = AutoModel.from_pretrained("[model name]") input_tokens = model.tokenizer(["[your question]"], return_tensors="pt", return_attention_mask=False, truncation=True, max_length=128, padding=False) out = model.generate(input_tokens['input_ids'].to(model.device), max_new_tokens=20, use_cache=True, return_dict_in_generate=True) print(model.tokenizer.decode(out.sequences[0]))PromptFirst run (Python)Step 6
Turn on compression to speed it up
The bottleneck is reading from disk, so smaller layers mean faster runs. AirLLM has a compression option, 4bit or 8bit, and the project page says it speeds things up by up to 3x with a small accuracy cost.
Want full precision? Leave it off and accept the wait.
model = AutoModel.from_pretrained("[model name]", compression='4bit')PromptWith compressionStep 7
Run it as an overnight batch
Put all your questions in one file and let a script work through them, saving each answer as it goes. Keep max_new_tokens as small as the job allows; every extra token is extra time.
Keep the machine plugged in and don't run anything heavy on it meanwhile.
Write me a Python script that uses AirLLM: it reads questions from [file name] line by line, runs each on the model [model name] with max_new_tokens=[number], and appends each answer to a JSONL file as it goes so I can resume if it stops.PromptAsk Claude for the script
Ready prompts to copy
The takeaway
AirLLM lets a small GPU run a huge model, and the price is time. Use it for overnight jobs and tests, not chat.
Liked this guide?
Join Mohammad's community
72 guides like this one, and a new one every week. One subscription opens them all.
Approximate price in your currency. You pay in AED
- A permanent archive. Open any guide, any time
- 20% off private build sessions
- Cancel any time, no commitment
Or without a subscription
Most value
Start building with me now
We sit together, break down your problem, and I build the AI solution with you step by step
- A private session with you
- Real building during the session
- Results you take with you when we finish
100% free
A free consultation about your problem
