Choose between Full Fine-Tuning and LoRA/PEFT based on your constraints
| Aspect | Full Fine-Tune | LoRA/PEFT |
|---|---|---|
| Trainable Parameters | All parameters (~100%) | ~0.1-1% of parameters |
| GPU Memory | High (full model + optimizer states) | Lower (base frozen, small adapters) |
| Training Speed | Slower (more params to update) | Faster (fewer params) |
| Storage per Task | Full model copy per task | Small adapter weights (~10-50MB) |
| Task Switching | Load different models | Swap adapter weights |
| Performance Ceiling | Higher (full flexibility) | Near full fine-tune for most tasks |
| Risk of Catastrophic Forgetting | Higher | Lower (base weights frozen) |
| Best For | Maximum performance, large datasets | Limited compute, multi-task, iteration |
# LoRA Configuration Example
from peft import LoraConfig, get_peft_model
lora_config = LoraConfig(
r=8, # Rank of update matrices
lora_alpha=16, # Scaling factor
lora_dropout=0.05, # Dropout for regularization
bias="none", # Don't train bias terms
task_type="SEQ_CLS" # Sequence classification
)
model = get_peft_model(model, lora_config)
model.print_trainable_parameters()
# Output: trainable params: 294,912 || all params: 66,955,010 || trainable%: 0.44
Click on a scenario to see the reasoning behind the recommendation.