← AI Terminology
Prompt Engineering
Prompt engineering is the practice of designing and refining the text inputs (prompts) given to large language models to elicit accurate, useful, and appropriately formatted responses — without modifying model weights.
It is the primary interface skill for working effectively with LLMs.
It is the primary interface skill for working effectively with LLMs.
Why It Matters in AI
LLMs are exquisitely sensitive to how questions are asked: the same model can give correct or incorrect answers depending on phrasing, provide helpful or harmful outputs depending on framing, and produce well-structured or chaotic responses depending on format instructions. Prompt engineering systematises this: techniques like chain-of-thought, few-shot examples, role assignment, and output format specification reliably improve performance — sometimes matching fine-tuned models at zero additional cost.
Key Points
| Aspect | Description |
|---|---|
| Few-shot | Provide examples in the prompt — "positive: 'great!' / negative: 'terrible' / [text]:" |
| Zero-shot | Ask directly without examples — "Classify this sentiment: [text]" |
| System prompt | Persistent instructions in API system field — sets behaviour across the entire conversation |
| Format control | "Respond in JSON with keys: {name, score, reason}" — structure output for downstream parsing |
| Role prompting | "You are an expert tax attorney…" — conditions model to adopt a persona and knowledge set |
| Chain-of-thought | "Think step by step" — elicits reasoning traces that dramatically improve multi-step problems |
Simple Analogy
A movie director giving instructions to an actor: "speak slowly, you're a doctor explaining a diagnosis to a worried patient, mention three key points, don't use medical jargon." The actor (LLM) is capable of many performances — the director's instructions (prompt) shape which performance emerges.
Common Usage Examples
- Chain-of-thought:
"Solve this step by step:\n[math problem]"— improves accuracy on reasoning tasks - Few-shot:
"Q: What is 15% of 80? A: 12. Q: What is 20% of 45? A: 9. Q: What is 30% of 90? A:" - Anthropic prompting guide: "be specific, be direct, provide examples" — official prompt best practices
- Structured output:
"Respond ONLY with valid JSON: {"sentiment": "positive|negative", "score": 0.0-1.0}" PromptTemplate(template="Summarise in {n} bullet points: {text}")— LangChain template
Summary
In short: Prompt engineering systematically designs LLM inputs to reliably elicit accurate, useful, and well-formatted responses — the foundational skill for working with LLMs, enabling performance improvements that can match fine-tuning at zero additional cost.