HyperAIHyperAI

Command Palette

Search for a command to run...

5 months ago

Planning-Driven Programming: A Large Language Model Programming Workflow

Lei Chao ; Chang Yanchuan ; Lipovetzky Nir ; Ehinger Krista A.

Planning-Driven Programming: A Large Language Model Programming Workflow

Abstract

The strong performance of large language models (LLMs) raises extensivediscussion on their application to code generation. Recent research suggestscontinuous program refinements through visible tests to improve code generationaccuracy in LLMs. However, these methods suffer from LLMs' inefficiency andlimited reasoning capacity. In this work, we propose an LLM programmingworkflow (LPW) designed to improve both initial code generation and subsequentrefinements within a structured two-phase workflow. Specifically, the solutiongeneration phase formulates a solution plan, which is then verified throughvisible tests to specify the intended natural language solution. Subsequently,the code implementation phase drafts an initial code according to the solutionplan and its verification. If the generated code fails the visible tests, theplan verification serves as the intended solution to consistently inform therefinement process for correcting bugs. Compared to state-of-the-art methodsacross various existing LLMs, LPW significantly improves the Pass@1 accuracy byup to 16.4% on well-established text-to-code generation benchmarks. LPW alsosets new state-of-the-art Pass@1 accuracy, achieving 98.2% on HumanEval, 84.8%on MBPP, 59.3% on LiveCode, 62.6% on APPS, and 34.7% on CodeContest, usingGPT-4o as the backbone. Our code is publicly available at:https://github.com/you68681/lpw

Code Repositories

you68681/lpw
Official
Mentioned in GitHub

Benchmarks

BenchmarkMethodologyMetrics
code-generation-on-appsLPW (GPT-4o)
Competition Pass@1: 34.8
Interview Pass@1: 65.2
Introductory Pass@1: 87.2
code-generation-on-codecontestsLPW (GPT-4o)
Test Set pass@1: 34.7
code-generation-on-humanevalLPW (GPT-4o)
Pass@1: 98.2
code-generation-on-livecodebenchLPW (GPT-4o)
Acc: 59.3
code-generation-on-mbppLPW (GPT-4o)
Accuracy: 84.8

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp