Connect language model loss, perplexity and the softmax gradient
MediumConcept12 minRERSPro outline
The question
A language model reports an average cross-entropy of 2.0 nats per token on a test set. What is its perplexity, and what does that number mean intuitively?
Then derive the gradient of the cross-entropy loss with respect to the logits for one token.
What the interviewer is looking for
- Perplexity = exp(average negative log-likelihood), so exp(2.0) is about 7.4
- Intuition: about as uncertain as choosing uniformly among 7 to 8 tokens
- Clean derivation that dL/dz = softmax(z) - onehot(y)
- Awareness that perplexity depends on the tokenizer, so it is not comparable across vocabularies
- Mentions bits per byte or per character as a tokenizer-independent alternative
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported Google DeepMind question type: explain the math behind a core LLM concept.
Reported in: glassdoor.co.in
Practice question written by BlogLLM based on publicly reported interview formats. Not an official Google DeepMind question.