Prompting — steering a language model
Be able to write clear instructions to a language model, give examples and context, and judge when the answer needs checking.
Prerequisites
Intuition
A prompt is everything you send to the model. Four building blocks:
- Role/context — «You are a patient maths teacher for year 8.»
- Task — «Explain equations with x on both sides.»
- Examples (few-shot) — show one worked example in the style you want.
- Format — «Three steps, then a practice exercise, 120 words maximum.»
The model continues your text in the most likely way. The clearer the pattern you give, the more predictable the answer. Vague prompts give vague answers.
Code
You are a patient maths teacher for year 8.
Explain how to solve 3x + 4 = x + 10.
An example of the style:
Exercise: 2x + 1 = 7
1) Subtract 1 from both sides: 2x = 6
2) Divide both sides by 2: x = 3
Check: 2·3 + 1 = 7 ✔
Answer in the same style, and finish with a similar exercise I can solve myself.
Always check when the answer contains: numbers, years, quotations, code that is going to be run, medical or legal advice. The model can produce convincing errors — especially in arithmetic.
Mastery means
- Writes an instruction with a role, a task, examples and a format
- Judges when the answer needs checking
Sign in to do the exercises and build your mastery up.
Sources
- OpenAI — Prompt engineering guide — documentation, free to read
- Anthropic — Prompt engineering — documentation, free to read
Leads to
Part of the goals (17)
- AI, ethics and society
- Build a RAG system you can trust
- Language models in practice
- Build an agent you can trust
- An AI service in operation
- Build an AI service that survives production
- Build a memory system for an agent
- Interpreting a language model
- AI safety in practice
- Responsible AI in practice
- Multimodal systems
- AI in production
- Frontier Lab — an independent research project
- Fine-tune and run your own models
- Evals in practice
- Reproduce a paper
- Deep reinforcement learning