ANPL: Towards Natural Programming with Interactive Decomposition

Though LLMs are capable of generating plausible programs, it's challenging to interact with the LLMs further to revise the program, especially if the user's specific requirements are different from the initial proposal. In this paper, we introduce ANPL, an interactive programming system that ensures users can always refine the generated code towards their specific programmatic intents via structured decompositions. Borrowing the paradigm of sketching from program synthesis, an ANPL program consists of a set of input-outputs that it must satisfy, a ``sketch'' -- control/data flow expressed in precise code (e.g. Python), and ``holes'' -- sub-modules to be implemented by the LLM specified with natural language. The user revises an ANPL program by either modifying the sketch, changing the language used to describe the holes, or providing additional input-outputs to a particular hole, turning it into a sub-ANPL program that can be solved recursively. This workflow allows the users to offload programming burdens to the LLM as much as possible while retaining the ability to pinpoint and resolve bugs locally, without exposing the rest of the program to the LLM. We deploy ANPL on the Abstraction and Reasoning Corpus (ARC), a set of unique tasks that are challenging for state-of-the-art AI systems, showing it outperforms baseline programming systems that (a) without the ability to decompose tasks interactively and (b) without the guarantee that the modules can be correctly composed together. Additional evaluations on APPS, HumanEval, and real-world programming tasks have validated that the ANPL framework is applicable to multiple programming domains. We release the ANPL solutions to the ARC tasks as a dataset, providing insights into how humans decompose novel tasks programmatically. See our code at https://iprc-dip.github.io/ANPL/.

Paper

References (71)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer ecZq7/10 · confidence 4/52023-07-05

Summary

In this paper, the authors introduce Abstracted Natural Programming Language (ANPL), a programming language and system to improve Large Language Model (LLM) assisted programming. ANPL programs are structured in a top-down manner; a top level program called the "sketch" solves the task by specifying the data-flow between multiple secondary level sub-functions called "holes". Each "hole" encapsulates a textual description of its targeted functionality. This ANPL program is then translated into a conventional python program via the ANPL compiler, which uses LLMs to implement the "holes". Further, to help debug the generated/compiled program, the system provides features such as exposing execution traces and intelligently merging novel user edits to hole descriptions. Human study shows that compared to using LLMs naively, ANPL helps users solve programming tasks faster and with higher success rate. Finally, the paper also contributes a dataset of textual decomposition (by humans) of 300/400 reasoning tasks in the ARC benchmark, which can provide insights into how humans decompose programming tasks.

Strengths

### Originality The idea of improving programming by decomposing the program into sketches and holes in itself is not a novel idea (the authors properly cite previous works along this direction). However, structuring a LLM-augmented programming interface around this system is indeed novel. ### Quality The paper is well written. Further, it presents insightful experiments and ablations in the main paper as well as the extended appendix. ### Significance This paper targets the fastly-evolving direction of LLM assisted programming, and hence will be of interest to the research community at large. While "sketch-hole decompostion" is commonly used in LLM assisted programming, this paper provides a thorough human study to firmly establish the benefits of such an approach.

Weaknesses

