Papers
Topics
Authors
Recent
Search
2000 character limit reached

Prompt Engineering: Techniques and Strategies

Updated 4 July 2026
  • Prompt engineering techniques are methods for designing effective natural-language instructions to steer large language models, incorporating manual hard prompts, automated soft prompts, and hybrid approaches.
  • They are organized into taxonomies such as discrete versus continuous prompting and functional groups including reasoning elicitation, retrieval augmentation, and control tuning, each addressing specific task requirements.
  • Recent research highlights dynamic trade-offs between accuracy, token cost, and adaptability, underscoring prompt engineering’s role in optimizing performance across diverse domains.

Prompt engineering techniques are the methods by which prompts—natural-language instructions, examples, constraints, role specifications, retrieval context, or continuous prompt embeddings—are designed and optimized to steer LLMs toward desired behavior on downstream tasks (Wang et al., 2023). In current research, prompt engineering is treated both as an iterative engineering discipline centered on the prompt as the model’s textual interface and as a broader family of manual, automated, discrete, and continuous adaptation methods spanning zero-shot instruction following, in-context learning, reasoning scaffolds, tool use, retrieval augmentation, and parameter-efficient prompt tuning (Amatriain, 2024, Sahoo et al., 2024). The literature consistently shows that prompt engineering is not a single technique but a heterogeneous design space whose effectiveness depends on task structure, model capability, domain, evaluation metric, and resource budget (Zaghir et al., 2024).

1. Conceptual foundations and taxonomies

A central distinction in the literature is between prompt design, prompt learning, and prompt tuning. In the medical review literature, prompt design denotes manual construction of “hard prompts” in natural language; prompt learning denotes hard prompts applied to masked language modeling with verbalizers; and prompt tuning denotes optimization of “soft prompts,” that is, continuous trainable embeddings used while keeping the base model frozen or only partially tunable (Zaghir et al., 2024). More general surveys use a parallel distinction between discrete/manual prompting and continuous/learned prompting, while also organizing methods by prompt acquisition—manual, LM-generated, retrieval-based, or hybrid—and by interaction structure, namely single-turn versus multi-turn prompting (Sahoo et al., 2024).

A second organizing principle is functional rather than parametric. Survey work groups prompting techniques into instruction scaffolding, demonstrations, reasoning elicitation, retrieval and tool augmentation, control and safety, automation, and agent orchestration (Amatriain, 2024). This classification is useful because many named techniques differ less in their surface wording than in the mechanism they attempt to induce: specification of task structure, decomposition of reasoning, grounding in external evidence, or post-generation revision.

Family Representative techniques Typical role
Instruction and demonstration Zero-shot, few-shot, role-play, delimiters Specify task and output behavior
Reasoning elicitation CoT, ToT, Self-Consistency, Reflection, Least-to-Most Expose or structure intermediate reasoning
Retrieval and tool use RAG, ReAct, ART, FLARE Ground outputs or invoke external actions
Control, automation, tuning Rails, APE, OPRO, soft prompts, prefix tuning Constrain, optimize, or parameterize prompting

Within software and code-generation studies, this broad taxonomy is often refined into operational categories such as root, reasoning, priming, decomposition, and refinement prompting, explicitly separating single-turn prompting from plan–implement, critique–revise, and self-debug loops (Wang et al., 2024). This suggests that taxonomies are increasingly evaluated not only by conceptual neatness but by their implications for cost, latency, and error modes.

2. Recurrent mechanisms and prompt construction patterns

Across surveys, several construction principles recur. Instructions are generally placed before examples; example ordering matters; delimiters such as <begin> and <end> help scope inputs; forceful imperative phrasing can improve adherence; and prompts often specify output templates, constraints, or end-of-prompt markers when supported by the model or interface (Amatriain, 2024). Few-shot prompting uses demonstrations to induce a mapping from input to output, but is sensitive to exemplar quality and order. Role prompting assigns personas or expert identities to modulate style and apparent rigor. Affordance-style prompts define callable functions or tools in the prompt itself. More elaborate strategies include self-correction, disagreement prompts, and chains that decompose multi-step workflows into explicit stages (Amatriain, 2024).

