Interactive Code Generation via Test-Driven User-Intent Formalization

08/11/2022
by   Shuvendu K. Lahiri, et al.
0

Pre-trained large language models (LLMs) such as OpenAI Codex have shown immense potential in automating significant aspects of coding by producing natural code from informal natural language (NL) intent. However, the code produced does not have any correctness guarantees around satisfying user's intent. In fact, it is hard to define a notion of correctness since natural language can be ambiguous and lacks a formal semantics. In this paper, we take a first step towards addressing the problem above by proposing the workflow of test-driven user-intent formalization (TDUIF), which leverages lightweight user feedback to jointly (a) formalize the user intent as tests (a partial specification), and (b) generates code that meets the formal user intent. To perform a scalable and large-scale automated evaluation of the algorithms without requiring a user in the loop, we describe how to simulate user interaction with high-fidelity using a reference solution. We also describe and implement alternate implementations of several algorithmic components (including mutating and ranking a set of tests) that can be composed for efficient solutions to the TDUIF problem. We have developed a system TICODER that implements several solutions to TDUIF, and compare their relative effectiveness on the MBPP academic code generation benchmark. Our results are promising with using the OpenAI Codex LLM on MBPP: our best algorithm improves the pass@1 code generation accuracy metric from 48.39 user query, and up to 85.48 a non-trivial functional unit test consistent with the user intent within an average of 1.69 user queries for 90.40

READ FULL TEXT

page 4

page 12

research
05/02/2023

Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation

Program synthesis has been long studied with recent approaches focused o...
research
08/17/2020

Resolving Intent Ambiguities by Retrieving Discriminative Clarifying Questions

Task oriented Dialogue Systems generally employ intent detection systems...
research
12/25/2013

Description Logics based Formalization of Wh-Queries

The problem of Natural Language Query Formalization (NLQF) is to transla...
research
12/19/2022

Asking Clarification Questions for Code Generation in General-Purpose Programming Language

Code generation from text requires understanding the user's intent from ...
research
10/06/2018

The Intuitive Power of Graph Pivots For User Exploration and Adaptive Data Abstraction

This paper reports on a simple visual technique that boils extracting a ...
research
07/13/2022

DocCoder: Generating Code by Retrieving and Reading Docs

Natural-language-to-code models learn to generate a code snippet given a...
research
12/29/2019

Synthesizing Queries via Interactive Sketching

We propose a novel approach to program synthesis, focusing on synthesizi...

Please sign up or login with your details

Forgot password? Click here to reset