Two finished hypotheses have token probabilities and . Which one does beam search prefer by raw log-probability? Which by average log-probability, and which by GNMT length normalisation ? What bias does this show?
Sequence models and transformers, Decoding
Level L2 Elementary. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you see that the product of probabilities penalises long outputs and how length normalisation changes the ranking.
Key idea
Raw log-probability sums negative terms, so each extra token lowers the score. Dividing by a length penalty compensates, but the choice of can decide the winner.
Steps
- . .
- Raw score: , so wins. It is shorter, even though each token of (probability ) is more confident than those of .
- Average log-probability: ; . Now wins.
- GNMT (Google's Neural Machine Translation) penalty with exponent : and . Scores and . wins narrowly.
- Raw beam search is biased towards short outputs (sometimes producing empty or truncated translations). Full average normalisation can bias towards long, repetitive ones.
- So the length penalty is a hyperparameter, tuned on validation data. With the GNMT exponent the penalty is milder and the result could change; here, the margin of is small.
Common mistakes
- Using in one place and in another.
- Forgetting that scores are negative, so "larger" means closer to zero.
- Saying length normalisation always picks the longer hypothesis.
How long your answer should be
Half a page; 4 minutes.
Read this
Previous in Sequence models and transformers: Training compute is approximately FLOPs for parameters and tokens. The Chinchilla result suggests a compute-optimal ratio of about . (a) For FLOPs, what and are compute-optimal? (b) How many tokens and how much compute does a compute-optimal B model need? (c) How much compute does a B model trained on T tokens use?
Next in Sequence models and transformers: A single-layer LSTM has input size and hidden size . How many trainable parameters does it have (one bias vector per gate), and how does the count compare with a GRU and a plain RNN of the same sizes? What changes if the LSTM is bidirectional?