SEER:通过自探索深度推理增强思维链代码生成
SEER: Enhancing Chain-of-Thought Code Generation through Self-Exploring Deep Reasoning
AI总结:
本文提出SEER框架,将CoT代码生成建模为决策问题,通过自探索多样路径、质量感知的策略与价值模型训练及自适应推理切换,提升代码生成的泛化性、可靠性与效率。
摘要:
代码生成是根据自然语言需求创建可执行程序的任务,近来借助思维链(CoT)推理取得了巨大进展;CoT使大型语言模型(LLM)能够在编写代码之前制定高层推理计划。近期研究提出了多种增强模型用于代码生成的CoT推理的方法,例如提示工程和监督微调。然而,现有方法仍面临三个关键局限:(1)对多样化推理路径的探索有限,这限制了其在各种编程场景中的泛化能力;(2)缺乏对中间推理步骤的质量评估,这损害了所生成计划和代码的可靠性;(3)“过度思考”的潜在负面影响,可能导致不必要地复杂且错误的解决方案。为解决这些局限,我们将CoT代码生成表述为一个决策问题,并提出SEER,这是一个自探索深度推理(SElf-Exploring deep Reasoning)框架,能够为代码生成实现准确且自适应的推理。SEER引入了三个关键组件:(1)多样化推理路径探索,旨在探索多样化推理路径并标注中间步骤,而无需依赖人工专家或闭源专有模型;(2)推理质量感知的模型训练,训练一个用于生成候选推理步骤的策略模型和一个用于评估其质量的价值模型;(3)自适应CoT推理,针对不同问题在直接生成和逐步推理之间动态切换。
英文摘要:
Code generation, the task of creating executable programs from natural language requirements, has recently seen tremendous advances through Chain-of-Thought (CoT) reasoning, which enables Large Language Models (LLMs) to develop high-level reasoning plans before writing code. Recent research has proposed various methods to enhance models' CoT reasoning for code generation such as prompt engineering and supervised fine-tuning. However, existing approaches still face three critical limitations: (1) limited exploration of diverse reasoning paths, which constrains generalization across various programming scenarios, (2) lack of quality assessment for intermediate reasoning steps, which hampers the reliability of the generated plans and code, and (3) the potential negative impact of "overthinking", potentially leading to unnecessarily complex and incorrect solutions. To address these limitations, we frame CoT code generation as a decision making problem and present SEER, a SElf-Exploring deep Reasoning framework that enables accurate and adaptive reasoning for code generation. SEER introduces three key components: (1) Diverse reasoning path exploration, which aims at exploring diverse reasoning paths and annotating intermediate steps without relying on manual experts or closed-source proprietary models; (2) Reasoning quality-aware model training, which trains a policy model for generating candidate reasoning steps and a value model for assessing their quality; and (3) Adaptive CoT reasoning, which dynamically switches between direct generation and step-by-step reasoning for different problems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。