Enhancing Code Generation Performance of Smaller Models by Distilling the Reasoning Ability of LLMs
Preprint
Abstract
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.Keywords
All Related Versions
This publication has 12 references indexed in Scilit:
- Self-Planning Code Generation with Large Language ModelsACM Transactions on Software Engineering and Methodology, 2024
- IRCoCo: Immediate Rewards-Guided Deep Reinforcement Learning for Code CompletionProceedings of the ACM on Software Engineering, 2024
- Knowledge-Aware Code Generation with Large Language Models2024
- Automatic Prompt Augmentation and Selection with Chain-of-Thought from Labeled Data2023
- Distilling Step-by-Step! Outperforming Larger Language Models with Less Training Data and Smaller Model Sizes2023
- Large Language Models Are Reasoning Teachers2023
- Embedding API dependency graph for neural code generationEmpirical Software Engineering, 2021
- CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation2021
- TRANX: A Transition-based Neural Abstract Syntax Parser for Semantic Parsing and Code Generation2018
- Toward automatic program synthesisCommunications of the ACM, 1971