Concept

LoRA & QLoRA

Parameter-efficient finetuning: train adapters, not the model — how it works and the practical recipe.

Full finetuning updates billions of weights — VRAM-hungry, slow, and it produces a whole new model per task. LoRA (Low-Rank Adaptation) freezes the base model and trains small low-rank matrices injected alongside existing layers, on the observation that finetuning's weight changes have low intrinsic rank. Result: you train a fraction of a percent of the parameters, and the artifact is an adapter of a few hundred megabytes you load on top of the shared base — one base model, many task adapters, swappable at runtime.

QLoRA pushes the hardware floor down: quantize the frozen base to 4-bit precision, train LoRA adapters in higher precision on top. Quality holds up remarkably well, and models in the 7–13B class become trainable on a single consumer GPU — this is the technique that democratized open-weight finetuning. The practical toolchain: Hugging Face PEFT/TRL as the substrate, with Axolotl or Unsloth as the recipe layer most practitioners actually drive (config-file training, sane defaults, memory tricks).

The knobs that matter, honestly ranked: data quality first — a few hundred to a few thousand clean, deduplicated, correctly-formatted examples beat ten times that of scraped noise; keep held-out examples for evaluation. Then rank r (8–64 typical; higher = more capacity and more overfitting risk), learning rate, and epochs (1–3; more usually memorizes). Watch eval loss, and run your task evals (aa-15's prerequisite) on the merged result before believing anything. Most disappointing finetunes are data problems wearing a hyperparameter costume.

Check your understanding
Q1. What does LoRA actually train?
Q2. QLoRA's contribution on top of LoRA is:
· Score 100% on the quiz.