Source-linked AI summary

The Prompt Report: A Systematic Survey of Prompt Engineering Techniques

Sander Schulhoff, Michael Ilie, Nishant Balepur, Konstantine Kahadze, Amanda Liu, Chenglei Si, Yinheng Li, Aayush Gupta, HyoJung Han, Sevien Schulhoff, Pranav Sandeep Dulepet, Saurav Vidyadhara, Dayeon Ki, Sweta Agrawal, Chau Pham, Gerson Kroiz, Feileen Li, Hudson Tao, Ashay Srivastava, Hevander Da Costa, Saloni Gupta, Megan L. Rogers, Inna Goncearenco, Giuseppe Sarli, Igor Galynker, Denis Peskoff, Marine Carpuat, Jules White, Shyamal Anadkat, Alexander Hoyle, Philip Resnik

arXiv:2406.06608v6cs.CLcs.AI

TL;DR

Prompt engineering is rapidly expanding, making effective prompt structure, evaluation, and technique selection important but difficult. The paper systematically reviews and organizes prompting techniques, examines their applications through case studies, and finds promise in automated exploration combined with human revision.

  • Problem

    Prompting literature is rapidly growing, while selecting effective exemplars and techniques remains difficult because performance depends on design choices and technique selection resembles hyperparameter search.

  • Method

    The paper conducts a machine-assisted systematic review to build a taxonomy and terminology, expands coverage to multilingual and multimodal prompting, and evaluates techniques in two case studies.

  • Results

    Few-Shot CoT performs best in the MMLU study, while the suicide-risk case study finds automated exploration most successful when combined with human prompt engineering and revision.

  • Takeaways & Limitations

    The survey provides a roadmap for considering prompting techniques, while the case studies support combining automated exploration with human prompt engineering for more robust examination.

  • Takeaways & Limitations

    The study uses limited information, including 100 labeled posts reserved for testing, and acknowledges gaps and redundancies despite aiming for comprehensive coverage.

Abstract

from arXiv · show

Generative Artificial Intelligence (GenAI) systems are increasingly being deployed across diverse industries and research domains. Developers and end-users interact with these systems through the use of prompting and prompt engineering. Although prompt engineering is a widely adopted and extensively researched area, it suffers from conflicting terminology and a fragmented ontological understanding of what constitutes an effective prompt due to its relatively recent emergence. We establish a structured understanding of prompt engineering by assembling a taxonomy of prompting techniques and analyzing their applications. We present a detailed vocabulary of 33 vocabulary terms, a taxonomy of 58 LLM prompting techniques, and 40 techniques for other modalities. Additionally, we provide best practices and guidelines for prompt engineering, including advice for prompting state-of-the-art (SOTA) LLMs such as ChatGPT. We further present a meta-analysis of the entire literature on natural language prefix-prompting. As a culmination of these efforts, this paper presents the most comprehensive survey on prompt engineering to date.

1 Introduction

Prompting makes GenAI systems flexible to use across modalities and tasks, but the rapidly growing field lacks consistent terminology and shared understanding. This survey organizes the field through a systematic review, taxonomy, vocabulary, scope choices, and practical guidance.

  • Prompting lets users guide transformer-based GenAI models with text, images, audio, videos, or combinations thereof.The resulting flexibility supports consumer-facing, internal, and research use cases.
  • Better prompts empirically improve results across a wide range of tasks, driving rapid growth in prompting research and techniques.
  • The field remains poorly understood because only a fraction of its terminologies and techniques are familiar to practitioners.
  • The survey performs a large-scale review to create a robust, approachable resource of prompting terminology and techniques.The authors describe the resource as an initial iteration that will develop over time.
  • The study focuses on task-agnostic, hard prefix prompts to keep the work approachable and its scope manageable.Hard prompts use vocabulary tokens, unlike soft prompts that may include tokens without corresponding vocabulary words.
  • A PRISMA-grounded systematic review identifies 58 text-based prompting techniques and develops a taxonomy, while also covering multilingual and multimodal techniques.The paper aims to provide a roadmap for selecting prompting techniques and discusses external tools, evaluation, security, safety, and two case studies.

