Skip to content
nonconvexcard

Will this fine-tune fit?

NumericalBeginner⏱ 30 minFine-Tuningmemoryadamloraqlora

Problem

You have one 80 GB GPU and a 13B-parameter model.

  1. Compute persistent state for full fine-tuning with mixed-precision Adam. Does it fit?
  2. Compute it for LoRA with 20M trainable parameters and a BF16 frozen base.
  3. Compute it for QLoRA with a 4-bit frozen base.
  4. In case 2, how much is left for activations, and what does that allow at L=40L=40, d=5120d=5120, assuming 20 bytes of activation per layer per token per unit of width?

Compute the requested quantities and say what they mean. A number without an interpretation is not an answer.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Adapter parameter countsFine-TuningNumericalFoundation15 min
Derive Adam's bias correctionSGDProofBeginner15 min
KV cache sizing with MHA and GQALLM OpsNumericalBeginner30 min
LoRA parameter accountingLLMsNumericalBeginner15 min
Product quantisation budget arithmeticRAGNumericalBeginner30 min