University of Manitoba
Zero-shot synthesis of compilable code for incomplete code snippets using LLMs
Abstract
dc:description.abstractTechnical Q&A sites and Large Language Models (LLMs) are valuable resources for software developers seeking knowledge. However, the provided code snippets are often uncompilable and incomplete due to unresolved types, missing libraries, and incorrect import statements. 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 For incomplete Code snippets using 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.
Degree
thesis:*- Level thesis:degree_level
- Master of Science (M.Sc.)
- Discipline thesis:degree_discipline
- Computer Science
- Year dc:date.issued
- 2024
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Kabir, Azmain
- Advisor dc:contributor.supervisor
-
- Wang, Shaowei
- Committee members dc:contributor.committeemember
-
- Chowdhury, Shaiful (Computer Science)
- Tabiban, Azadeh (Computer Science)
Subjects
dc:subject × 5Rights
- Language dc:language.iso
- eng
Identifiers
dc:identifier.*- Handle dc:identifier.uri
- http://hdl.handle.net/1993/38437