Optimization / Objectives
verifiedCross-Entropy Loss
For a model that outputs a probability distribution, cross-entropy asks a simple question: how much probability did you put on the right answer? Put a lot and the loss is small; put almost none and it is enormous. It punishes confident mistakes far harder than uncertain ones.
Negative log likelihood of the correct class under the predicted distribution. Paired with softmax it has an unusually clean gradient — predicted minus target — which is why the pair is ubiquitous and why implementations fuse them rather than composing them. Perplexity, the number usually reported for language models, is just its exponential.
ℓ = −Σ sub c y sub c log p sub c , which for a one-hot target reduces to −log p sub correct . With p = softmax(z), ∂ℓ/∂z = p − y. Perplexity is exp(ℓ) averaged over tokens, so a loss of 2.0 is a perplexity of about 7.4.
8 values. The left group decays steeply; the right group is 51% of the way to flat, and reads flatter than the left.
The predicted distribution against the target it is scored on. Drag the uncertainty up to watch probability spread off the right answer, and the loss climb with it.
Reviewed by opendroid · 2026-08-04
- arXiv:1312.3005 — One Billion Word Benchmark for Measuring Progress in Statistical Language Modeling