Home / Guide / Performance
Performance

AirLLM Speed: Realistic Expectations and Proven Ways to Go Faster

Understand AirLLM speed honestly: why layer streaming is slower, what limits throughput, and the settings and hardware choices that make the biggest difference.

AirLLM Speed: Realistic Expectations and Proven Ways to Go Faster

The question people ask most after their first experiment is about AirLLM speed. The answer requires honesty: AirLLM trades speed for memory. It lets you run a model that would otherwise be impossible on your hardware, but it does not make that model fast. Once you understand where the time goes, though, you can often double or triple throughput with the right choices.

Where the time actually goes

Generating one token means passing data through every layer of the model. With AirLLM, each layer must first travel from disk into GPU memory. For a 70B model stored in 16-bit precision, the full set of layers totals roughly 140 GB. If your drive reads at 3 GB per second, simply moving those bytes takes close to fifty seconds, and that happens for every token. The actual matrix maths on the GPU takes a small fraction of that time.

Rule of thumb: time per token ≈ total shard size ÷ effective disk read speed.

This simple formula predicts AirLLM speed surprisingly well and points directly at the levers you can pull.

Lever 1: storage throughput

Since disk reads dominate, storage is the single biggest factor.

StorageTypical sequential readEffect on AirLLM
Hard disk drive0.1–0.2 GB/sImpractical for large models
SATA SSD0.5 GB/sUsable for small models
NVMe Gen32–3.5 GB/sGood baseline
NVMe Gen4/Gen55–12 GB/sBest results

Put layer_shards_saving_path on your fastest NVMe drive. Avoid USB enclosures, network shares and drives that are nearly full, because many SSDs slow down significantly when little free space remains.

Lever 2: compression

AirLLM supports block-wise weight quantization through the compression argument. Unlike approaches that quantize both weights and activations, AirLLM quantizes only the stored weights, which keeps accuracy loss small while cutting the bytes read from disk.

model = AutoModel.from_pretrained(
    "meta-llama/Llama-3.1-70B-Instruct",
    compression="4bit",
)

Eight-bit compression roughly halves shard size compared with 16-bit; four-bit compression roughly quarters it. The project reports up to a threefold speed improvement. Install bitsandbytes before using this option.

Lever 3: prefetching

Prefetching loads the next layer while the GPU works on the current one, so the GPU rarely sits idle. It is enabled by default in modern versions. Leave it on unless you are debugging memory issues.

Lever 4: generate fewer tokens

Because cost scales linearly with output length, the cheapest optimisation is asking for less. Request concise answers in your prompt, set a sensible max_new_tokens and stop generation at the first end-of-sequence token.

Lever 5: choose the right model size

A well-tuned 32B model may answer your question just as well as a 70B model in less than half the time. Test smaller models first and move up only when quality clearly requires it.

Lever 6: system RAM as a cache

Operating systems keep recently read files in spare RAM. If your machine has enough memory to hold a large portion of the shards, later passes may be served from RAM rather than disk, which can noticeably improve AirLLM speed for small and medium models. Closing memory-hungry applications helps the cache stay warm.

Lever 7: the operating environment

  • Exclude the shard folder from antivirus real-time scanning on Windows.
  • Use a high-performance power plan so the CPU and drive do not throttle.
  • Keep the laptop plugged in; many devices limit storage speed on battery.
  • Monitor drive temperature; NVMe drives throttle when they overheat during long jobs.

Measuring speed properly

Time several tokens rather than one, and ignore the first run, which includes downloading and splitting. A simple approach is to record the wall-clock time for generating 20 tokens and divide by 20. Change one setting at a time so you know which adjustment helped.

import time
t = time.time()
out = model.generate(ids, max_new_tokens=20, use_cache=True,
                     return_dict_in_generate=True)
print(f"{(time.time() - t) / 20:.1f} s per token")

When AirLLM is the wrong tool

If you need fluent, interactive chat with near-instant replies, a smaller quantized model running fully in memory through a tool like Ollama will feel far better. AirLLM is the right tool when the model you need is simply too large for your hardware, when quality matters more than latency, or when work can run unattended. Our AirLLM vs Ollama comparison explores this choice in detail.

