In this paper, the authors explore the challenge of algorithmic reasoning for large language models (LLMs) and propose a new framework called Think-and-Execute. This framework involves discovering task-level logic shared across instances, expressing it in pseudocode in the Think step, and then tailoring it to each instance and simulating execution in the Execute step. The authors demonstrate the effectiveness of Think-and-Execute in improving LMs’ reasoning abilities compared to other strong baselines. Surprisingly, they find that pseudocode can guide LMs’ reasoning better than natural language instructions, even though LMs are trained to follow the latter.
https://arxiv.org/abs/2404.02575