Advanced Prompting Techniques
Chain-of-thought, few-shot, structured outputs
Recommended
Advanced Prompting Techniques — Timed Test (4 questions)
No account needed. Answers and explanations arrive when you submit.
Advanced Prompting Techniques — the theory
Beyond the fundamentals — clarity, examples, and step-by-step reasoning — a handful of more advanced prompting techniques can meaningfully improve results on harder tasks.
Chain-of-thought prompting. This is the practice of explicitly asking a model to reason through a problem in steps before giving a final answer, rather than jumping straight to a conclusion. For tasks involving arithmetic, logic, or multi-step analysis, this consistently improves accuracy, because it gives the model room to catch its own errors along the way rather than committing to an answer immediately. A simple version of this is adding a phrase like "think step by step" or "explain your reasoning before answering" to a prompt.
Few-shot prompting. Rather than only describing what you want in words, showing the model one or more concrete examples of the input-output pattern you're looking for is often far more effective than a purely descriptive instruction. This is especially useful for tasks with a specific, non-obvious output format — for example, extracting structured data from unstructured text, where showing two or three worked examples teaches the pattern far faster than trying to describe it precisely.
Role and persona framing. Asking a model to approach a task from a specific perspective — "as an experienced copyeditor," "as a security-focused code reviewer," "as a skeptical fact-checker" — can shift the lens the model applies to a task, surfacing different concerns or a different tone than a neutral request would. This works because it primes the model toward the kind of reasoning and vocabulary associated with that role.
Structured output requests. For tasks where the output needs to be parsed programmatically or fit a specific template, explicitly requesting a structured format — a numbered list, a table, JSON with named fields, or specific XML-style tags around different parts of the answer — produces far more reliable, consistently-formatted results than a free-form request, and makes the output easier to extract and use downstream.
Decomposing complex tasks. Rather than asking for a large, complex deliverable in a single request, breaking it into a sequence of smaller, more specific prompts — first asking for an outline, then asking for each section, then asking for a final review pass — often produces a better result than a single giant prompt, especially for long-form writing, complex code, or multi-part analysis. Each smaller prompt is easier for the model to execute well, and easier for you to check and correct along the way before compounding errors into a large final output.
Providing negative examples. Alongside showing what good output looks like, explicitly stating what you don't want — a particular tone to avoid, a common mistake to watch for, a format not to use — can be just as valuable as positive examples, especially when a first attempt reveals a specific, recurring issue you want corrected in subsequent attempts.
Iterative refinement as a technique, not a fallback. Rather than treating a single prompt as a one-shot attempt that either succeeds or fails, treating the interaction as a deliberate multi-round refinement — reviewing the first draft, identifying specifically what to change, and prompting again with that feedback — is itself a technique worth using intentionally, not just something to fall back on when a first attempt disappoints.
Self-critique and verification prompts. A related technique is asking the model to check its own work as an explicit, separate step: "review the answer above and list anything that might be wrong or missing," or "verify this solution against the original requirements one by one." Because generation and evaluation are different tasks, a model reviewing an answer will often catch errors it made while producing that same answer — and making the check a distinct prompt, rather than hoping the first response is self-correcting, is what surfaces those catches reliably.
Combining techniques deliberately. These techniques compose naturally, and hard tasks usually benefit from more than one at a time. A demanding analysis might combine role framing ("as a skeptical financial analyst"), chain-of-thought ("work through the assumptions step by step"), structured output ("present the result as a table of claims and evidence"), and a follow-up verification prompt. The skill is not memorizing each technique in isolation but recognizing what a specific task needs: reasoning room, pattern examples, a perspective shift, an output contract, or decomposition into stages.
Knowing when the simple prompt is enough. Advanced techniques carry a small cost — longer prompts, slower responses, more setup — and for straightforward tasks they add nothing. Asking for step-by-step reasoning on a simple factual question, or building a few-shot scaffold for a task the model handles well from a plain description, is effort spent where it makes no difference. Reaching for the heavier tools only when a task actually shows signs of needing them — wrong answers, inconsistent formats, shallow analysis — keeps prompting efficient rather than ritualistic.
Together, these techniques move prompting from a single well-phrased request toward a more deliberate practice: choosing the right technique for the type of task at hand, whether that's chain-of-thought for reasoning-heavy work, few-shot examples for pattern-matching tasks, or decomposition for large, complex deliverables.
Sample questions
Three questions from this topic, with the answer and the reasoning shown.
Q1EasyWhat is role or persona framing in a prompt?
- Asking the model to approach a task from a specific perspective, like an experienced reviewerCorrect
- Requiring the model to identify as a human
- Assigning the model a random name
- Disabling all safety behavior
Explanation
Role framing asks the model to approach a task from a specific perspective, which can shift the concerns or tone it applies.
Q2MediumWhat is chain-of-thought prompting?
- Explicitly asking a model to reason through steps before giving a final answerCorrect
- Chaining together multiple unrelated AI tools
- Repeating the same prompt multiple times
- Only using single-word prompts
Explanation
Chain-of-thought prompting asks the model to reason step by step before answering, which improves accuracy on logic and math-heavy tasks.
Q3MediumWhat is the benefit of decomposing a complex task into a sequence of smaller prompts?
- Each smaller prompt is easier to execute well and easier to check along the wayCorrect
- It guarantees the model will never make an error
- It always takes less total time than a single prompt
- It removes the need for any review of output
Explanation
Breaking a complex task into smaller prompts makes each step easier to execute well and lets you catch issues before they compound.