A worked example: estimating time before you start

Suppose you want to run a 70B model with 4-bit compression on a PCIe Gen4 NVMe drive that sustains around 5 GB per second in practice. At 4-bit, the shards total roughly 35 to 40 GB. Dividing 38 GB by 5 GB per second gives about 7.6 seconds of pure reading per token, plus a little computation and overhead. A 150-token answer would therefore take roughly 20 minutes. The same model uncompressed on a SATA SSD reading 0.5 GB per second would need about 280 seconds per token, or almost twelve hours for the same answer. Running these numbers before you begin helps you choose a configuration that matches the time you actually have.

Checking where the bottleneck really is

Estimates are useful, but measurement is better. While a generation runs, watch disk read throughput and GPU utilisation side by side. If the drive is reading at close to its rated speed and the GPU shows short bursts with long idle gaps, storage is the limit and faster storage or stronger compression will help. If the drive reads far below its rating, look for interference such as antivirus scanning, thermal throttling or a nearly full SSD. If the GPU is busy most of the time, which is rare with AirLLM, you have an unusually fast drive and a faster GPU might now pay off.

Prompt length also matters

The first pass through the model processes your entire prompt. Long prompts create larger activations and more computation in that first pass, although the per-token cost of the answer is still dominated by disk reads. Trimming irrelevant context, such as boilerplate headers in documents, shortens the first pass and reduces the risk of running out of GPU memory on small cards. For document work, extract the relevant section rather than feeding an entire file.

A quick optimisation checklist

  • Shards on the fastest NVMe drive, with at least 20 percent free space.
  • 8-bit or 4-bit compression enabled unless exact fidelity is required.
  • Prefetching left on.
  • Concise prompts and a sensible max_new_tokens.
  • The smallest model that meets your quality bar.
  • Antivirus exclusions, performance power plan and good cooling.

Measure each phase of an AirLLM run

Write down the time at which the script starts, model loading returns, generation begins and the result finishes. When your interface exposes the first token independently, capture that time too. Report startup separately from steady generation. Otherwise a test that prepares shards on its first run and a test that reuses them on its second run can make a settings change appear much more effective than it really is.

Use the same prompt and output budget in each comparison. Record how many tokens were actually generated because two completions can end at different points. A run that finishes sooner may simply have produced fewer tokens. Run several repeats and compare their median. Note whether another process was copying files, indexing the model directory or using the GPU at the same time. External drives should be tested while connected to the same port used in production.

Track both elapsed time and usefulness. For example, a four sentence answer and a twenty sentence answer can differ significantly in runtime, even on the same setup. If the task only needs a structured list, set an appropriate output limit and verify that the answer still contains every required field. Improving the prompt and response format often saves more operational time than a small change in raw token rate.

Once a change improves your representative test, repeat it on a longer request. That exposes memory pressure and context costs the short run may not show. Keep the original settings in your log and roll back a change if it increases error frequency or produces incomplete answers.

Frequently asked questions

It depends mainly on disk speed and model size. Because every generated token requires reading every layer, a 70B model can take from several seconds to around a minute per token on consumer hardware. Smaller models and compression shorten that considerably.

Yes. Block-wise 4-bit or 8-bit compression makes each shard smaller, so less data is read from disk per token. The project reports up to three times faster inference with compression enabled, with only a small loss in quality.

Only slightly in most cases. The GPU usually finishes its calculation long before the next layer has been loaded, so storage throughput, not raw GPU power, is normally the bottleneck.

Not for very large models. It is better suited to batch jobs, research and tasks where quality matters more than speed. For instant replies, use a smaller model that fits fully in memory.

Conclusion

AirLLM speed is governed by a simple truth: every token reads the whole model from storage. Faster drives, compression, prefetching, shorter outputs and right-sized models all attack that cost directly. Apply them together and a setup that felt painfully slow can become perfectly practical for research, batch processing and private analysis, while still running models far beyond your GPU's normal reach.