Prompt engineering
Prompt engineering is the practice of crafting the text input to a language model to elicit accurate, useful, or appropriately formatted outputs without mo...
What Prompt Engineering Is and Why It Matters
Prompt engineering is the practice of crafting the text input to a language model to elicit accurate, useful, or appropriately formatted outputs without modifying the model's weights. Because large language models are sensitive to the exact phrasing, structure, and context of their input, carefully designed prompts can dramatically change output quality. This sensitivity means that prompt engineering is a practical skill distinct from model training.
An example: asking a language model to summarize an article by simply providing the article and asking for a summary may produce a generic result. Prefacing the request with you are a skilled technical editor who writes concise bullet-point summaries for engineers and appending a format specification produces a more targeted and usable output. Neither example requires any model training; the difference is entirely in the prompt structure.
Exam tip: Distinguish between zero-shot, one-shot, and few-shot prompting. Zero-shot asks the model to perform a task with instructions alone. One-shot provides a single example of a correctly completed task before the actual query. Few-shot provides several examples. Few-shot prompting can substantially improve performance on tasks that are similar to the examples and is one of the most reliable techniques for adapting a model to a new format without fine-tuning.
Chain-of-Thought and Decomposition Techniques
Chain-of-thought prompting encourages the model to reason through a problem step by step before producing its final answer. Including the phrase let us think step by step, or providing few-shot examples that show multi-step reasoning, consistently improves performance on mathematical, logical, and multi-step planning tasks. The model is more likely to arrive at a correct answer when it has laid out intermediate reasoning rather than attempting to produce the answer in a single step.
Decomposition techniques break complex questions into a sequence of simpler sub-questions, either through the prompt itself or through iterative prompting where the model answers each sub-question in turn. Least-to-most prompting is a systematic version of this approach that first asks the model to identify the sub-problems and then solves them in order.
These techniques work because language models are trained to predict likely continuations. A prompt that structurally resembles a correct reasoning trace makes it more likely that the continuation will be a correct conclusion. Showing one worked example of step-by-step reasoning in the few-shot context is often sufficient to activate this behavior reliably.
System Prompts, Role Prompts, and Practical Limits
Many deployed language model interfaces support a system prompt: a special instruction block that appears before the user's message and sets context, tone, persona, or behavioral constraints. System prompts are particularly useful for building task-specific applications on top of general models because they allow consistent framing without requiring users to specify it themselves. A customer service chatbot might have a system prompt establishing the company name, communication style, and topics the assistant is authorized to discuss.
Role prompting assigns the model a persona, such as an expert in a specific domain, to improve the quality and specificity of responses in that area. While this technique is widely used, its effectiveness varies across tasks and models and should be evaluated empirically rather than assumed.
Prompt engineering has practical limits. It cannot make a model reliable on tasks that exceed its underlying capabilities, correct persistent factual errors, or guarantee consistent formatting across many generations. When prompting alone is insufficient, the appropriate next steps are retrieval-augmented generation to provide relevant facts, or fine-tuning to adapt model behavior more fundamentally. Understanding where prompting ends and other techniques begin is important for scoping realistic expectations in production deployments.