ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets Using LLMs
ACM Transactions on Software Engineering and Methodology · 31.05.2025 · 34 (4) · 1-30
DOI: 10.1145/3702979 ↗Kurz gefasst
Fachartikel in der Zeitschrift ACM Transactions on Software Engineering and Methodology, online erschienen am 28.04.2025. Verfasst von Azmain Kabir und 5 weiteren Autor:innen. Die Arbeit wurde bisher 9-mal zitiert (Crossref) und nennt 56 Literaturangaben.
Abstract (Originalsprache)
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.
Zitieren
APA
Kabir, A., Wang, S., Tian, Y., Chen, T. P., Asaduzzaman, M., & Zhang, W. (2025). ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets Using LLMs. ACM Transactions on Software Engineering and Methodology, 34(4), 1-30. https://doi.org/10.1145/3702979
Vancouver
Kabir A, Wang S, Tian Y, Chen TP, Asaduzzaman M, Zhang W. ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets Using LLMs. ACM Transactions on Software Engineering and Methodology. 2025;34(4):1-30. doi:10.1145/3702979
BibTeX
@article{Kabir2025,
author = {Kabir, Azmain and Wang, Shaowei and Tian, Yuan and Chen, Tse-Hsun (Peter) and Asaduzzaman, Muhammad and Zhang, Wenbin},
title = {ZS4C: Zero-Shot Synthesis of Compilable Code for Incomplete Code Snippets Using LLMs},
journal = {ACM Transactions on Software Engineering and Methodology},
year = {2025},
volume = {34},
number = {4},
pages = {1--30},
doi = {10.1145/3702979}
}
EUVIMED