The training loss for next-token prediction is cross-entropy between the model's predicted distribution over the next token and the actual next token (a one-hot vector).
For each position, the model outputs logits over the entire vocabulary; softmax converts them to probabilities; cross-entropy reports the negative log probability the model assigned to the correct token. Sum across positions, average across the batch, that's the loss.
Perplexity is the exponentiated cross-entropy: perplexity = exp(loss). It has a tangible interpretation: "the effective number of options the model is choosing among at each position." A perplexity of 100 means the model is roughly as uncertain as if it had to pick one of 100 equally-likely options. Modern frontier LLMs achieve perplexities of 5-15 on natural English text.