Cross-Entropy, Exactly

Every term of the cross-entropy formula from one-hot and soft targets to softmax gradients, with live tensors and checked exercises.

Cross-entropy term by term

Inspect target weights, logarithms, candidate distributions, batch averages, and softmax gradients.

  1. What Cross-Entropy Measures

    why expected surprise splits into irreducible entropy plus mismatch

  2. One-Hot Selects One Term

    why hard labels collapse the cross-entropy sum to a single log-probability

  3. Soft Targets Weight Terms

    how soft targets bring every class back into the cross-entropy sum

  4. Log Is the Named Boundary

    why the logarithm creates an infinite barrier at zero probability

  5. Lower Probability, Higher Loss

    why multiplicative drops in probability become additive steps in cross-entropy

  6. Compare Two Candidate Distributions

    why a candidate that is confident on the top class can still lose on cross-entropy

  7. Average Over a Tiny Batch

    how positive and negative rows combine into a single batch mean loss

  8. Cross-Entropy and Softmax

    how softmax and negative log-probability combine into the linear gradient p - y

  9. What Cross-Entropy Is and Is Not

    why even an exact probability model has positive cross-entropy on noisy outcomes