[Paper Review] Latent Execution for Neural Program Synthesis Beyond Domain-Specific Languages
LaSynth proposes a novel neural program synthesis approach that learns latent representations to approximate the execution of partially valid C programs, enabling effective synthesis from input-output examples. By modeling program execution in a latent space, it achieves superior performance over prior methods and generates more concise, human-like code.
Program synthesis from input-output examples has been a long-standing challenge, and recent works have demonstrated some success in designing deep neural networks for program synthesis. However, existing efforts in input-output neural program synthesis have been focusing on domain-specific languages, thus the applicability of previous approaches to synthesize code in full-fledged popular programming languages, such as C, remains a question. The main challenges lie in two folds. On the one hand, the program search space grows exponentially when the syntax and semantics of the programming language become more complex, which poses higher requirements on the synthesis algorithm. On the other hand, increasing the complexity of the programming language also imposes more difficulties on data collection, since building a large-scale training set for input-output program synthesis require random program generators to sample programs and input-output examples. In this work, we take the first step to synthesize C programs from input-output examples. In particular, we propose LaSynth, which learns the latent representation to approximate the execution of partially generated programs, even if their semantics are not well-defined. We demonstrate the possibility of synthesizing elementary C code from input-output examples, and leveraging learned execution significantly improves the prediction performance over existing approaches. Meanwhile, compared to the randomly generated ground-truth programs, LaSynth synthesizes more concise programs that resemble human-written code. We show that training on these synthesized programs further improves the prediction performance for both Karel and C program synthesis, indicating the promise of leveraging the learned program synthesizer to improve the dataset quality for input-output program synthesis.
Motivation & Objective
- To address the challenge of synthesizing full-fledged programming languages like C from input-output examples, which existing methods have largely overlooked.
- To overcome the exponential growth of program search space and difficulties in data collection for complex languages.
- To develop a method that can reason about partially valid programs by learning latent representations of program execution.
- To improve synthesis performance and generate more concise, human-like code compared to baseline approaches.
Proposed method
- LaSynth learns a latent representation that approximates the execution of partially generated programs, even when their syntax or semantics are incomplete.
- It uses a neural network to encode program prefixes and predict their latent execution states, enabling efficient search in the program space.
- The model is trained on a dataset of randomly generated C programs and their corresponding input-output examples.
- Latent execution is used as a differentiable proxy for program semantics, allowing gradient-based optimization during synthesis.
- The approach leverages the learned execution model to guide program search, improving both accuracy and code quality.
- Synthesized programs are used to augment training data, further improving performance on both C and Karel program synthesis tasks.
Experimental results
Research questions
- RQ1Can neural program synthesis be effectively extended to full-fledged programming languages like C, beyond domain-specific languages?
- RQ2How can latent representations be used to model program execution for syntactically incomplete or semantically ill-defined programs?
- RQ3Does learning to approximate program execution improve synthesis accuracy and code quality compared to standard approaches?
- RQ4Can synthesized programs be used to improve the quality of training data for input-output program synthesis?
Key findings
- LaSynth achieves improved prediction performance on C program synthesis tasks by leveraging latent execution modeling.
- The synthesized programs are more concise and resemble human-written code compared to randomly generated ground-truth programs.
- Training on the synthesized programs further enhances performance for both C and Karel program synthesis, indicating data quality improvement.
- The latent execution model enables effective search in complex program spaces where traditional methods fail.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.