AI / A CONCEPT NOTE
Chain of Thought
thinking step-by-step before answering
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
Instructing the model to write down its reasoning process step-by-step before outputting the final answer, which improves accuracy on logical, math, and coding tasks.
02 / FOLLOW THE MECHANISM
How logical executions flow
Trigger
prompt asks: 'If I have 3 apples and eat 1... Let's think step by step.'
Reasoning line
LLM starts outputting its reasoning: 'First, I start with 3. Next, I subtract 1...'
Resolve answer
model reaches final conclusion: 'Therefore, I have 2 left.'
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
run chain-of-thought query
ollama run llama3 \"Solve 123 * 45. Let's think step-by-step.\"05 / CHECK YOURSELF
Could you explain Chain of Thought to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in AI engineeringTop-k Samplinglimiting choices to the top k tokens