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

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.

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2025-10-28
DOI
https://doi.org/10.5281/zenodo.17461531
Primary Topic
Phytochemistry and Bioactive Compounds
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Zenodo (CERN European Organization for Nuclear Research)
Phytochemistry and Bioactive Compounds
article

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

article en

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.

Zenodo (CERN European Organization for Nuclear Research)
Industry, innovation and infrastructure
Openalex Percentile: Top 53%
Phytochemistry and Bioactive Compounds
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Algorithmic Prompt Engineering: Improving Accuracy and Diversity in LLM-Based Code Synthesis · Zenodo (CERN European Organization for Nuclear Research) (2025) | TGRS Research Map | TGRS