Choose the Right Prompting Technique
Do not add complexity by reflex. Start with the lightest method that fits the failure you are trying to correct.
Match the Method to the Problem
Zero-Shot
Start here for straightforward tasks the model already understands. Give a clear goal, context, and output format.
Few-Shot
Add two or three examples when labels, tone, structure, or edge-case treatment must follow a pattern.
Prompt Chaining
Split work when one pass must extract, transform, check, and then format information.
Retrieval
Provide trusted documents when the answer depends on private, current, or specialized facts.
Self-Consistency
Generate independent approaches and compare them when a reasoning task has one verifiable answer.
Human Review
Keep a person in the loop when the output affects rights, money, safety, reputation, or irreversible action.
Add Technique Only After You See a Failure
- Write the simplest complete instruction and test it on a representative input.
- If the form is wrong, add examples. If the process is tangled, split it into stages.
- If facts are missing, attach reliable sources and require source-grounded answers.
- If reasoning is unstable, compare multiple independent attempts against a checkable criterion.
- If failure remains consequential, change the workflow rather than making the prompt longer.
Original Sources
Condensed from DAIR.AI's Prompting Techniques, including its guides to few-shot prompting, prompt chaining, and self-consistency. The project is available under the MIT license.