Reasoning-oriented techniques form a large subfamily. Chain-of-Thought prompting asks the model to reason step by step; manual CoT provides explicit reasoning exemplars; Automatic CoT automates exemplar generation; Tree-of-Thought extends this by exploring multiple branches; Self-Consistency samples multiple reasoning paths and aggregates them; Reflection critiques and revises a prior answer; and Expert Prompting synthesizes viewpoints from multiple personas (Amatriain, 2024, Sahoo et al., 2024). These methods are routinely described as improving difficult reasoning, but also as increasing compute cost, latency, and the possibility of verbose or misleading intermediate traces.

The code-generation literature makes these distinctions unusually concrete. One study evaluates nine prompt engineering techniques with fixed templates: Zero-shot, Few-shot, Zero-shot CoT, Few-shot CoT, Persona, Self-planning, Self-refine, Progressive Hint, and Self-debug (Wang et al., 2024). The contrast it draws is precise: single-turn prompts are cheaper and often adequate for low-complexity tasks; CoT can help complex logic but can introduce spurious mistakes on simple tasks; decomposition organizes work up front but can fail through a bad plan; critique–revision and self-debug may correct initial errors but can also over-correct or amplify bad feedback. In practice, prompt engineering techniques are therefore distinguished not only by what they ask the model to do, but by where they intervene: before generation, during reasoning, or after an initial draft.

3. Selection, automation, and model-dependent adaptation

A recurring conclusion in recent work is that no single prompting technique is universally optimal. In code generation, PET-Select formalizes this claim by routing each query to one of nine prompting techniques using code complexity as a proxy for problem difficulty (Wang et al., 2024). Its workflow first runs all nine techniques on MBPP and HumanEval, records correctness, token usage, and code complexity metrics, and then trains a complexity-aware selector using contrastive learning over CodeBERT embeddings followed by a classifier. On GPT-4o for HumanEval, PET-Select reaches 85.4% pass@1, improving over the best individual prompt technique by +1.9%, while reducing average tokens from 1,191 to 300, a 74.8% reduction (Wang et al., 2024). The underlying claim is not merely that selection helps, but that prompt choice can be learned as a routing problem over a latent space aligned to task difficulty.

Automation has also been pursued at the level of meta-prompting. APET, the Automatic Prompt Engineering Toolbox, instructs GPT-4 to autonomously reformulate a task prompt using Expert Prompting, Chain of Thought, Tree of Thoughts, and a completeness heuristic (Kepel et al., 2024). In zero-shot experiments, APET improved Word Sorting from 83.60% to 88.00%, Geometric Shapes from 70.40% to 77.20%, and Game of 24 from 16.00% to 18.67%, but reduced Checkmate in One from 40.40% to 25.60% (Kepel et al., 2024). A later template-free system builds a knowledge base linking semantically derived task clusters to compact bundles of prompting techniques—always Role Playing, exactly one Emotional Stimulus method, exactly one reasoning method, and optionally one complementary method—and then generates prompts by matching new task descriptions to cluster embeddings via cosine similarity (Ikenoue et al., 20 Oct 2025). On 23 BIG-Bench Extra Hard tasks, this approach raises the arithmetic mean from 23.9 for original prompts and 24.7 for an automatic prompt generator baseline to 28.0, or 28.5 with temperature optimization (Ikenoue et al., 20 Oct 2025).

Recent evidence also shows that prompt optimality changes with model capability. The “Prompting Inversion” study compares Zero Shot, standard CoT, and a constrained rule-based prompt called Sculpting on GSM8K across gpt-4o-mini, gpt-4o, and gpt-5 (Khan, 25 Oct 2025). Sculpting improves over standard CoT on gpt-4o, reaching 97% versus 93%, but becomes detrimental on gpt-5, where it scores 94.00% against 96.36% for CoT on the full benchmark (Khan, 25 Oct 2025). The paper characterizes this as a “Guardrail-to-Handcuff” transition: constraints that suppress semantic drift in mid-tier models can induce hyper-literalism and reject reasonable inference in more capable models. This suggests that prompt engineering is increasingly a co-adaptation problem between task and model generation, rather than a fixed library of universally valid recipes.

4. Empirical behavior across tasks and application domains

