Running a model only needs its weights. But training needs much more. To understand why fine-tuning big models is hard, and why LoRA helps, we need to see where the memory goes.
During full training, every parameter needs four things. The weight itself. A gradient, which says how to change the weight. And two extra numbers for the Adam optimizer, which tracks the recent direction, and size, of the changes. Add them up, with the usual formats, and it's about sixteen bytes per parameter. Plus some more for the activations.
Let's turn the rule into a tiny calculator. For each model, we work out the memory to use it, at two bytes per parameter. And the memory for full fine-tuning, at sixteen bytes per parameter. Run it. Our small model is easy. But an eight billion parameter model needs one hundred and twenty eight gigabytes to fully fine-tune. That's more than any single normal GPU has. And seventy billion needs over a terabyte.
app.pypython
def gb(n): return f"{n / 1e9:,.1f} GB"for name, params in [("SmolLM2-135M", 135e6), ("Qwen2.5-0.5B", 0.5e9), ("Llama-8B", 8e9), ("Llama-70B", 70e9)]: use = params * 2 # bf16 weights: 2 bytes each full = params * 16 # weights + gradients + Adam states print(f"{name:13} use: {gb(use):>9} full fine-tune: {gb(full):>9}")
Output
SmolLM2-135M use: 0.3 GB full fine-tune: 2.2 GB
Qwen2.5-0.5B use: 1.0 GB full fine-tune: 8.0 GB
Llama-8B use: 16.0 GB full fine-tune: 128.0 GB
Llama-70B use: 140.0 GB full fine-tune: 1,120.0 GB
So how does anyone fine-tune big models? The trick is to train only a tiny fraction of the parameters. Then gradients, and Adam states, are only needed for that tiny part. That's the idea behind PEFT, and LoRA. It can cut training memory by more than ten times.
Let's recap. Training needs weights, gradients, and optimizer states, about sixteen bytes per parameter. Full fine-tuning of big models needs huge memory. And LoRA avoids that by training only a small part. Next, how training actually works, starting with the loss.