AI in Motion

Prompt Engineering and Chain-of-Thought

Generative AIBeginner1:196 chapters

Clear roles, context, examples and step-by-step reasoning: how to get much better answers from language models.

📄 Illustrated notes · every chapter as a picture · printable

Shortcuts: Space play/pause · ←/→ 5 s · N/P chapter · M voice · C subtitles · F fullscreen

Quick quiz

3 questions to check your understanding.

Q1 What is few-shot prompting?
Q2 In the pen-and-notebook puzzle, what does the pen cost?
Q3 Why ask for step-by-step reasoning?

Go deeper

University-level written lectures in The AI Lecture Hall:

Transcript

Introduction. The same model can give a vague answer or an excellent one, depending on how you ask. Prompt engineering is the skill of asking well.

Building blocks. Strong prompts usually include a role, the context, a clear task, constraints such as length and tone, and the output format you want. When an answer disappoints, one of these is usually missing.

Few-shot prompting. Showing a few examples in the prompt, called few shot prompting, teaches the model the pattern you want without any training. It is a form of in-context learning.

Thinking step by step. For reasoning problems, asking the model to think step by step, or using a model with built-in reasoning, often improves accuracy. The quick answer here is ten taka, which is wrong. Working it out shows the pen costs five taka.

Tips. Be specific. Give examples. Break big tasks into steps. Ask for sources, and always verify important facts, because a well-phrased prompt still does not guarantee a correct answer.

Recap. To recap. Give role, context, task, constraints and format. Use examples. Ask for step by step reasoning on hard problems. Iterate, and verify.