Unlike greedy search that only considers the next most probable token, beam search takes into account the **N** most likely tokens, where **N** denotes the number of beams. This procedure is repeated until a predefined maximum sequence length is reached or an end-of-sequence token appears. At this point, the sequence of tokens (AKA "beam") with the highest overall score is chosen as the output. For example for beam size of 2 and maximum length of 5, the beam search needs to keep track of \(2^{5}=32\) possible sequences. So it is more computationally intensive than greedy search.