04. Key Techniques and Terms
Zero-shot prompting:
Ask the model to do a task with no examples. Works well for instruction-tuned models on common tasks. Example: classifying sentiment, answering a factual question, summarizing a paragraph. The model draws entirely on pretraining.
Few-shot prompting:
Provide 2 to 5 input-output demonstration pairs inside the prompt before the actual query. This guides the model on format, tone, and reasoning style. Research by Min et al. (2022) found that label space and input distribution in demonstrations matter more than the correctness of individual labels, though correct labels are still better in practice.
Role / persona:
Prefixing the prompt with a role assignment ("You are a senior data engineer") shifts the model's vocabulary, assumed knowledge level, and tone. It does not grant the model new factual knowledge, but it narrows the space of likely responses toward domain-appropriate language.
Output format control:
Specifying structure in the prompt ("Return a JSON object with keys: title, summary, tags") is more reliable than hoping the model chooses a format. Without explicit format instructions, models default to a generic prose style that may be hard to parse programmatically.
Instruction vs. context vs. examples. These are the three building blocks of any prompt:
- Instruction: the verb-driven directive ("Summarize", "Classify", "Extract").
- Context: background the model needs to execute the task (the document, the user's role, the product domain).
- Examples: demonstrations of the desired input-output pattern (few-shot).