Catastrophic forgetting — Narrow fine-tune improves the task but hurts general skills. Measure canaries; use smaller updates, rehearsal, freeze layers, regularize, or weight averaging.
Learning-rate schedule — Warmup + peak + decay (cosine is a common default). Peak learning rate is the big knob.
Batch size — Care about effective batch = micro-batch × accumulation × GPUs. Too small → jitter; too large → too few updates.
Data prep — Fix noise, bad labels, duplicates, messy formatting, stale facts; split honestly; watch domain shift.
Loss curves — Train and val falling together with a small gap = healthy. Stop at the validation minimum.
3.3 PEFT: additive and soft prompting
Why PEFT — Full fine-tuning is costly and can forget old skills. Train a tiny fraction of parameters (or a tiny prompt) instead. Families: selective, additive, re-parameterization (LoRA/QLoRA), soft prompting.
Adapters (additive) — Small modules on a frozen backbone. Sequential (in the path) vs residual/parallel (add a correction). Freeze original weights; update only adapters. Modular multi-task swap.
Soft prompting — Adapt in token space with learnable virtual tokens. Discrete prompt = real words; continuous prompt = trainable embeddings.
Prefix vs prompt tuning — Both soft-prompt methods; prefix tuning emphasizes learned prefix context; prompt tuning learns prompt embeddings with a frozen model.
Smarter prompts — SMoP (sparse mixture), APT (prefix length by layer), IDPG (prompt from the input), SPT (prompts only where needed).
Choose by fit — Adapters for modular architecture-side adaptation; soft prompts for smallest frozen-backbone footprint; smarter variants when one blunt prompt is not enough.
3.4 Re-parameterization PEFT (LoRA & QLoRA)
Why it exists — Full fine-tuning stores weights + gradients + optimizer for every parameter. Too heavy for many clients or one tight GPU.
Intrinsic dimension — Useful adaptations often live in a smaller space than the full weight matrix.
Memory stack — Checkpointing saves activations (extra compute); paged optimizer smooths optimizer spikes. Together with 4-bit + LoRA, large models become more realistic on fewer GPUs.
3.5 Alignment: RLHF & DPO
HHH target — Helpful, Honest, Harmless. Balance all three; overdoing one breaks the others.
RL view of an LLM — State = prompt + prefix; action = next token; trajectory = full generation; policy = next-token distribution.
Policy gradient / advantage — Raise probability of choices that were better than expected; baseline/advantage reduce noise.
PPO + KL — Sample answers, update carefully, keep near a reference model. Reward hacking = gaming the score without truly helping.
Reward model — Learn from chosen/rejected pairs; Bradley-Terry pushes winner score above loser.