Self-planning Code Generation with Large Language Model

03/12/2023
by   Xue Jiang, et al.
0

Although large language models have demonstrated impressive ability in code generation, they are still struggling to address the complicated intent provided by humans. It is widely acknowledged that humans typically employ planning to decompose complex problems and schedule the solution steps prior to implementation. Thus we introduce planning into code generation to help the model understand complex intent and reduce the difficulty of problem solving. This paper proposes a self-planning code generation method with large language model, which consists of two phases, namely planning phase and implementation phase. Specifically, in the planning phase, the language model plans out the solution steps from the intent combined with in-context learning. Then it enters the implementation phase, where the model generates code step by step, guided by the solution steps. The effectiveness of self-planning code generation has been rigorously evaluated on multiple code generation datasets and the results have demonstrated a marked superiority over naive direct generation approaches with language model. The improvement in performance is substantial, highlighting the significance of self-planning in code generation tasks.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/11/2023

Teaching Large Language Models to Self-Debug

Large language models (LLMs) have achieved impressive performance on cod...
research
06/01/2023

Interpretable Math Word Problem Solution Generation Via Step-by-step Planning

Solutions to math word problems (MWPs) with step-by-step explanations ar...
research
08/26/2023

ISR-LLM: Iterative Self-Refined Large Language Model for Long-Horizon Sequential Task Planning

Motivated by the substantial achievements observed in Large Language Mod...
research
02/05/2022

Ethics, Rules of Engagement, and AI: Neural Narrative Mapping Using Large Transformer Language Models

The problem of determining if a military unit has correctly understood a...
research
01/25/2023

Language Model Detoxification in Dialogue with Contextualized Stance Control

To reduce the toxic degeneration in a pretrained Language Model (LM), pr...
research
08/16/2023

Detoxify Language Model Step-by-Step

Detoxification for LLMs is challenging since it requires models to avoid...
research
07/18/2023

How is ChatGPT's behavior changing over time?

GPT-3.5 and GPT-4 are the two most widely used large language model (LLM...

Please sign up or login with your details

Forgot password? Click here to reset