PEFT Motivation › Worked Example: Calculating PEFT Savings
Language AI HandbookAll chapters PEFT Motivation › Worked Example: Calculating PEFT SavingsOne section · Sections in this chapter5 / 10 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Let's work through a concrete numerical example to make the storage and training memory savings tangible. Consider a mid-sized company that wants to deploy a code assistant, a customer support bot, a legal document analyzer, and a medical question-answering system, each based on LLaMA-13B in FP16.
Step 1: Establish the baseline.
LLaMA-13B has 13 billion parameters. In FP16, each parameter requires 2 bytes:
Step 2: Calculate full fine-tuning storage for 4 tasks.
With full fine-tuning, we need the base model plus one fine-tuned copy per task:
Step 3: Calculate PEFT storage for 4 tasks.
With 1% PEFT parameters, each adapter contains million trainable parameters. Each adapter in FP16 requires:
Total PEFT storage for 4 tasks:
Step 4: Compute the storage reduction factor.
Step 5: Compare training memory.
Full fine-tuning of LLaMA-13B in FP16 with AdamW requires:
- Parameters: 24.2 GB
- Gradients: 24.2 GB
- Optimizer states (2 FP32 buffers + FP32 master): GB
- Total: approximately 194 GB, requiring 3 A100-80GB GPUs
PEFT training requires:
- Frozen parameters: 24.2 GB (no gradients needed)
- Trainable weights: 0.24 GB
- Trainable gradients: 0.24 GB
- Optimizer states for 130M trainable params: GB
- Total: approximately 26.1 GB, fitting comfortably on a single A100-40GB GPU
This is the power of PEFT in practice: a task that previously required 3 expensive GPUs and 194 GB of memory can now run on a single consumer-grade GPU with 26 GB of memory.