Chain of thought (COT)
Chain-of-Thought is a prompting technique used to guide large language models (LLMs) through a step-by-step reasoning process before producing a final answer. By breaking a problem into smaller steps, the model generates intermediate reasoning, making its logic transparent and improving accuracy for tasks that require multistep thinking, such as coding, planning, or solving math and logic problems.
CoT prompting works by expanding the model’s context, strengthening self-attention across tokens, and allowing internal error correction. This helps the LLM capture dependencies between ideas and avoid hasty or illogical conclusions.
There are different CoT prompting styles.
- Few-shot CoT: Provides examples with reasoning steps and answers to guide the model’s approach.
- Zero-shot CoT: Uses direct instructions like “let’s think step by step” without prior examples.
- Least-to-most CoT: Starts with simple versions of a problem and builds to a full solution.
- Self-consistency CoT: Solves the same problem multiple times and compares outputs to choose the most consistent answer.
CoT prompting can improve reasoning in LLMs but may generate verbose outputs, increase computational costs, or produce overconfident yet incorrect steps. Developers often combine CoT with fine-tuning, reinforcement learning, and retrieval-augmented generation (RAG) to strengthen reliability and reduce hallucinations.