0%
Prompt Engineering11 min

Core Prompting Techniques

Prompt engineering is the practice of designing inputs that reliably elicit high-quality outputs from language models. At the professional level, it involves systematic techniques, not trial and error.

Zero-shot, one-shot, and few-shot prompting

Zero-shot: the task description alone, with no examples. Works for clear, common tasks. "Classify this customer review as positive, negative, or neutral."

One-shot/few-shot: including one or more examples of the desired input-output pattern before the actual task. Dramatically improves performance for uncommon formats, domain-specific tasks, and nuanced judgements. The examples do not need to be real. Synthetic examples that demonstrate the format work equally well.

Chain of thought (CoT)

Adding "Let us think through this step by step" or providing reasoning traces in few-shot examples significantly improves performance on complex reasoning tasks. The model is effectively forced to generate intermediate steps before producing its answer, which reduces errors on multi-step reasoning.

Role prompting

Assigning the model a persona ("You are a senior tax accountant in New Zealand") activates relevant knowledge and appropriate register. The mechanism is not fully understood. It appears to shift what the model treats as the relevant distribution to sample from, but it works reliably in practice.

Structured output formatting

For programmatic use, specifying the exact output format, whether JSON schema, table structure or XML tags, is essential. Most frontier models support JSON mode or structured output APIs that force output to conform to a specified schema, dramatically reducing parsing errors in downstream code.

The highest-leverage prompting investment is usually few-shot examples and output format specification. These two changes resolve the majority of prompt quality problems in production systems.

Check your understanding

3 questions, 70% to pass
1. What is few-shot prompting?
2. Why does chain of thought prompting improve complex reasoning?
3. When does zero-shot prompting work well?