While overall I believe its a well written paper, there are certain weaknesses with the presentation and the experiments section. ### Presentation / Clarity 1) The main paper does not clearly show *what* an ANPL program looks like - what is the input to the LLM?. The main paper only refers to Figure 1 which shows an ANPL program pictorially. While the ANPL compiler (written in ANPL) is in the paper, I believe it would be easier to understand the system with a clearer and explicit presentation of what a "sketch" is and what a "hole" is programmatically. 2) The main paper does not discuss the actual interface that the user uses (only shown in the appendix). As this is a crucial contribution of a "programming" system, I think it should also be shown in the main paper. 3) In general, the paper entangles a methodology contribution (using a sketch-hole paradigm for LLM assisted programming) with a system contribution (The interface, debugging features, merging features, test-case creation tools). ### Experiments 1) The interface seem to have additional features such as grid editor to create test cases etc. which may contribute to the user success. This make it harder the discern what parts of ANPL are essential. 2) An important baseline missing is users directly programming in python. On roughly 30% of the tasks, even with ANPL users take ~15 mins. Looking at the ARC challenge examples, I think directly programming in python may be faster than programming with ANPL (or the other baselines). 3) Program solutions which satisfy test cases but fail for train cases are counted as "successful" while measuring the success rate. (Refer Table 2 appendix and results in the main paper). If we count only the cases where both test and train cases are successful, the performance drops to 56.7% for ANPL versus 48.5% for naive LLM usage, which is significantly lower than the numbers used in the main paper. I think that successful programs should satisfy both train and test cases. ### Others 1) Many real world programming tasks are unlike the problems in ARC. Hence, its unclear if ANPL would be better than naive LLM systems in typical programming use-cases as well. 2) Another drawback of using ARC is that many tasks may involve sub-functions which are similar. Therefore users may benefit from know "what prompts works better" for certain sub-functions, and use them directly in future prompts (sort of saving the previously discovered functions). Therefore, a task benchmark where the tasks were more diverse might have been more suitable. 3) As GPT-4 seems to be much more performant than GPT-3.5 (used in the experiments) I wonder if the gap between ANPL and naive LLM usage is further decreased when larger LLMs are used.

Questions

I thank the authors for providing an extensive appendix which answers many of the questions I had. However, a few more are as follows: 1) How often do users get the "sketch" wrong - are there some cases where the failure is due to wrong sketch while the hole implementations are correct? 2) Can the authors briefly talk about the learning curve of using ANPL? 3) Can the authors justify the choice for using train-fail-test-success as successful programs while measuring success rate?

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

2 fair

Contribution

2 fair

Limitations

The authors have adequately addressed the limitations and potential negative societal impact of their work.

Reviewer tgZy5/10 · confidence 3/52023-07-06

Summary

This paper proposes ANPL, a programming system for user interaction with an LLM for code generation. The main idea is to have the user generate high-level dataflow and program structure, while directing the LLM to fill in the "holes." They present results of a user study of ANPL, where users are asked to write programs to solve ARC tasks, and show that ANPL outperforms a baseline of (undirected) user interaction with GPT-3.5 via ChatGPT, and one-shot program synthesis using ANPL and GPT-3.5.

Strengths

This paper presents a novel method of incorporating LLMs into a programming workflow. A major strength is the design of ANPL. Though the idea of decoupling a synthesis problem into a hole and a sketch is not new in program synthesis (or even neural program synthesis [1]), the application (and execution) here for an LLM-driven coding assistant seems novel and natural. The user study is also significant, and contains a lot of great analysis. The writing is also very clear. [1] Nye, Maxwell, et al. "Representing Partial Programs with Blended Abstract Semantics." International Conference on Learning Representations. 2020.

Weaknesses

My major concern is that the main contributions are (1) a programming system and (2) its evaluation. There is not much novelty on LLMs or even neural program synthesis. Some additional points about the design of the user study: - Most users in the user study were unfamiliar with code generation using LLMs (Figure 5 in the appendix), and only 1 prompt was provided as example (Figure 10 in the appendix). Therefore, it's not clear how much the difference in performance is due to inexperienced users of System B. For instance, the design of the study could have provided both the ANPL prompt (Figure 4 in the appendix) to the users as well, or given them some basic training first. - ARC is designed as a test of human intelligence, so the performance of a human + ANPL on ARC doesn't directly translate into performance on writing programs. Ideally the results would have included an additional dataset designed for synthesis (such as MBPP or HumanEval).

Questions

Can you provide results for users aggregated by the language model code generation experience? The performance of System B appears to saturate very quickly. This could be due to a degradation in performance of System B over time, for instance, as the context grows too long. Were the contexts for the LLMs reset at any point for either ANPL or System B?

Rating

5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

4 excellent

Presentation

4 excellent

Contribution

2 fair

Limitations

Yes

Reviewer neh76/10 · confidence 4/52023-07-07

Summary

