How can the the model outputs multiple candidates when decoding?

The model can output the best candidate after beam search. And I want to get the second best and the third best candidatas. Can this be realized?