Planning with Large Language Models for Code Generation

AI-generated keywords: Code Generation Transformer Decoding Planning Algorithm Public Test Cases Program Quality

AI-generated Key Points

The license of the paper does not allow us to build upon its content and the key points are generated using the paper metadata rather than the full article.

  • Existing large language model-based pipelines often use beam search or sampling algorithms for code generation
  • These methods can result in issues like failed compilation or incorrect outputs
  • Conventional Transformer decoding algorithms may not be suitable for code generation tasks
  • The authors propose a novel Transformer decoding algorithm called Planning-Guided Transformer Decoding (PG-TD)
  • PG-TD incorporates a planning algorithm that performs lookahead search and guides the Transformer in generating improved programs
  • The Transformer utilizes a planner to generate candidate programs and evaluates them against public test cases
  • This allows the Transformer to make more informed decisions and generate higher-quality programs
  • A mechanism is designed to facilitate information sharing between the Transformer and the planner for computational efficiency
  • Empirical evaluation shows that PG-TD consistently generates programs with higher performance compared to baseline methods
  • PG-TD enables controllable code generation by optimizing modified objectives such as concise codes or highly-commented codes
  • Overall, PG-TD improves code generation in large language model-based pipelines by incorporating planning algorithms and leveraging public test cases.
Also access our AI generated: Comprehensive summary, Lay summary, Blog-like article; or ask questions about this paper to our AI assistant.

Authors: Shun Zhang, Zhenfang Chen, Yikang Shen, Mingyu Ding, Joshua B. Tenenbaum, Chuang Gan

ICLR 2023. Project page:https://codeaimcts.github.io

Abstract: Existing large language model-based code generation pipelines typically use beam search or sampling algorithms during the decoding process. Although the programs they generate achieve high token-matching-based scores, they often fail to compile or generate incorrect outputs. The main reason is that conventional Transformer decoding algorithms may not be the best choice for code generation. In this work, we propose a novel Transformer decoding algorithm, Planning-Guided Transformer Decoding (PG-TD), that uses a planning algorithm to do lookahead search and guide the Transformer to generate better programs. Specifically, instead of simply optimizing the likelihood of the generated sequences, the Transformer makes use of a planner to generate candidate programs and test them on public test cases. The Transformer can therefore make more informed decisions and generate tokens that will eventually lead to higher-quality programs. We also design a mechanism that shares information between the Transformer and the planner to make our algorithm computationally efficient. We empirically evaluate our framework with several large language models as backbones on public coding challenge benchmarks, showing that 1) it can generate programs that consistently achieve higher performance compared with competing baseline methods; 2) it enables controllable code generation, such as concise codes and highly-commented codes by optimizing modified objective.

Submitted to arXiv on 09 Mar. 2023

Ask questions about this paper to our AI assistant

You can also chat with multiple papers at once here.

The license of the paper does not allow us to build upon its content and the AI assistant only knows about the paper metadata rather than the full article.

AI assistant instructions?

Results of the summarizing process for the arXiv paper: 2303.05510v1

This paper's license doesn't allow us to build upon its content and the summarizing process is here made with the paper's metadata rather than the article.

In the field of code generation, existing large language model-based pipelines often rely on beam search or sampling algorithms during the decoding process. While these methods may produce programs with high token-matching scores, they frequently encounter issues such as failed compilation or incorrect outputs. This can be attributed to the fact that conventional Transformer decoding algorithms may not be the most suitable choice for code generation tasks. To address this limitation, the authors propose a novel Transformer decoding algorithm called Planning-Guided Transformer Decoding (PG-TD). This approach incorporates a planning algorithm that performs lookahead search and guides the Transformer in generating improved programs. Instead of solely optimizing the likelihood of generated sequences, the Transformer utilizes a planner to generate candidate programs and evaluates them against public test cases. By doing so, the Transformer can make more informed decisions and generate tokens that ultimately lead to higher-quality programs. To ensure computational efficiency, the authors design a mechanism that facilitates information sharing between the Transformer and the planner. This optimization enhances the overall performance of their algorithm. The framework is empirically evaluated using several large language models as backbones on public coding challenge benchmarks. The results demonstrate two key findings: firstly, it consistently generates programs with higher performance compared to competing baseline methods; secondly, it enables controllable code generation by optimizing modified objectives such as concise codes or highly-commented codes. Overall, this work introduces PG-TD as an innovative approach to improve code generation in large language model-based pipelines. By incorporating planning algorithms and leveraging public test cases, this method enhances program quality and offers controllability in generating different types of code structures.
Created on 27 Dec. 2023

Assess the quality of the AI-generated content by voting

Score: 0

Why do we need votes?

Votes are used to determine whether we need to re-run our summarizing tools. If the count reaches -10, our tools can be restarted.

The previous summary was created more than a year ago and can be re-run (if necessary) by clicking on the Run button below.

The license of this specific paper does not allow us to build upon its content and the summarizing tools will be run using the paper metadata rather than the full article. However, it still does a good job, and you can also try our tools on papers with more open licenses.

Similar papers summarized with our AI tools

Navigate through even more similar papers through a

tree representation

Look for similar papers (in beta version)

By clicking on the button above, our algorithm will scan all papers in our database to find the closest based on the contents of the full papers and not just on metadata. Please note that it only works for papers that we have generated summaries for and you can rerun it from time to time to get a more accurate result while our database grows.

Disclaimer: The AI-based summarization tool and virtual assistant provided on this website may not always provide accurate and complete summaries or responses. We encourage you to carefully review and evaluate the generated content to ensure its quality and relevance to your needs.