The paper proposes ANLP, a framework that interactively gets the definition of the data flow of a program from user input, and then fill the "holes" in the sketched program using LLMs. The authors conducted comprehensive human experiments on the Abstraction and Reasoning Corpus by letting human subjects solve the problems using an off-the-shelf language model and the ANPL-wrapper language model. The results show that with ANLP people are better at solving ARC problems.

Strengths

1. Splitting the burden of reasoning between human programmers and language models is reasonable. Humans can focus on higher-level planning and leave the implementation details to language models. 2. The evaluation with human subjects is convincing. In terms of solving rate and efficiency, it's clear that ANPL is easier to use than bare ChatGPT. 3. Letting users define the dataflow in a python-like language is friendly for programmers and easy for the model to understand.

Weaknesses

1. The idea of decomposing a task into modular functions is not new. As the authors have mentioned, even under the LLM setting it's been used by Parsel (https://arxiv.org/pdf/2212.10561.pdf). Even though the authors emphasizes the novelty of human interaction, I don't find your system significantly different from theirs. Of course your human evaluation is much more comprehensive. 2. Evaluating on ARC alone seems not enough. While the tasks seem good for testing the reasoning ability, it is not clear whether ANPL can work for real-world applications that help actual programmers. The definition of data flow can get complicated and harder for the model to understand as the program gets longer.

Questions

1. Does ANPL work well for complicated data flows and longer programs? 2. Does ANPL work for real world applications at larger scales?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

2 fair

Presentation

2 fair

Contribution

2 fair

Limitations

The authors have addressed the limitations.

Reviewer NKWp6/10 · confidence 3/52023-07-09

Summary

ANPL proposes a Sketch guided program synthesis using Natural Language in an interactive fashion.The results show better interactive coding than base LLM.

Strengths

The paper shows potential in using sketch guided methods in conjunction with LM inference. It can be a good tool to use for debugging and potentially to teach programming.

Weaknesses

Though the method show promise, some amount of work is necessary to justify the applicability of the system in wider settings. Some proof of guarantee on how the sketch helps in overall synthesis can also throw some light to the reader on why a system like this can be useful and should be adopted by wider research community. Some specific points: 1. Although an interesting direction, it would have been great to see the performance of the model in general purpose programming tasks, and not only for debugging. 2. The availability of only a specific syntax seem very limiting to applicability. It is not clear on how to use the system for new domains. 3. Some recent works on LLM that work in conjunction with Sketch guided synthesis seem to be missing.

Questions

1. How do we extend the system to a general purpose program decomposition problem solving method?

Rating

6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

2 fair

Presentation

3 good

Contribution

2 fair

Limitations

The limitations section need considerable improvement.

Authorsrebuttal2023-08-18

Dear reviewer, we look forward to your response

Note that the discussion will be ended in 4 days, we kindly request reviewer NKWp engage in the discussion. During the rebuttal period, we carried out additional experiments and are here to ensure that we have addressed all questions or doubts regarding to general programming tasks, new domains, and related work. We hope everything is clear and the recent experiments have addressed the concerns. Thanks!

Reviewer NKWp2023-08-22

Thank you for your response

Thank you for responding to the doubts. I have carefully read the author response and re-read the manuscript. The particularities of the presentation of the paper made it a bit unclear on what exactly the contribution of the paper was. It was unclear that the authors have proposed a general purpose solution, which was my main concern. Overall the contribution of this paper is good and after careful consideration I have modified my initial score. I still urge the authors to add some additional insights in the conclusion of the paper and expanding on the limitations with focus on future extensions.

Authorsrebuttal2023-08-22

We thank the reviewer for the response! We will revise our paper carefully to make our contributions, limitations, and future extensions clearer (the detailed plan can be seen in our response to reviewer ecZq)!

Reviewer tgZy2023-08-12

Thanks for the response. I am satisfied with the choice of ARC as the dataset as well as the additional details on the experimental evaluation. I maintain my concerns about the core contributions: a programming system based on the combination of sketch-based synthesis with hand-engineered LLM prompts, neither of which is novel. I have therefore increased my score to a 5, but will not complain if the paper is ultimately accepted.

Authorsrebuttal2023-08-13

Thanks for your reply and here is the response to address your remaining concern

