Beam Search › Key Parameters

Michael BrenndoerferMay 22, 20251 min read
Language AI HandbookAll chapters
Part 12 of 67Sequence-to-Sequence
Chapter 85Beam Search › Key Parameters
Reading section 11 of 17 · Key Parameters · 1 minSection 11 of 17 · 1 min

Book contents

Section 11 of 17 · 1 min read

Beam Search › Key ParametersOne section · Sections in this chapter11 / 17 ↓
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 kk. 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.