core practice · coding problem

Softmax and cross-entropy loss

Logits [2,1,0.1], true class index 0. Compute softmax probabilities and −log p(true).

The mechanism

Softmax turns raw scores (logits) into probabilities that sum to 1. Cross-entropy then measures how wrong those probabilities are versus the true answer. Together they give a clean gradient that backprop can work with.

Study Softmax & Cross-Entropy

Expected evidence

p≈[0.659,0.242,0.099], loss≈0.417.

Try this drill in the practice workspace →

Hints when you need them
  • Subtract max logit before exp for stability.
  • Loss = −log p(correct).

Check the sources

Browse all practice briefs