Reflective Thought and Code for Solving Numerical Problems with Large Language Models
摘要
Large language models (LLMs) have achieved strong performance on many reasoning tasks but remain limited in solving computational problems, where precise reasoning and correct numerical calculation are essential. Therefore, common prompting strategies often produce flawed intermediate steps or incorrect results when applied to math and physics problems. We propose Reflective Thought and Code (RTC), a two-phase framework that separates problem solving into a thought phase, where the model generates an abstract solution plan, and a code phase, where executable programs are synthesized and run to compute the answer. To improve reliability, we add reflection step to each phase to enable self-evaluation and revision. Experiments on PhysQA, PhysReason, and MATH benchmarks showed that RTC achieves better performance than standard prompting baselines while offering more interpretable outputs.