Contents5 sections
Beam width is an engineering choice
My research at Arbitr (ASX: AGT; formerly Straker) has included decoding methods for translation. This public note explains how to reason about beam search without reproducing company model configurations or experimental results.
How beam search works
Greedy decoding retains the highest-scoring next token at each step. Beam search instead retains a limited set of candidate sequences. The beam width controls how many candidates survive as decoding proceeds.
- Start with the initial sequence.
- Expand the surviving candidates with possible next tokens.
- Score the resulting sequences using the decoder's scoring rule.
- Keep the highest-scoring candidates up to the beam width.
- Continue until the stopping conditions are met.
Keeping more candidates explores alternatives that greedy decoding discards. It does not guarantee a better translation: the model's sequence score is not the same thing as human quality, and length penalties and stopping rules affect which sequence wins.
Measure quality in more than one way
BLEU measures word-level n-gram overlap with reference translations; chrF measures character-level overlap. Learned metrics such as BLEURT estimate quality using a trained model. Translation Edit Rate measures the edits needed to match a reference, with lower values generally preferred.
These measures answer different questions. A change that improves overlap may not improve terminology, meaning, or style. Inspect examples where the measures disagree rather than treating agreement between scores as proof that an output is correct.
Measure the cost on the actual workload
Wider search can require more memory and computation. The size of that cost depends on the decoder implementation, batch size, sequence lengths, model, and hardware. A percentage measured in one configuration is not a general sizing rule.
For a useful experiment, keep those factors fixed while varying beam width. Use held-out translation data and record peak memory, latency, throughput, and quality together. If batching changes in deployment, repeat the measurement at that workload rather than extrapolating from an isolated request.
Choose from the tradeoff
Look for configurations where additional search has a useful quality benefit within the resource budget. There is no universally optimal beam width. The right choice depends on what the application values and what its evaluation can reliably distinguish.
Adapted from the original company publication.