The code and software-engineering literature provides some of the clearest comparative evidence. Complexity-aware PET selection improves pass@1 while reducing token cost in code generation; a security-focused prefix—“You are a developer who is very security-aware and avoids weaknesses in the code.”—reduces filtered vulnerable samples by up to 56% on GPT-4o and 47% on GPT-4o-mini; iterative Recursive Criticism and Improvement repairs between 41.9% and 68.7% of vulnerabilities in previously generated code; and a 14-technique study over 10 software-engineering tasks finds Exemplar Selection KNN strongest for clone detection, code translation, and assert generation, Universal Self-Consistency strongest for Code QA and code generation, Thread of Thought strongest for defect detection, and the Control baseline strongest in aggregate for bug fixing and code summarization (Wang et al., 2024, Bruni et al., 9 Feb 2025, Jr et al., 5 Jun 2025). Yet code-focused prompt engineering does not uniformly dominate alternative adaptation methods: GPT-4 with basic prompting, in-context learning, and task-specific prompting does not consistently outperform fine-tuned models on code summarization, generation, and translation, although conversational prompting with human feedback substantially improves outputs on the sampled tasks (Shin et al., 2023).

In summarization, prompt effectiveness varies sharply with domain and length. A six-model evaluation across CNN/DailyMail, NewsRoom, SAMSum, and ArXiv finds that short, explicit instructions with dataset-matched length constraints are strong zero-shot baselines, that in-context learning with 1, 3, 5, and 7 demonstrations usually improves both ROUGE and BERTScore, and that sentence-based chunking materially improves summarization of long scientific documents for models with shorter context windows (Aly et al., 7 Jul 2025). In sentiment analysis and irony detection, advanced prompting improves performance but with strong model–task interaction: few-shot prompting is generally best for GPT-4o-mini, while Chain-of-Thought is especially effective for gemini-1.5-flash on difficult tasks such as irony detection, where weighted F1 rises from approximately 0.41 to approximately 0.60, a relative improvement of up to 46% (Schmitt et al., 13 Jan 2026).

Medical and healthcare studies show both breadth and methodological unevenness. A scoping review of 114 studies from 2022–2024 reports that prompt design is the most prevalent paradigm, Chain-of-Thought is the most common technique, ChatGPT is the most frequently used model, and 64% of prompt-design studies lack non-prompt baselines (Zaghir et al., 2024). Another medical benchmark on Persian board exam questions evaluates Chain-of-Thought, Few-Shot, Hybrid CoT + Few-Shot, Zero-Shot, Expert Mimicry, and Emotional prompting across five models and 156 configurations, finding that CoT improves accuracy but also increases overconfidence, Emotional prompting further inflates confidence and harms calibration, and Few-Shot at moderate temperatures often offers the best balance between correctness and trustworthy confidence (Naderi et al., 29 May 2025). More general healthcare reviews position prompt engineering as especially important for question answering, summarization, machine translation, de-identification, and multimodal clinical systems, while emphasizing privacy and harm-aware evaluation (Wang et al., 2023).

Embodied and retrieval-grounded settings add further distinctions. In service robotics, Adaptive Functions, Example in Prompt, Chain-of-Thought, ReAct, and State Description were compared for task planning and execution; no single method dominated, but few-shot examples were critical for weaker models, while ReAct plus state descriptions could improve long-horizon task success at substantial latency cost (Bode et al., 2024). For RAG with small LLMs on multi-hop HotpotQA, 24 prompt templates were evaluated; optimized multi-hop prompting gave the best accuracy on Qwen2.5-3B-Instruct, expert synthesis prompting gave the best accuracy on Gemma3-4B-It, and explicit citation requirements such as [DOC-X] consistently improved grounding, with gains of roughly six absolute accuracy points over a standard RAG baseline (Mohammadi et al., 14 Feb 2026).

Language-specific and culturally targeted studies show analogous patterns. In Arabic context-dependent text-to-SQL, the OpenAI demonstration prompt that explicitly requires “Complete sqlite SQL query only and with no explanation” is the strongest zero-shot question representation, GAT Reviser is the best in-context technique, and a post-generation GAT Corrector improves all 40 experimental settings, with average gains of 1.9% execution accuracy and 1.9% interaction accuracy in zero-shot conditions (Almohaimeed et al., 16 Nov 2025). In bias mitigation, a systematic review focused on Arabs and Muslims identifies five prompt-engineering families—cultural prompting, affective priming, self-debiasing, structured multi-step pipelines, and parameter-optimized continuous prompts—and reports that structured multi-step pipelines achieved the highest overall effectiveness, with bias reductions up to 87.7%, while affective priming reduced violent completions from 66% to 20% in one study (Asseri et al., 22 Jun 2025).

