Work

Algorithmic Prompt Engineering: Improving Accuracy and Diversity in LLM-Based Code Synthesis

Year: 2025
Type: article
Abstract: Recent advancements in Large Language Models (LLMs), notably GPT-3.5 and GPT-4, have transformed AI-assisted code generation; however, their performance appears to hinge on the formulation of input prompts. This study investigates a range of prompt engineering strategies aimed at optimizing code generation outcomes. Specifically, we compare generic, context-sensitive, and dynamically constructed prompts using a benchmark of more than fifty programming tasks spanning Python, Java, and C++. A central contribution of this work lies in the development of algorithmic techniques for dynamic prompt construction, which incorporate iterative refinement informed by automated feedback. Empirical findings indicate that dynamic prompting achieves superior results, with code accuracy reaching approximately 93% and average debugging time reduced by nearly two-thirds relative to generic strategies. Beyond accuracy, the analysis suggests notable gains in code relevance, structural efficiency, and solution diversity. These insights offer a set of evidence-based practices for practitioners and provide a conceptual basis for future research on adaptive and automated prompt design in software development environments.
Authors: I. V. Shashikala, T. Aditya Sai Srinivas, M. Bhavya Sree, K. Shirisha, H. B. Varshini Reddy, K Dora Babu
Language: English
Open Access status: green
OpenAlex ID: W7101833142
FWCI:
Cites:
Cited by:
Related to: