π β the loss
Read "L" or "the loss". The curly L is the single number that measures how wrong the model is. Training adjusts the weights to make it small.
is a function of the model's parameters : plug in the current weights and get back a score for how wrong the model is on the training data. Training runs gradient descent on this number, repeatedly nudging the weights in the direction that lowers it.
A subscript names which loss: (negative log-likelihood), (a loss for speech alignment), (the extra balancing term in mixture-of-experts). A model's total loss is often a weighted sum of several of these.
Example
If the model gave the correct next token probability 0.8, the negative log-likelihood for that token is about 0.22. Probability 1 would give a loss of 0.
Where the course uses it
- 0.3 What You Need, and How the Course Is Organized Β· Module 0, Start Here: What an LLM Doesfirst use
- 1.1 Scalars, Vectors, Matrices, and Tensors Β· Module 1, Shapes and Linear Algebra
- 2.2 Partial Derivatives and the Gradient Β· Module 2, Calculus and Optimization
- 2.4 Gradient Descent Β· Module 2, Calculus and Optimization
- 2.5 Backpropagation Β· Module 2, Calculus and Optimization
- 3.4 Maximum Likelihood Β· Module 3, Probability and Information
- 4.3 Logits, Softmax, and Cross-Entropy Β· Module 4, How a Model Learns From Data
- 8.2 Encoder-Only: BERT and Masked Language Modeling Β· Module 8, Three Families: Encoder, Encoder-Decoder, Decoder
- 8.4 Decoder-Only: Predicting the Next Token Β· Module 8, Three Families: Encoder, Encoder-Decoder, Decoder
- 10.5 Scaling Laws: How Big, and on How Much Text Β· Module 10, Pretraining
- 17.4 Router Collapse and the Load-Balancing Loss Β· Module 17, Mixture of Experts
- 20.4 Distillation Β· Module 20, Adaptation: Fine-Tuning, LoRA, Distillation
- 21.3 PPO Β· Module 21, Preference Learning: RL, RLHF and DPO
- 21.4 Reward Models From Preferences Β· Module 21, Preference Learning: RL, RLHF and DPO
- 21.6 Direct Preference Optimization Β· Module 21, Preference Learning: RL, RLHF and DPO
- 25.3 Contrastive Learning: CLIP and SigLIP Β· Module 25, Vision Transformers and Contrastive Learning
- 26.4 Training on Images and Text Together Β· Module 26, Vision-Language Models
- 27.3 The CTC Objective and Its Recursion Β· Module 27, Recognition: OCR and Speech With CTC
Related terms
- LogarithmRead "log of x". It undoes the exponential: log(eαΆ») = z. It turns products into sums, which is why loss functions use it.
- ΞΈ β the model's parameters (or an angle)Read "theta". Usually it stands for every learnable weight in the model at once. In some sections it is an angle or a setting instead; the sentence around it tells you which.
- β β gradientRead "nabla" or "the gradient of". It is the list of every partial derivative at once, and it points in the direction that increases the function fastest.