Over fifty training runs of Qwen2.5-0.5B on banking77: the formula, the parameter count and a from-scratch implementation, then learning rate, rank, target modules, epochs, full fine-tuning and QLoRA compared, and the pitfalls of merging and deployment, with code and numbers behind every claim.
How to weigh the quantity and quality of SFT data and check it: measured effects of data size, label noise, the loss mask and mixed-in general data (Qwen2.5-0.5B on banking77), plus rule filters, near-duplicate removal and contamination checks on Alpaca, Alpaca-cleaned and Dolly.
Language models can memorize rare training snippets verbatim, and attackers can prompt them back out. A small experiment with known secrets measures how copies, attacker context and training strength change memorization, and compares deduplication with goldfish loss.
QLoRA (Dettmers et al., 2023) quantizes a frozen base model to 4-bit NormalFloat and trains LoRA adapters on top, so a 65B model fine-tunes on one 48 GB GPU. This breakdown explains NF4, double quantization and paged optimizers, rebuilds NF4 in code and tests 4-bit data types on Qwen2.5.
LoRA (Hu et al., 2021) freezes the pretrained weights and trains only a low-rank update ΔW=BA: about 10,000 times fewer trainable parameters on GPT-3 175B, a 350GB checkpoint shrinking to 35MB, no extra latency after merging, and quality on par with full fine-tuning. Method, experiments, caveats.