Overview of Training
How a raw next-token predictor becomes a helpful, aligned assistant — and how its weights get squeezed for cheap inference. We walk the pre-train → fine-tune → align pipeline, open up the RLHF loop, show what quantization does to a weight, and meet LoRA.
From base model to aligned assistant
step-throughThe training pipeline: pre-training learns a base model, then post-training (SFT then preference alignment) shapes it into something useful.
Pre-training is self-supervised: the only label is the next token in the corpus,
so it scales to huge text dumps. The resulting base model can continue text but isn't
trying to be helpful. Post-training — first SFT, then preference
alignment — is what turns it into a chatbot that produces the kinds of answers
humans actually want.
RLHF: learning from preferences
step-throughHumans compare candidate responses → those comparisons train a reward model → the policy is optimized to score high while a KL leash keeps it near the reference.
Quantization: fewer bits per weight
auto-playContinuous high-precision weights (FP16/BF16) get snapped onto a small grid of integer levels (INT8 → INT4). The model shrinks and runs faster; accuracy slips a little.
Quantization trades a little accuracy for a smaller footprint, so it's mostly an
inference optimization. Calibrated methods like GPTQ and AWQ
use sample data — AWQ keeps the most important weights at higher precision — while
HQQ and k-quants reduce weight error without any calibration data.
LoRA: parameter-efficient fine-tuning
step-throughFreeze the giant pre-trained weight matrix; train two small low-rank matrices beside it. Fewer than ~1% of the parameters move — and they can be merged back at deploy time.