GPU and memory basics for training
A 7-billion-parameter model runs happily on one 24 GB GPU. So you try to fine-tune it on the same card, and it crashes with out of memory before the first step. Training needs several times the memory of running a model, and a little arithmetic tells you how much before you rent anything.
In this lesson you'll learn to
- Estimate memory per parameter for inference, full fine-tuning, LoRA and QLoRA.
- Explain how batch size and sequence length drive activation memory, and the tricks that reduce it.
- Pick a training method and GPU size for a given model with a quick calculation.
- Recognise when a model needs more than one GPU, and what sharding does.
Create a free account to open this lesson
It's free. You'll get every free lesson, quizzes that save your progress, daily flashcards and streaks.