5. Evaluation regimes, resource trade-offs, and failure modes

Prompt engineering is evaluated with highly task-specific metrics. Code studies use pass@1, average token usage, Mean Reciprocal Rank, nDCG, execution accuracy, interaction accuracy, and scanner-based security measures; summarization studies rely on ROUGE and BERTScore; medical calibration studies add AUC-ROC, Brier Score, and Expected Calibration Error; and RAG studies introduce composite semantic scoring such as SLLM together with latency and efficiency (Wang et al., 2024, Naderi et al., 29 May 2025). Survey work also catalogs BLEU, Exact Match, F1, success rate, and uncertainty metrics, underscoring that prompting techniques are typically optimized against task-specific objective functions rather than a single notion of quality (Amatriain, 2024).

Across domains, the central trade-off is between accuracy, cost, and controllability. Multi-turn prompting, reasoning traces, self-consistency, and critique–revision loops often improve difficult tasks but consume more tokens, incur higher latency, and create additional failure surfaces. PET-Select explicitly formalizes this trade-off by penalizing high-token methods in its ranking score; the medical confidence study shows that improvements in answer accuracy can be accompanied by worse calibration; and RAG results on small LLMs show that verbose hybrid prompts improve accuracy but can increase latency by nearly an order of magnitude relative to compact instruction-tuned prompts (Wang et al., 2024, Naderi et al., 29 May 2025, Mohammadi et al., 14 Feb 2026). This suggests that prompt engineering techniques should be treated as operating points on a performance–budget frontier rather than as uniformly beneficial upgrades.

The failure modes are now well documented. Few-shot prompting is sensitive to example quality and order; citations requested from the model can themselves be hallucinated; retrieval-augmented prompting depends critically on retrieval quality; critique–revision can reinforce rather than repair errors if the critique is flawed; and overly rigid constraints can become counterproductive as model capability increases (Amatriain, 2024, Khan, 25 Oct 2025). Practical guides also report multi-turn conversation degradation, overlong-context failure, weak negative instructions of the form “do not hallucinate,” and a mismatch between reasoning and non-reasoning models: explicit CoT can help non-reasoning models but harm stronger reasoning-capable systems on some tasks (Romanov et al., 14 Sep 2025). In this literature, prompt engineering is therefore as much about managing failure modes as about eliciting beneficial behavior.

6. Open problems and future directions

Several directions recur across the literature. One is adaptive routing: broader prompt pools, richer task descriptors, direct complexity prediction from natural-language queries, and explicit integration of budget constraints, latency, and cost into prompt selection are all proposed extensions of current selector systems (Wang et al., 2024). Another is automation with stronger evaluation discipline: surveys and domain reviews repeatedly call for better reporting of prompt optimization procedures, clearer terminology, more non-prompt baselines, and explicit ablations of prompt components, especially in medical settings where privacy and harm are central (Zaghir et al., 2024).

A second cluster of problems concerns capability-aware prompt design. The prompting inversion results imply that prompt libraries should be versioned by model generation and periodically revalidated, since constraints that help one model may hurt its successor (Khan, 25 Oct 2025). Related work on automatic prompt generation suggests that task-cluster knowledge bases, temperature optimization, and more granular technique bundles can reduce dependence on handcrafted templates, but these systems remain model- and benchmark-dependent (Ikenoue et al., 20 Oct 2025).

A third cluster concerns multimodality, retrieval, and agents. Surveys identify multimodal prompt orchestration, stronger neurosymbolic verification, automated instruction optimization, and tighter integration of prompting with tool use, retrieval, and agent frameworks such as ReAct, ReWOO, and DERA as major open directions (Sahoo et al., 2024). In high-stakes domains, future work is also explicitly oriented toward uncertainty-aware prompting, post-hoc calibration, and richer safety evaluation rather than accuracy alone (Naderi et al., 29 May 2025).

Finally, the literature points to cultural and domain specificity as an unresolved challenge. Bias-mitigation work calls for culturally adaptive prompting techniques, Arab- and Muslim-specific evaluation resources, and participatory evaluation rather than reliance on generic English-language benchmarks (Asseri et al., 22 Jun 2025). More broadly, the accumulated evidence suggests that prompt engineering techniques are best understood not as universal heuristics but as configurable interfaces between model capability, task structure, domain norms, and deployment constraints.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (19)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Prompt Engineering Techniques.