Chain-of-Thought là kỹ thuật yêu cầu model "suy nghĩ từng bước" trước khi đưa ra đáp án cuối, thay vì trả lời trực tiếp. Tăng độ chính xác đáng kể trên các task reasoning (toán, logic, nhiều bước).
Hai dạng: Zero-shot CoT — thêm câu "Let's think step by step" vào cuối prompt. Few-shot CoT — ví dụ mẫu có lời giải chi tiết để model bắt chước.
Ví dụ:
Q: "Một shop bán 23 áo thứ 2, 18 áo thứ 3.
Mỗi áo 15$. Tổng doanh thu 2 ngày?"
Naive: "615$" (có thể sai)
CoT: "Thứ 2: 23×15=345. Thứ 3: 18×15=270.
Tổng: 345+270=615$"Khi nào dùng: task cần reasoning nhiều bước, toán/logic, extraction từ văn bản phức tạp, decision với nhiều điều kiện. Khi KHÔNG cần: task đơn giản (classification, tóm tắt ngắn) — CoT chỉ tốn token thêm mà không cải thiện.
Mở rộng: Self-Consistency (sample nhiều CoT, lấy đáp án đa số), Tree of Thoughts (khám phá nhiều nhánh suy luận), ReAct (CoT + tool use). Các model reasoning mới (o1, o3, Claude extended thinking) đã internalize CoT nên prompt không cần ép nữa.
Chain-of-Thought is a technique asking the model to "think step by step" before producing the final answer, instead of answering directly. It substantially boosts accuracy on reasoning tasks (math, logic, multi-step).
Two forms: Zero-shot CoT — append "Let's think step by step" to the prompt. Few-shot CoT — include examples with explicit step-by-step solutions for the model to mimic.
Example:
Q: "A shop sold 23 shirts Monday, 18 Tuesday.
Each $15. Total 2-day revenue?"
Naive: "$615" (might be wrong)
CoT: "Mon: 23×15=345. Tue: 18×15=270.
Total: 345+270=$615"When to use: multi-step reasoning, math/logic, complex extraction, decisions with many conditions. When NOT to use: simple tasks (classification, short summaries) — CoT just wastes tokens.
Extensions: Self-Consistency (sample multiple CoTs, majority vote), Tree of Thoughts (explore branching reasoning), ReAct (CoT + tool use). New reasoning models (o1, o3, Claude extended thinking) have internalized CoT — no need to force it via prompt.