2 A Meta-Analysis of Prompting

The paper uses a machine-assisted PRISMA review to organize prompting research into a taxonomy, then analyzes major text-based techniques and their practical design trade-offs.

  • 2.1.1 The Pipeline: The review included hard prefix prompts, excluded gradient-based training, and applied a masked-frame or window criterion for non-text modalities.These criteria define the study’s operational scope across text and other modalities.
  • 2.1 Systematic Review Process: 1,565 papers were identified through a PRISMA-grounded review combining database searches, human annotation, and LLM-assisted classification.The review began with records from arXiv, Semantic Scholar, and ACL, filtered using 44 prompting-related keywords.
  • 2.1.1 The Pipeline: 300 articles received independent double annotation with 92% agreement, while LLM classification achieved 89% precision, 75% recall, and 81% F1.The combined human and LLM annotations produced the final paper set.
  • 2.2 Text-Based Techniques: 58 text-based prompting techniques are organized into six major categories, with each technique assigned to its most relevant category when overlaps occur.The taxonomy is intended to provide a structured overview of text-based prompting techniques.
  • 2.2.1 In-Context Learning (ICL): In-context learning uses exemplars or instructions within prompts without weight updates, although the paper cautions that “learning” may simply reflect task specification.The paper distinguishes exemplar-based and instruction-based prompting as forms of in-context learning.
  • 2.2.1.1 Few-Shot Prompting Design Decisions: Exemplar quantity, ordering, label quality, and instruction selection can materially affect few-shot performance, with order sometimes shifting accuracy from below 50% to above 90%.More exemplars generally help, but benefits can diminish beyond 20 exemplars; incorrect labels have setting- and model-dependent effects.
  • 2.2.3 Decomposition: Tree-of-Thought creates a branching search over generated thoughts, evaluates progress, and continues promising paths, especially for search and planning tasks.The technique extends stepwise reasoning by selecting which thought branches to develop further.
  • 2.2.4 Ensembling: Ensembling aggregates responses from multiple prompts, often by majority vote, reducing output variance and often improving accuracy at the cost of additional model calls.The technique trades computational expense for more stable or accurate outputs.

3 Beyond English Text Prompting

The survey extends prompt-engineering coverage beyond English text to multilingual, machine-translation, multimodal, and audio settings. It catalogs techniques that adapt language, exemplars, retrieval, human feedback, and modality-specific capabilities.

  • 3.1 Multilingual: English-trained models often produce lower-quality outputs in non-English, especially low-resource, languages, motivating multilingual prompting techniques.
  • 3.1 Multilingual: Multilingual approaches translate inputs, use cross-lingual reasoning paths, or align exemplars by semantic similarity, task labels, or both.Translate First Prompting translates non-English inputs into English; XLT, CLSP, and X-InSTA provide alternative cross-lingual strategies.
  • 3.1.2 In-Context Learning: In-context example selection strongly influences multilingual performance, with both semantically similar and peculiar exemplars improving results in different studies.
  • 3.1.2.1 In-Context Example Selection: Cross-lingual retrieval frameworks such as PARC retrieve relevant exemplars from high-resource languages to improve transfer for low-resource target languages.
  • 3.1.3 Prompt Template Language Selection: Prompt-template language affects multilingual performance: English templates are often more effective, but human-translated native templates can outperform machine-translated ones and no option is universally best.
  • 3.1.4 Prompting for Machine Translation: Machine-translation prompting includes knowledge mining, dictionary augmentation, chunk-wise translation, and human interaction to resolve ambiguity or refine drafts.MAPS generates and selects among candidate translations; CoD and DiPMT prepend dictionary information; DecoMT and human-in-the-loop methods add decomposition or supervision.
  • 3.2 Multimodal: Multimodal prompting includes techniques enabled by modalities beyond text rather than merely applying text-based methods to new inputs.
  • 3.2.2 Audio Prompting: Audio prompting remains early-stage: experiments report mixed results, including failures of some open-source models and in-context learning ability in others.

