Tree of Thoughts (Yao et al., 2023) explores reasoning as a search. At each depth it generates several candidate thoughts, scores them with the model, and keeps only the best few. Keeping the top b states is that beam step.
Implement select_top_b(states, scores, b), returning the b best states in order.
Sort the indices by score descending, then take the first b states.
No results yet
Run your code to check it against the examples, or submit to run every test.