AI / A CONCEPT NOTE

Chain of Thought

thinking step-by-step before answering

~65 sec read

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

  1. Trigger

    prompt asks: 'If I have 3 apples and eat 1... Let's think step by step.'

  2. Reasoning line

    LLM starts outputting its reasoning: 'First, I start with 3. Next, I subtract 1...'

  3. 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.

EXAMPLE 01 · REFERENCE

run chain-of-thought query

ollama run llama3 \"Solve 123 * 45. Let's think step-by-step.\"

Explore command anatomy in the CLI lab