ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets using LLMs
Not on the map. Why?
Abstract (arXiv)
Technical Q&A sites are valuable for software developers seeking knowledge, but the code snippets they provide are often uncompilable and incomplete due to unresolved types and missing libraries. This poses a challenge for users who wish to reuse or analyze these snippets. Existing methods either do not focus on creating compilable code or have low success rates. To address this, we propose ZS4C, a lightweight approach for zero-shot synthesis of compilable code from incomplete snippets using Large Language Models (LLMs). ZS4C operates in two stages: first, it uses an LLM, like GPT-3.5, to identify missing import statements in a snippet; second, it collaborates with a validator (e.g., compiler) to fix compilation errors caused by incorrect imports and syntax issues. We evaluated ZS4C on the StatType-SO benchmark and a new dataset, Python-SO, which includes 539 Python snippets from Stack Overflow across the 20 most popular Python libraries. ZS4C significantly outperforms existing methods, improving the compilation rate from 63% to 95.1% compared to the state-of-the-art SnR, marking a 50.1% improvement. On average, ZS4C can infer more accurate import statements (with an F1 score of 0.98) than SnR, with an improvement of 8.5% in the F1.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 26 of its 56 references that are in the map. First posted on arXiv 25 Jan 2024.
Builds on
26 of 56 references.
References · 26
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,708
- 2023The Rise and Potential of Large Language Model Based Agents: A Surveycited by 1,439
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2020Making Pre-trained Language Models Better Few-shot Learnerscited by 1,256
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2022Large Language Models Are Human-Level Prompt Engineerscited by 1,045
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
14 more
- 2023A Multitask, Multilingual, Multimodal Evaluation of ChatGPT on Reasoning, Hallucination, and Interactivitycited by 894
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPTcited by 619
- 2021Do Prompt-Based Models Really Understand the Meaning of their Prompts?cited by 326
- 2023Mathematical Capabilities of ChatGPTcited by 268
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
- 2022DocPrompting: Generating Code by Retrieving the Docscited by 153
- 2023AI-assisted coding: Experiments with GPT-4cited by 43
- 2023Nuances are the Key: Unlocking ChatGPT to Find Failure-Inducing Tests with Differential Promptingcited by 23
- 2023Exploring Code Analysis: Zero-Shot Insights on Syntax and Semantics with LLMscited by 19
- 2021The Prevalence of Code Smells in Machine Learning projectscited by 16
- 2019Analyzing and Supporting Adaptation of Online Code Examplescited by 8
- 2021APIzation: Generating Reusable APIs from StackOverflow Code Snippetscited by 6
- 2022Prompt-tuned Code Language Model as a Neural Knowledge Base for Type Inference in Statically-Typed Partial Codecited by 6
Built on by
Citing papers per year: 2025: 1; 2026: 1.
2 papers.