Thank you for increasing your score and further elaborating on the remaining concern! ### About the system innovation We conclude that our contribution as proposing **an interactive programming system** to significantly reduce programming complexity and assure code quality, where the users can iteratively interact with the system to **safely ground their minds to code**, is novel. And we believe that this kind of system is important to the development of the community by enabling users with limited programming experience to reliably program for user-specific demands with natural language in various domains including product design, robot control, etc. Additionally, the data generated in such a programming system (like the DARC dataset proposed in this paper, the ANPL code of APPS, ANPL projects like LS-8 CPU, etc.) can facilitate the advancement of relevant fields like program synthesis, human-ai interaction, and cognitive science. ### About the technique innovation **It is inappropriate to simply attribute ANPL to sketch + prompt**, as the scope of "sketch" is too broad and can encompass many things. A more proper understanding is that ANPL is based on (1) **the natural language programming paradigm** of separating control/data flow and sub-functions and (2) the corresponding **compiler**, which is designed to allow users to interact with the system and safely ground their intentions into the program. Techniques like AST parsing, code merging, and LLM prompting (only a simple prompt) are part of the compiler (Section 4). Specifically, for (1), we clarify that the programming paradigm of ANPL is **not similar to the ones before** and we merely leverage "sketch + holes" as a way of explaining our work in a language familiar to the community. "Sketch + holes" is a general philosophy adopted in program synthesis and **the key is to define the specific sketch and hole elements**. For example, the "sketch" in [1] represents the high-level natural language plan, the "sketch" in [2] represents the relevant part of the retrieved code, the "hole" in [3] represents unfinished code, and in SKETCH[4], the "hole" is an integer. **In our work**, the key insight is that control/data flows are important in conveying user intent with a small part of user effort while sub-functions stand in contrast. Thus, it is a sweet point for the trade-off between less user effort and more accurate user intent. **Under this insight**, we named the explicit control/data flows "sketch" and natural language sub-functions "holes" to make the idea easy to understand by the community. For (2), there might be a misunderstanding because prompt engineering is not the main part of the compiler. The compiler of ANPL consists of multiple important components including AST parsing, code merging, LLM prompting, and so on (Section 4), all of which work together to enable users to interact with ANPL and ground their thoughts to code. [1] Self-planning Code Generation with Large Language Models [2] SKCODER: A Sketch-based Approach for Automatic Code Generation [3] Representing partial programs with blended abstract semantics [4] Program synthesis by sketching We hope the response can address your concern and we will revise the paper to make this clear.

Reviewer neh72023-08-14

Thank you for the response! I'm raising my score to 6.

Authorsrebuttal2023-08-15

Thanks for raising your score! We are glad that the rebuttal has addressed some of your concerns!

Reviewer ecZq2023-08-16

Thank you for the rebuttal!

## Summary Thank you for the detailed rebuttal. The rebuttal, along with the other reviews has helped improve my understanding of the proposed system. I have decided to increase the score of the paper to 7-accept as the authors have addressed almost all of the weaknesses and questions I raised. ## Response to the rebuttal in detail 1) Presentation - It is unclear what are the changes the authors are planning. How are the authors planning to revise the paper? My suggestion would to at least include one figure of the interface. Further, it would be useful if figure one explicitly shows the "sketch" code as well as the "hole" code (instead of a pictorial representation). I would be happy to hear the author's view. 2) Experiments: Thank you for clarifying that the grid is provided for all the ablated systems. I find it interesting that a lot of the time is spent waiting for the GPT prompts. I wonder if the users were told to use python functions that they code up if necessary. Nonetheless, the lack of a python only baseline is but a minor drawback. My third query, on test-set vs train-set scores is also well addressed. I recommend that the authors include the stated reasons in the appendix while discussing these statistics. 3) Others - I appreciate the results in the real-world program setup, it addresses my first two issues. I thank the authors for results with GPT-4. Since ANPL's goal is reasoning about user intent (rather than solving a task), better models would perhaps improve ANPL as well. Also, thank you for answering my questions! I find the results useful to improve my understanding of ANPL.

Authorsrebuttal2023-08-16

