Ordinary beam search only prunes candidates based on beam size (Lines 15-16), while the proposed method adds a merger to prune extra equivalent states (Lines 6-10).
many of the NMT output sequences are quite similar and they typically contain only local differences that do not influence future decoding significantly.