Large Language Models (LLMs) have recently made significant advances in code generation through the 'Chain-of-Thought' prompting technique. This technique empowers the model to autonomously devise "solution plans" to tackle intricate programming challenges, thereby improving its performance in code generation. Nevertheless, smaller models have been struggling to keep up with LLMs in deducing these plans, adversely affecting their code generation capabilities. Given the considerable size and associated deployment costs, along with concerns about data security, many teams opt for deploying smaller models for code generation. Consequently, there arises a compelling need for transferring LLMs' code generation reasoning abilities to the smaller models. In this paper, we propose the CodePLAN framework, which aims to transfer LLMs' reasoning capabilities to smaller models through distillation. We adopt a multi-task learning approach, jointly undertaking code generation and solution plan generation tasks, to enhance the code generation capabilities of the smaller model. To ensure the superior quality of the solution plans, we advocate for the utilization of backward reasoning and plan sampling strategies. Our experiments show that in comparison to the conventional fine-tuning approach, our approach improves the smaller model's code generation performance (measured in pass@1 metric) by over 130% on the challenging APPS benchmark.
翻译:大型语言模型(LLMs)近期通过“思维链”(Chain-of-Thought)提示技术在代码生成领域取得了显著进展。该技术使模型能够自主设计“解决方案规划”以应对复杂的编程挑战,从而提升代码生成性能。然而,小型模型在推导这些规划方面一直难以跟上LLMs的步伐,对其代码生成能力产生了不利影响。鉴于LLMs的庞大规模及相关部署成本,加之对数据安全的担忧,许多团队选择部署小型模型进行代码生成。因此,迫切需要将LLMs的代码生成推理能力迁移至小型模型。本文提出了CodePLAN框架,旨在通过蒸馏将LLMs的推理能力转移给小型模型。我们采用多任务学习方法,联合执行代码生成与解决方案规划生成任务,以增强小型模型的代码生成能力。为确保解决方案规划的高质量,我们提倡使用反向推理与规划采样策略。实验结果表明,与传统微调方法相比,我们的方法在具有挑战性的APPS基准测试上将小型模型的代码生成性能(以pass@1指标衡量)提升了超过130%。