4 Extensions of Prompting

The survey describes extensions that connect prompting to external tools, iterative agents, retrieval, and output evaluation. These systems address shortcomings in computation, reasoning, factuality, and output assessment through multi-step prompt pipelines.

  • 4 Extensions of Prompting: Prompting extensions add external tools and evaluation algorithms to complex, multi-step prompting pipelines.
  • 4.1 Agents: Agents use prompted actions to engage with systems outside the GenAI model, sometimes adding routing, memory, and planning.The survey excludes independently acting AI systems with their own goals.
  • 4.1.1 Tool Use Agents: Tool-use agents route requests to symbolic or neural tools, while CRITIC generates an answer, critiques it, and uses tools to verify or amend errors.
  • 4.1.2 Code-Generation Agents: Code-generation agents translate problems into executable code, with ToRA interleaving code and reasoning and TaskWeaver supporting user-defined plugins.
  • 4.1.3 Observation-Based Agents: Observation-based agents insert observations into prompts; ReAct cycles through thoughts, actions, and observations, while Reflexion adds evaluations and reflective working memory.
  • 4.1.3.1 Lifelong Learning Agents: Minecraft agents demonstrate lifelong-learning frameworks that propose tasks, generate actions or code, and retain experience for later retrieval.Voyager uses long-term memory; GITM recursively decomposes goals and plans structured actions with external knowledge.
  • 4.1.4 Retrieval Augmented Generation (RAG): RAG inserts retrieved external information into prompts, and agentic variants interleave decomposition, reasoning, retrieval, editing, or repeated retrieval during generation.

5 Prompting Issues

The survey examines security, safety, privacy, code-generation, and behavioral risks associated with prompting. It also reviews defenses and shows that small prompt changes can substantially affect performance and reliability.

  • 5 Prompting Issues: Prompting issues span security and alignment concerns, including prompt hacking, harmful outputs, privacy risks, and system vulnerabilities.
  • 5.1.1 Types of Prompt Hacking: Prompt hacking manipulates prompts to attack GenAI systems and includes prompt injection and jailbreaking as distinct forms.Injection overrides developer instructions with user input, whereas jailbreaking elicits unintended behavior without necessarily relying on developer instructions.
  • 5.1.2.1 Data Privacy: Prompt hacking can expose training data and application templates, creating privacy and intellectual-property risks.
  • 5.1.2.2 Code Generation Concerns: LLM-generated code can introduce package hallucinations, malware-installation opportunities, bugs, and security vulnerabilities, with prompting changes also affecting vulnerability rates.
  • 5.1.2.3 Customer Service: Prompt injection against customer-service chatbots can produce harmful or commercially incorrect responses, including incorrect refund information that led to a court victory.
  • 5.1.3 Hardening Measures: Prompt-based defenses and detectors can mitigate prompt hacking, but hundreds of thousands of malicious prompts showed that no prompt-based defense is fully secure.
  • 5.2.1 Prompt Sensitivity: Minor prompt changes can produce large performance shifts: LLaMA2-7B ranged from nearly 0 to 0.804 on some tasks, and GPT-3 accuracy changed by up to 30%.
  • 5.2.2 Overconfidence and Calibration: LLMs may be overconfident or sycophantic, with user opinions and correctness cues swaying responses even when they conflict with the model’s initial answer.

6 Benchmarking

