Prompting schemes such as Chain of Thought, Tree of Thoughts, and Graph of Thoughts can significantly enhance the reasoning capabilities of large language models. However, most existing schemes require users to define static, problem-specific reasoning structures that lack adaptability to dynamic or unseen problem types. Additionally, these schemes are often under-optimized in terms of hyperparameters, prompts, runtime, and prompting cost. To address these limitations, we introduce Framework of Thoughts (FoT)--a general-purpose foundation framework for building and optimizing dynamic reasoning schemes. FoT comes with built-in features for hyperparameter tuning, prompt optimization, parallel execution, and intelligent caching, unlocking the latent performance potential of reasoning schemes. We demonstrate FoT's capabilities by implementing three popular schemes--Tree of Thoughts, Graph of Thoughts, and ProbTree--within FoT. We empirically show that FoT enables significantly faster execution, reduces costs, and achieves better task scores through optimization. We release our codebase to facilitate the development of future dynamic and efficient reasoning schemes.
翻译:诸如思维链、思维树与思维图等提示方案能够显著增强大型语言模型的推理能力。然而,现有方案大多要求用户定义静态的、针对特定问题的推理结构,这些结构缺乏对动态或未知问题类型的适应性。此外,这些方案在超参数、提示词、运行时间及提示成本方面往往未得到充分优化。为应对这些局限性,我们提出了思维框架——一个用于构建与优化动态推理方案的通用基础框架。FoT 内置了超参数调优、提示优化、并行执行与智能缓存等功能,能够释放推理方案的潜在性能。我们通过在 FoT 中实现三种主流方案——思维树、思维图与概率树——展示了 FoT 的能力。实验结果表明,FoT 通过优化实现了显著更快的执行速度、更低的成本以及更高的任务得分。我们公开了代码库,以促进未来动态高效推理方案的开发。