arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.13271cs.SE
收藏

通过蒸馏 LLM 的推理能力增强较小模型的代码生成性能

Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs

Zhihong Sun, Chen Lyu, Bolun Li, Yao Wan, Hongyu Zhang, Ge Li, Zhi Jin

AI总结:

针对较小模型代码生成推理能力不足的问题,提出 CodePLAN 框架,通过多任务学习和逆向推理等蒸馏策略转移 LLMs 的推理能力,在 APPS 基准上 pass@1 性能提升超 130%。

摘要:

大型语言模型(LLMs)近期通过“思维链”提示技术在代码生成方面取得了显著进展。该技术使模型能够自主制定“解决方案计划”来应对复杂的编程挑战,从而提升其代码生成性能。然而,较小模型在推导这些计划方面一直难以跟上 LLMs,这对其代码生成能力产生了不利影响。鉴于模型规模庞大及相关部署成本,加上对数据安全的担忧,许多团队选择部署较小模型进行代码生成。因此,将 LLMs 的代码生成推理能力转移到较小模型的需求变得十分迫切。在本文中,我们提出了 CodePLAN 框架,旨在通过蒸馏将 LLMs 的推理能力转移到较小模型。我们采用多任务学习方法,联合执行代码生成和解决方案计划生成任务,以增强较小模型的代码生成能力。为确保解决方案计划的高质量,我们主张采用逆向推理和计划采样策略。实验表明,与常规微调方法相比,我们的方法在具有挑战性的 APPS 基准上将较小模型的代码生成性能(以 pass@1 指标衡量)提升了 130% 以上。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