The benchmark evaluates prompting techniques through controlled prompt variations and illustrates manual prompt engineering on crisis-level suicide-risk detection. Results show that performance is sensitive to technique complexity, prompt context, extraction choices, and exemplar design.

  • 6.1 Benchmarking: Each prompting technique was tested with six prompt variations built from a shared template containing base instructions and a question, except Self-Consistency techniques.The question format and, in some cases, the base instruction were varied across evaluations.
  • 6.1 Results: The benchmark found that performance generally improved with technique complexity, but Zero-Shot-CoT underperformed Zero-Shot and Few-Shot CoT performed best.Self-Consistency reduced score spread and improved accuracy only for Zero-Shot prompts.
  • 6.2 Problem: The case study targeted signals predictive of crisis-level suicide risk in text written by potentially suicidal individuals, using limited labeled information that mirrors real-world prompt-development settings.The setup reserved 100 labeled posts for testing and highlights the complexity of the underlying social-science constructs.
  • 6.2 The Process: Manual prompt engineering used 47 recorded development steps over about 20 hours, increasing performance from 0% to F1 0.53 with 0.86 precision and 0.38 recall.The reported F1 is the harmonic mean of the stated precision and recall values.
  • 6.2.3.3 Prompting Techniques: Ten-shot AutoDiCoT achieved the strongest manual-exercise result at F1 0.53, while 20-shot AutoDiCoT, extraction changes, tripled context, and email anonymization each reduced performance.The reported declines include F1 0.49 for 20-shot AutoDiCoT, 0.48 after extraction prompting, 0.47 with tripled context, and 0.45 after anonymization.
  • 6.2.3.3 Prompting Techniques: A separate DSPy-based prompt achieved 0.548 F1 on the test set using 15 exemplars and one bootstrapped reasoning demonstration, without the professor’s email or the incorrect explicitness instruction.Its reported precision and recall were 0.385 and 0.952, respectively.
  • 6.2.4 Discussion: The discussion characterizes prompt engineering as sensitive to the specific LLM and emphasizes engagement between prompt engineers and domain experts.It describes these systems as being cajoled rather than programmed.

7 Related Work

Prior surveys cover domain-specific, multimodal, and broad prompting applications, while this work distinguishes its focus on discrete prefix prompting.

  • Liu et al. review prompt template engineering, answer engineering, prompt ensembling, and prompt tuning across multiple prompting types and language models.Their scope includes cloze and soft-prompting, unlike this study’s narrower focus.
  • Existing reviews address prompt engineering across general methods, medical and healthcare applications, mental health, visual tasks, and multimodal interactions.The surveyed literature includes both domain-focused reviews and modality-specific analyses.
  • The reviewed work also includes GPT-4-automated analysis, topic modeling, foundation-model surveys, and studies of text-to-image adoption.These studies extend prompting-related review beyond discrete text prompting.
  • One cited resource is the GPT-4V system card, referenced in the discussion of multimodal prompting literature.The passage identifies the resource but does not summarize its findings.

8 Conclusions

The paper frames generative AI prompting as an emerging field with limited understanding and proposes a broad taxonomy and terminology to organize it. It also recommends problem-focused evaluation, representative data and metrics, simple methods first, and skepticism toward performance claims.

  • Generative AI is novel, and broader understanding of models’ capabilities and limitations remains limited.Natural-language interaction adds ambiguity, context dependence, and the need for course correction.
  • The paper aims to provide a comprehensive taxonomy and terminology covering many existing prompting techniques while accommodating future methods.It also discusses frameworks, safety, and security considerations.
  • Prompt-engineering practice should begin with the problem being solved and with data and metrics that represent that problem well.The recommendation shifts attention beyond input/output behavior and benchmark scores.
  • Practitioners should start with simpler approaches and remain skeptical of claims about method performance.The paper also encourages researchers to situate new methods within the taxonomy and report ecologically valid case studies.

A.1 Definitions of Prompting

The definitions distinguish a prompt as model input from prompt engineering as the practice of structuring and refining that input to guide LLM outputs.

  • Prompt engineering is the practice of designing, refining, and implementing prompts or instructions that guide LLM outputs for tasks.The definition also characterizes it as interacting effectively with AI systems to optimize their benefits.
  • A prompt is the input provided to a model.The passage places this definition alongside prompt engineering as the process of structuring input text for LLMs.

