← Microsoft Interview Insights
I knew the basic fix (divide by length) but fumbled when they pushed on the alpha parameter.
Start by explaining why cumulative log-probabilities bias toward shorter sequences, then propose length normalization as the primary fix. Discuss variants like Google's length penalty and coverage penalty, and analyze trade-offs such as over-penalizing long sequences or introducing hyperparameters. Conclude with practical recommendations for tuning and evaluation.
Pro tip: Mention that length normalization can be applied during beam search or only at final ranking, and that the choice affects diversity and latency. Also note that in production, you might combine it with other heuristics like n-gram blocking.
Explain that summing log-probabilities makes longer sequences have lower (more negative) scores, so beam search favors shorter outputs. This is because each additional token adds a negative log-probability.
Propose dividing the cumulative log-probability by a length penalty term, such as length^α or ((5+len)/6)^α, to make scores comparable across lengths. Mention that α is a hyperparameter controlling the strength of normalization.
Cover other approaches like coverage penalty to encourage attending to all input tokens, or using a weighted combination of length and coverage. Also mention that some models use a learned length predictor.
Highlight that length normalization can lead to overly long or short sequences if α is mis-tuned, and may reduce diversity. Also note that it adds hyperparameter tuning overhead and can affect inference speed if applied during search.
Suggest tuning α on a validation set using metrics like BLEU or ROUGE, and applying normalization only at final ranking to avoid search distortion. Emphasize monitoring output length distribution and task-specific needs.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.