GPT models generate from context. The prompt is that context—instructions, examples, retrieved docs, and chat history. From GPT-2 zero-shot framing through GPT-3 few-shot and chat messages, prompting is how products program frozen weights. The next lecture covers the model’s reply: Completion.
Learning Objectives
By the end of this lesson, students should be able to:
- Define a prompt as the conditioning prefix for an LM.
- Distinguish completion prompts vs. chat message lists.
- Apply zero-, one-, and few-shot patterns.
- Use system messages and structured instructions effectively.
- Recognize failure modes: ambiguity, conflicting orders, overlong context.
- Connect prompting to RAG and tool-calling wrappers.
A prompt is the input text (and optionally multimodal context) provided to a language model that conditions its next-token distribution—including instructions, demonstrations, user questions, and conversation history.
Prompt Patterns
Instruction
- “Summarize in 3 bullets”
- Clear constraints
- Chat system role
Few-shot
- Show input/output pairs
- Fix the format
- GPT-3 style
Grounded
- Paste retrieved context
- “Answer only from...”
- RAG pattern
| Style | Shape | Typical use |
|---|---|---|
| Raw completion | One string prefix | Base LMs, code infilling demos |
| Chat messages | system / user / assistant turns | Instruction-tuned models |
| Template | Variables filled into a scaffold | Production apps |
Design Checklist
What success looks like.
Format, length, safety.
Context the model may use.
Automate checks on outputs.
“Longer prompts are always better.” Extra tokens cost latency/money and can distract. Prefer concise instructions plus the minimum necessary evidence.
Strengths and Tradeoffs
Strengths
- No weight updates required.
- Fast iteration for products.
- Composes with retrieval/tools.
Tradeoffs
- Brittle to wording changes.
- Context window limits.
- Not a substitute for evals / fine-tunes always.
Knowledge Check
- Short Answer: What is a prompt? Answer: The conditioning input prefix for the LM.
- True/False: Few-shot prompts include demonstrations. Answer: True.
- Multiple Choice: Chat APIs typically use: (a) role-tagged messages, (b) only raw pixels, (c) Fortran COMMON blocks. Answer: (a).
- Short Answer: Name one grounded prompting strategy. Answer: RAG / provide documents and restrict answers to them.
- True/False: Prompting always updates model weights. Answer: False.
- Multiple Choice: A risk of huge prompts: (a) cost and distraction, (b) guaranteed perfection, (c) free unlimited context always. Answer: (a).
- Short Answer: What GPT-3 idea made prompting central? Answer: In-context few-shot learning.
- Short Answer: Why use a system message? Answer: To set durable behavior/policy for the assistant.
- Multiple Choice: Prompt templates help: (a) consistent production scaffolding, (b) remove tokenization, (c) train CNNs. Answer: (a).
- True/False: Ambiguous instructions often cause unreliable completions. Answer: True.
Key Takeaways
- Prompts program frozen LMs via context.
- Patterns: instructions, few-shot, grounded RAG.
- Chat roles structure modern interfaces.
- Keep prompts clear, minimal, and evaluated.
- Next: Completion.
Hands-on idea: A/B test two phrasings of the same task; measure format compliance rate.
Discussion prompt: When should you stop prompt-tuning and start fine-tuning / PEFT?
Recap: Prompts are the control surface for GPT-style models. Finish with Completion.