Beam search maintains several candidate output sequences, beams, in parallel at each generation step, extending each beam with its most likely next tokens and keeping only the overall highest-scoring beams to continue forward, rather than committing to a single sequence one token at a time the way greedy decoding does. This parallel exploration lets beam search avoid some of greedy decoding's failure mode, getting stuck with a locally optimal but globally suboptimal sequence, by keeping multiple promising candidate sequences alive simultaneously rather than irrevocably committing to the single best-looking choice at every individual step.