Fixed a critical logic error in beam_search where the new_top_k dictionary was being prematurely reset inside the iteration loop. By moving the initialization outside the loop, the algorithm now correctly aggregates all candidates before performing the top-k selection. This ensures the beam search maintains coherence across candidates throughout the expansion process. Debugging