Skip to main content

Cross-Entropy

Cross-Entropy

  • Core concepts
  • Stage 4 · Under the Hood
  • refs checked 2026-11-17
What problem it solves

Measure how far the predicted distribution is from the true one; the default loss for classification and language models.

What it is
Cross-entropy is the negative log-likelihood of the true distribution: the lower the probability given to the right answer, the larger the penalty. PyTorch’s CrossEntropyLoss combines log-softmax and negative log-likelihood.
Cross-entropy looks at the probability assigned to the correct class: near 1 gives near-zero loss, near 0 gives a large penalty.
Cross-entropy looks at the probability assigned to the correct class: near 1 gives near-zero loss, near 0 gives a large penalty.
Why it matters

Perplexity is the exponential of cross-entropy. Before comparing loss numbers, check the unit and the vocabulary denominator.

Chinese aliases

Sources
  • PyTorch CrossEntropyLoss ↗
  • Goodfellow et al., Deep Learning, Chapter 6 ↗
Use this term in a task

Don’t stop at the definition: use the task handbook for the order and checks, or filter three tool candidates for the job at hand.

Task handbooks → · Filter three candidates →