Implement beam search with the length penalty of Attention Is All You Need over a simplified, deterministic model.
length_penalty(length, alpha)
beam_search(log_probs, beam_size, alpha, eos_id)
log_probs has shape (max_len, vocab): row t is the log-probability of each next token at step t, regardless of the prefix.t, extend every live hypothesis with every token, adding log_probs[t, tok] to its total.length_penalty(len, alpha), where len is its number of tokens (including eos_id).beam_size best candidates by score; ties go to the lexicographically smaller token sequence. Kept candidates ending in eos_id are finished and not extended further; the rest stay live.max_len steps; hypotheses still live then join the finished set.(sequence, score): the finished hypothesis with the highest score (same tie-break) as a list of Python ints, and its score rounded to 4 decimals.