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.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Reflective Thought and Code for Solving Numerical Problems with Large Language Models

  • Long Tri Thai Son,
  • Ngo Viet Anh,
  • Nguyen Thi Thuy Linh,
  • Nguyen Viet Ha

摘要

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.