← Master Index
Vol. 13 Module 13.1 Lecture

Chain of Thought

Prompting Techniques

How This Lesson Fits the Module & Volume

Zero-, one-, and few-shot prompting mainly shape what the answer looks like. Chain-of-thought (CoT) shapes how the model reaches it: by eliciting intermediate reasoning steps before the final answer.

CoT is the gateway to Module 13.1’s reasoning cluster—tree-of-thoughts, self-consistency, and reflection all build on the idea that deliberate intermediate text can improve hard tasks.

Learning Objectives

By the end of this lesson, students should be able to:

  • Define chain-of-thought prompting and when it helps.
  • Write zero-shot CoT cues (e.g., “think step by step”) and few-shot CoT demos.
  • Separate scratchpad reasoning from the final answer for parsers and users.
  • Identify tasks where CoT helps (math, multi-hop) vs where it adds noise.
  • Combine CoT with structured final answers (JSON / labels).
  • Preview how sampling multiple CoT paths enables self-consistency.
Definition

Chain-of-thought prompting encourages the model to generate explicit intermediate reasoning steps—a verbal “scratchpad”—before committing to a final answer, improving performance on multi-step problems.

Zero-Shot CoT vs Few-Shot CoT

StyleHow you elicit stepsBest for
Zero-shot CoT“Let’s think step by step.” / “Show your work.”Quick wins; capable instruction models
Few-shot CoTDemos that include worked reasoning + answerControlling style and rigor of steps
Answer-onlyNo reasoning requestedEasy classification / formatting

Zero-Shot CoT Prompt

A store sells pens for $2 and notebooks for $5. If Maya buys 3 pens and 2 notebooks and pays with a $20 bill, how much change does she receive? Think step by step. After the reasoning, end with: FINAL: <amount with dollar sign>

Few-Shot CoT Sketch

Q: A box has 4 red and 6 blue balls. Draw 1 at random. P(red)? A: Total balls = 4+6=10. Favorable = 4. Probability = 4/10 = 0.4. FINAL: 0.4 Q: {{NEW_QUESTION}} A:

Where CoT Helps—and Where It Does Not

Helps

  • Arithmetic and symbolic tasks.
  • Multi-hop reading comprehension.
  • Logic puzzles with constraints.

Often neutral

  • Simple sentiment / tagging.
  • Pure style rewriting.
  • Already one-step lookups.

Risks

  • Fluent but wrong reasoning.
  • Leaking private scratchpads to users.
  • Higher token cost / latency.

Production Pattern: Hidden Scratchpad

Ask the model to reason privately, then emit a machine-readable final field. Downstream systems parse only FINAL (or JSON), while logs retain the chain for debugging. Pair with structured output when answers must be schema-valid.

Strengths and Tradeoffs

Strengths

  • Improves multi-step accuracy on many models.
  • Debuggable: you can read where it went wrong.
  • Composes with few-shot and self-consistency.

Tradeoffs

  • Longer outputs cost more.
  • Reasoning can be confidently incorrect.
  • Not a substitute for tools or retrieval when facts are missing.
Common Misconception

“If the chain looks logical, the answer is correct.” Language models can produce coherent-looking justifications for wrong conclusions. Treat CoT as a performance aid and audit trail—not as a proof. For critical answers, verify with tools, tests, or self-consistency.

Knowledge Check

  1. Short Answer: What does CoT ask the model to produce before the answer? Answer: Explicit intermediate reasoning steps.
  2. True/False: CoT always improves simple sentiment classification. Answer: False—often neutral or wasteful.
  3. Multiple Choice: Zero-shot CoT typically uses: (a) gradient updates, (b) a cue like “think step by step,” (c) eight demos minimum. Answer: (b).
  4. Short Answer: Why separate FINAL from the scratchpad? Answer: Easier parsing / hide reasoning from end users / cleaner APIs.
  5. True/False: Few-shot CoT demos include worked reasoning, not just answers. Answer: True.
  6. Multiple Choice: CoT is most associated with gains on: (a) multi-step math/logic, (b) JPEG compression, (c) CSS floats. Answer: (a).
  7. Short Answer: Name one risk of showing CoT to end users. Answer: Exposing private reasoning, errors, or sensitive intermediate content.
  8. True/False: Fluent reasoning guarantees correctness. Answer: False.
  9. Multiple Choice: Next technique that samples many CoT paths: (a) self-consistency, (b) LoRA, (c) pooling. Answer: (a).
  10. Short Answer: When might answer-only be better than CoT? Answer: Easy one-step tasks where extra tokens do not help.

Key Takeaways

  • CoT elicits step-by-step reasoning before the final answer.
  • Use zero-shot cues or few-shot worked examples depending on control needs.
  • Parse a dedicated final field; do not trust fluent chains as proofs.
  • Next: Tree of Thoughts.
Trainer’s Guide

Hands-on idea: Same word problem with answer-only vs CoT; have students mark where wrong chains diverge from truth.

Discussion prompt: Should customer-facing apps stream CoT tokens, summarize them, or hide them entirely?

Recap: Chain-of-thought turns hard problems into sequenced intermediate steps. Continue with Tree of Thoughts.