A.2.1 Prompting Terms

The section defines the context window as the token space an LLM can process and priming as an initial prompt that sets instructions for a conversation.

  • A context window is the space of tokens an LLM can process, bounded by a maximum context length.
  • Priming gives a model an initial prompt containing instructions, such as a role, for the remainder of a conversation.Priming can occur in either the system prompt or the user prompt.

A.2.2 Prompt Engineering Terms

Conversational Prompt Engineering describes refining GenAI outputs within an ongoing conversation, unlike sending a completely new prompt.

  • Conversational Prompt Engineering involves asking a GenAI to refine its output during a conversation.
  • It contrasts with prompt engineering performed by sending the GenAI a completely new prompt.

A.2.3 Fine-Tuning Terms

The paper distinguishes the conflicting term Prompt-Based Learning from Prompt Tuning, reserving the latter for optimizing prompt weights rather than discrete prompt engineering.

  • Prompt-Based Learning, also called Prompt Learning, refers broadly to using prompting-related techniques and often appears in fine-tuning contexts.Its conflicting usage leads the paper not to use the term.
  • Prompt Tuning directly optimizes prompt weights, usually through gradient-based updates.It has also been called Prompt Fine-Tuning.
  • Prompt Tuning should not denote discrete prompt engineering.

A.2.4 Orthogonal Prompt Types

The paper classifies prompts along several independent dimensions, including originator, token representation, prediction style, and broader prompt types.

  • A.2.4 Orthogonal Prompt Types: The paper introduces terminology for high-level classifications of prompts.
  • A.2.4.1 Originator: User prompts originate from users and are the most common form in consumer applications.
  • A.2.4.1 Originator: Assistant prompts are outputs from the LLM itself when fed back into the model, such as in conversation history.
  • A.2.4.1 Originator: System prompts provide high-level instructions for interacting with users, although some models do not have them.
  • A.2.4.2 Hard vs Soft Prompts: Hard prompts contain only vocabulary tokens corresponding directly to words.
  • A.2.4.2 Hard vs Soft Prompts: Soft prompts may use tokens without corresponding vocabulary words, enabling gradient updates through prompt tokens while the full model remains frozen.This supports fine-tuning when modifying the full model is prohibitively expensive.
  • A.2.4.3 Prediction Styles: Cloze prompts place tokens to be predicted into slots, usually in the middle, whereas prefix prompts place the predicted token at the end.Cloze prompting is associated with earlier transformer models such as BERT, while prefix prompting is associated with modern GPT-style models.

A.3 Datasheet

The paper provides a datasheet with additional information about its associated dataset, which is hosted on HuggingFace.

  • An accompanying datasheet provides more information about the paper's dataset.The dataset is hosted on HuggingFace.

A.3.1 Motivation

The dataset was created to gather existing prompt-engineering literature and analyze hard prefix-prompting techniques. Its English-only, semi-automated collection and review process define important scope and quality boundaries.

  • Dataset purpose: The dataset gathers existing literature to analyze current hard prefix-prompting techniques.Its stated purpose was to fill a literature-gathering and analysis need for prompt engineering.
  • Dataset composition: 1,565 research papers in PDF format comprise the dataset, with duplicates removed automatically though some may remain.
  • Quality limitation: The semi-automated collection could include irrelevant papers or omit relevant ones despite manual reviews intended to mitigate these errors.
  • Collection and preprocessing: Scripts queried the Arxiv and Semantic Scholar APIs, followed by manual and semi-automated relevance review and duplicate removal.The collection also drew on ACL, Arxiv, and Semantic Scholar.
  • Scope limitation: All collected papers were written in English, so papers may be missing when translations were unavailable.
  • Search scope: The review covers prompting-related topics including interpretability, curriculum learning, feedback loops, human-in-the-loop methods, and token-efficient prompting.Search terms also included LLM prompting, prompt engineering, transformer prompts, transfer learning, and NLP prompting strategies.
Loading 2406.06608v6…