Last updated:
A Systematic Survey of Prompt Engineering in Large Language Models: Techniques and Applications
Pranab Sahoo et al.
In collections: Prompting
Prompt engineering has become an indispensable technique for extending the capabilities of large language models (LLMs) and vision-language models (VLMs). This approach uses task-specific instructions, known as prompts, to improve a model's performance without modifying its underlying parameters. Instead of updating model parameters, prompts allow pre-trained models to be integrated seamlessly with downstream tasks by eliciting the desired model behaviors from the supplied prompt alone. P
rompts can be natural-language instructions that provide context to guide the model, or learned vector representations that activate the relevant knowledge. This rapidly developing field has enabled success in a range of applications, from question answering to commonsense reasoning. Still, a systematic organization and understanding of the diverse prompt engineering methods and techniques is lacking. This survey article fills that gap by providing a structured overview of the latest advances in prompt engineering, categorized by application area. For each prompting approach, we present a summary detailing the methodology, its applications, the models involved and the datasets used.
We also delve into the strengths and limitations of each approach, and include a taxonomy diagram and a table summarizing the datasets, models and key points of each prompting technique. This systematic analysis enables a better understanding of this fast-moving field and facilitates future research by shedding light on open challenges and opportunities in prompt engineering.
Strategies from the report
Zero-Shot Prompting: A technique that relies solely on the built-in knowledge of a pre-trained model, without giving it any ready-made examples of a solution. It works great for simple, common tasks, where the AI can naturally generalize concepts from its training data.
Few-Shot Prompting: A strategy of giving the model a few example "input-output" pairs in the prompt itself before asking the actual question. This lets the AI imitate the expected pattern (meta-learning) and significantly improves accuracy on non-standard tasks.
Chain-of-Thought (CoT) Prompting: An advanced technique that makes the model generate intermediate reasoning steps before it gives the final result. It simulates the human step-by-step analytical process, dramatically improving performance on hard logic and arithmetic problems.
Best practices
Building strong, detailed context: The more precise background information (the model's role, the business goal, the target audience) you put in the instruction, the more accurate the generated content becomes and the less prone to vague answers (so-called hallucinations).
Precisely formatting the output: Always state clearly what structure you want the answer in (e.g. a table, JSON, a specific number of paragraphs, a bulleted list). This saves the user the time of manually reformatting the data afterward.
Iterative refinement: Writing prompts is rarely a one-shot process. Watching the model's mistakes and fixing your queries with additional constraints lets you systematically "calibrate" the final result over a series of conversations with the assistant.
What to avoid
Using ambiguous or very vague language: Prompts that leave a lot of room for interpretation force the model to "guess" your intentions. This often leads to answers that are technically correct but useless from the user's perspective.
Overloading the context window (Context Overload) in the Few-Shot method: Avoid inserting too many lengthy examples to teach the model. They take up precious "tokens" of the LLM's limited working memory, raise the cost of generation, and can make the AI ignore key instructions at the very bottom of the prompt.
Mixing roles and contradictory instructions: Introducing many unrelated formatting rules, or clashing roles to play, in one small block of text can overwhelm the model, causing it to lose key points of the task.
Support this project by buying me a coffee ;)