QLoRA: LoRA on a quantized base
Quantize the base model to 4-bit (NF4 specifically — a quantization scheme designed for normally distributed weights), keep it frozen, and train LoRA adapters on top. Result: you can fine-tune a 70B model on a single 48GB GPU. The base stays in 4-bit; only the small adapters (in fp16/bf16) train.
The pieces
BitsAndBytesConfig— declares the 4-bit quant scheme.prepare_model_for_kbit_training— freezes base, enables grad checkpointing, casts as needed.LoraConfig— same as before.get_peft_model— wraps the model with adapters.
The PEFT method zoo
PEFT is more than LoRA. Other methods supported: IA3, LoHa, LoKr, OFT, X-LoRA, VeRA. Most teams default to LoRA + QLoRA. The exotic ones win on specific axes (memory, expressivity), but the marginal quality difference is small for typical SFT.