AI
Prompt Engineering
The art of communicating with AI
Overview
Prompt engineering is the practice of crafting inputs to language models to elicit accurate, relevant, and useful outputs. Effective prompts leverage the model's training distribution, structure problems clearly, and use techniques like few-shot examples, chain-of-thought reasoning, role assignment, and output format specification.
Key Concepts
- Zero-shot prompting: direct instruction without examples
- Few-shot prompting: providing examples to demonstrate the desired format
- Chain-of-thought: asking the model to reason step by step
- Role prompting: assigning a persona to shape response style
- System/user turn structure in instruction-tuned models
Key Facts
- Chain-of-thought prompting (Wei et al., 2022) dramatically improves complex reasoning
- The phrase "Let's think step by step" increases accuracy on math benchmarks
- Prompt injection is a key security risk in LLM-powered applications
- Constitutional AI uses prompts to train models to critique their own outputs