Fully Autonomous Programming with Large Language Models

Vadim Liventsev,Anastasiia Grishina,Aki Härmä,Leon Moonen
DOI: https://doi.org/10.1145/3583131.3590481
2023-04-21
Abstract:Current approaches to program synthesis with Large Language Models (LLMs) exhibit a "near miss syndrome": they tend to generate programs that semantically resemble the correct answer (as measured by text similarity metrics or human evaluation), but achieve a low or even zero accuracy as measured by unit tests due to small imperfections, such as the wrong input or output format. This calls for an approach known as Synthesize, Execute, Debug (SED), whereby a draft of the solution is generated first, followed by a program repair phase addressing the failed tests. To effectively apply this approach to instruction-driven LLMs, one needs to determine which prompts perform best as instructions for LLMs, as well as strike a balance between repairing unsuccessful programs and replacing them with newly generated ones. We explore these trade-offs empirically, comparing replace-focused, repair-focused, and hybrid debug strategies, as well as different template-based and model-based prompt-generation techniques. We use OpenAI Codex as the LLM and Program Synthesis Benchmark 2 as a database of problem descriptions and tests for evaluation. The resulting framework outperforms both conventional usage of Codex without the repair phase and traditional genetic programming approaches.
Software Engineering,Artificial Intelligence,Neural and Evolutionary Computing
What problem does this paper attempt to address?
The paper attempts to address the issue of "near miss syndrome" in program synthesis using large language models (LLMs). Specifically, current methods can generate programs that are semantically similar to the correct answer, but due to minor flaws (such as input or output format errors), these programs perform poorly in unit tests or even fail to pass the tests entirely. To solve this problem, the paper proposes a method called "Synthesize, Execute, Debug (SED)," which first generates a draft solution and then fixes the failed tests through a debugging phase. To effectively apply this method to instruction-driven LLMs, it is necessary to determine which prompts work best as instructions for the LLM and to find a balance between fixing failed programs and regenerating new ones. The paper conducts empirical studies comparing different debugging strategies and prompt generation techniques, aiming to improve the accuracy and efficiency of program synthesis.