Thanks for your reply!

Thanks for the reply and increasing the score! We are glad that our rebuttal has addressed most of your concerns. Also, thanks for your effort in reading our paper and other reviews thoroughly! It is our pleasure to have a further discussion with you. ## Presentation Good suggestions! Sorry for our ambiguous response before. We are limited to 6,000 characters in our rebuttal. **Following your advice**, we promise that (1) we will add an interface figure in the "Human Studies" section of the main paper (we do not want to add it in the "method" section because the core contribution of ANPL is its programming paradigm and its compiler instead of the interface, but we will add an ANPL code example in the "method" section, see below). (2) We will add an ANPL code example in the main paper. However, it might not be appropriate to modify the ANPL example in Figure 1 from pictorial representation to code, as we initially attempted this, and it could make the example appear complex, failing to highlight the concept of separating control/data flow and functions in ANPL. We will try our best to modify Figure 1 and if we failed, we will add a new figure to show an ANPL code example. (more suggestions are welcome) ## Experiments We did not explicitly forbid the users to write Python code in our experiment so **they can write Python code if they want**. We count the number of pure Python functions written by users and find that only 5 functions are written in pure Python (1261 functions in total), with an average length of 7.2 lines (including `def` and `return`). This indicates that users can choose to write Python programs, but most of the time, **for the sake of efficiency, they choose to write ANPL**. Although we said that ANPL is compatible with Python and that "the users were instructed to solve the tasks as fast as possible and they choose not to program directly when using System A because it would require more effort", **we agree with you that a pure Python baseline should be added to make this result clearer. But we cannot afford to do it**. In fact, we are constrained by the complexity of the human study, and each additional baseline would significantly increase the cost of the human study. For instance, we have already completed a 440 man-hours human study, which is currently the most comprehensive experiment on users known about the LLM. The difficulty of conducting this experiment might be much greater than what readers may imagine. If we were to add a Python baseline, the cost of this experiment would extend to 660 man-hours. This not only demands more time but also incurs higher costs of money and manpower (few people want to finish an ARC problem 3 times). We believe that the existing experimental results and the above analysis (line of code and the number of pure Python functions) **have adequately demonstrated the advantage of ANPL**. ## Others Yes, the performance of ANPL will be improved as LLM upgrades and we will revise our paper to add this GPT-4 result. As you have seen, the purpose of ANPL is to construct a programming assistant capable of accurately conveying user intent through interaction (like debugging) instead of an automatic problem-solving machine. Increasing LLM's capabilities will make this interaction easier, but the gap of understanding between the user's intent and the LLM's interpretation will always be there. Even if the LLM surpasses programmers in the future, it is still necessary for users to communicate with LLM to clarify user intent -- where ANPL comes in. ## Conclusion In summary, we plan to (1) add an interface figure in the "Human Studies" section of the main paper (2) add an ANPL code example in the main paper (3) clarify that the grid editor is provided for all the ablated systems in the appendix (4) provide the GPT response time analysis in the experiment part (5) make the experimental setup clearer like whether the users can write Python functions in the appendix (6) provide the comparison between lines of ANPL code and Python code in the appendix to show ANPL's advantage compared with Python (7) clarify the choice of test-set vs train-set in the appendix (8) add GPT-4 results (w/o interaction) in the appendix (9) add the results on APPS and "long and realistic" programming tasks (Global Rebuttal) in the appendix Again, we greatly appreciate your thorough review of our paper, and we thank you for your suggestions for improving the quality of the paper! If you have any questions, please feel free to post them and discuss them with us. We firmly believe that ANPL and similar frameworks will undoubtedly play a significant role in the area of AI assistants.

Reviewer ecZq2023-08-16

Thank you for the reply!

The planned updates to the presentation seem reasonable. Thank you for the details on my queries regarding "experiments" and "others". I believe the paper will benefit from the planned updates and hopefully further propels research in LLM + human-in-the-loop systems.

Authorsrebuttal2023-08-16

Thanks for the fast reply!

Thanks for your reply and effort in improving the paper! We'll revise our paper carefully.

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC