Beam Search › Key Parameters
Michael BrenndoerferMay 22, 20251 min read
Language AI HandbookAll chapters Part 12 of 67Sequence-to-Sequence
Beam Search › Key ParametersOne section · Sections in this chapter11 / 17 ↓
Sections in this chapter17
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
The key parameters for beam search are:
- beam_width (k): Number of hypotheses maintained at each step. Larger values explore more of the search space but increase computation by a factor of . Common values: 4-6 for translation, 1-4 for large language model inference.
- alpha (length penalty): Controls how strongly length is penalized. 0 means no normalization; 1 means full normalization; 0.6 is a common practical default.
- max_length: Maximum output length. Usually set to 1.5 to 2 times the source length for translation.
- min_length: Minimum output length. Set to prevent degenerate EOS predictions.
- no_repeat_ngram_size: Block repeated n-grams to reduce repetition. Setting this to 3 or 4 prevents the model from repeating trigrams or 4-grams.