How does QLoRA fit a 65B fine-tune onto a single 48GB GPU?
Walk through the memory accounting for QLoRA fine-tuning of a 65B model on a single 48 GB GPU. Where does each of QLoRA's three tricks contribute, and what does the LoRA adapter contribute?
65B bf16 is ~130 GB. NF4 + double-quant compresses the frozen base to ~30 GB. Adapters stay bf16 (~0.4 GB) with Adam state on adapters only (~1.5 GB). Paged optimisers handle transient OOMs. Total fits in 48 GB.
Imagine you're moving a massive 130-pound encyclopedia into a tiny dorm room that only has a 48-pound shelf. Impossible, until you do four things. First, you photocopy the bulk of the book onto thin rice paper (the base book now weighs only 33 pounds). Second, you shrink the page-margin labels too, knocking off a few more pounds. Third, instead of editing the giant book, you stick a small notebook of margin notes (these stay at full quality because you actually write in them). Fourth, you stash a back-room cabinet so when the desk gets crowded mid-study, papers shuffle out and back. The result fits the shelf. That's the QLoRA stack for squeezing a 65B model into a single small GPU.
Detailed answer & concept explanation~8 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Lay out the full table: base weights (NF4 + DQ → ~30 GB), adapters (bf16 → 0.4 GB), Adam state (adapter-only fp32 → 1.6 GB), activations (checkpointed → 10-15 GB), KV cache + overhead (~2-5 GB). Emphasise that the biggest single saving is structural: no Adam state on the frozen 65B, which alone is 520 GB. Bit-width tricks are on top. Paged optimisers are the safety net for transient memory spikes.
| Component | Full FT (65B) | LoRA (65B, bf16) | QLoRA (65B, NF4) |
|---|---|---|---|
| Base weights | 130 GB (bf16) | 130 GB (bf16) | ~30 GB (NF4 + DQ) |
| Adapter weights | : | ~0.4 GB | ~0.4 GB |
| Adam state | ~520 GB (on base) | ~1.6 GB (on adapter) | ~1.6 GB (on adapter) |
| Activations | ~15 GB (checkpointed) | ~15 GB (checkpointed) | ~12 GB (checkpointed) |
| Total | ~650+ GB (multi-GPU) | ~150 GB (multi-GPU) | ~45-50 GB (single 48 GB) |
Real products, models, and research that use this idea.
- Dettmers et al. 2023 demonstrated 65B QLoRA on a single 48 GB A6000.
- Axolotl and Unsloth ship 70B QLoRA configs that fit on a single 48 GB or 80 GB GPU.
- Together AI and Predibase offer hosted QLoRA fine-tuning of 70B models on single-GPU instances.
- Hugging Face's `peft` + `bitsandbytes` integration is the canonical implementation, used by thousands of community fine-tunes.
- LLaMA-3-70B QLoRA fine-tunes on Hugging Face Hub are routinely produced on single 48 GB consumer-grade or workstation GPUs.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhat's the activation-memory math more precisely at 65B + seq_len 4096?
QCould you push QLoRA to fit 65B on a 24 GB consumer GPU?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Forgetting that NO Adam state is allocated for the frozen base. Adam state on 65B params in fp32 would be ~520 GB by itself.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.