BC Skills Academy

LLM Training & Fine-Tuning — Study Guide

An illustrated, exam-aligned study guide covering the full LLM lifecycle: pretraining objectives and data, scaling laws, distributed training and mixed precision, supervised fine-tuning, RLHF and DPO alignment, and parameter-efficient fine-tuning (LoRA/QLoRA). Diagrams, comparison tables, and worked examples throughout.

Key facts

Course outline

  1. Pretraining Objectives & Data — How base models learn: causal vs masked LM, next-token prediction, and the data curation that makes or breaks a corpus.
    • Causal vs Masked Language Modeling
    • Perplexity & the Loss You Optimize
    • Data Curation: Filter, Dedup, Decontaminate
  2. Tokenizers & Scaling Laws — Building the vocabulary the model thinks in, and the Chinchilla math that tells you how big and how long to train.
    • Training a Tokenizer (BPE & friends)
    • Chinchilla: Compute, Data & Parameters
    • Reading the Loss Curve
  3. Distributed Training at Scale — Splitting a model across many GPUs: data, tensor, and pipeline parallelism, plus ZeRO/FSDP, accumulation, and checkpointing.
    • Data, Tensor & Pipeline Parallelism
    • ZeRO / FSDP: Sharding the Footprint
    • Accumulation & Activation Checkpointing
  4. Mixed Precision & Optimization — fp16 vs bf16, loss scaling, fp32 master weights, and the warmup/decay schedules that keep training stable.
    • fp16 vs bf16 & Loss Scaling
    • Why an fp32 Master Copy?
    • Warmup, Decay & AdamW
  5. Fine-Tuning & Alignment — From base model to helpful assistant: SFT and chat templates, RLHF with reward models and PPO, and the simpler DPO.
    • The Alignment Pipeline & SFT
    • RLHF: Reward Models & PPO
    • DPO: Alignment Without the RL Loop
  6. PEFT, Forgetting & Evaluation — Adapt cheaply with LoRA/QLoRA, avoid catastrophic forgetting and contamination, and evaluate fine-tuned models honestly.
    • LoRA & the Low-Rank Adapter
    • QLoRA & the PEFT Family
    • Forgetting, Contamination & Honest Evaluation