Function-constrained Program Synthesis
Not on the map. Why?
Abstract (arXiv)
This work introduces (1) a technique that allows large language models (LLMs) to leverage user-provided code when solving programming tasks and (2) a method to iteratively generate modular sub-functions that can aid future code generation attempts when the initial code generated by the LLM is inadequate. Generating computer programs in general-purpose programming languages like Python poses a challenge for LLMs when instructed to use code provided in the prompt. Code-specific LLMs (e.g., GitHub Copilot, CodeLlama2) can generate code completions in real-time by drawing on all code available in a development environment. However, restricting code-specific LLMs to use only in-context code is not straightforward, as the model is not explicitly instructed to use the user-provided code and users cannot highlight precisely which snippets of code the model should incorporate into its context. Moreover, current systems lack effective recovery methods, forcing users to iteratively re-prompt the model with modified prompts until a sufficient solution is reached. Our method differs from traditional LLM-powered code-generation by constraining code-generation to an explicit function set and enabling recovery from failed attempts through automatically generated sub-functions. When the LLM cannot produce working code, we generate modular sub-functions to aid subsequent attempts at generating functional code. A by-product of our method is a library of reusable sub-functions that can solve related tasks, imitating a software team where efficiency scales with experience. We also introduce a new "half-shot" evaluation paradigm that provides tighter estimates of LLMs' coding abilities compared to traditional zero-shot evaluation. Our proposed evaluation method encourages models to output solutions in a structured format, decreasing syntax errors that can be mistaken for poor coding ability.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 17 of its 26 references that are in the map. First posted on arXiv 27 Nov 2023.
Builds on
17 of 26 references.
References · 17
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023GPT-4 Technical Reportcited by 18,396
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
- 2023HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Facecited by 1,190
- 2023Teaching Large Language Models to Self-Debugcited by 988
- 2021Measuring Coding Challenge Competence With APPScited by 902
- 2023Visual ChatGPT: Talking, Drawing and Editing with Visual Foundation Modelscited by 668
- 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 503
- 2023How is ChatGPT's behavior changing over time?cited by 270
5 more
- 2023TaskMatrix.AI: Completing Tasks by Connecting Foundation Models with Millions of APIscited by 184
- 2019SPoC: Search-based Pseudocode to Codecited by 176
- 2023Self-planning Code Generation with Large Language Modelscited by 124
- 2022Top-Down Synthesis for Library Learningcited by 58
- 2023Explaining Competitive-Level Programming Solutions using LLMscited by 13
Built on by
Citing papers per year: 2024: 1.
1 paper.