liveBook · Manning

Chain-of-thought prompting

As explained in Build a DeepSeek Model (From Scratch)

Chain-of-thought is a sequence of intermediate natural-language reasoning steps produced between a problem statement and its final answer.

Chain-of-thought (CoT) is a sequence of intermediate natural-language reasoning steps between a problem statement and its final answer. In reasoning-model distillation, these traces carry the teacher’s problem-solving strategy: decomposition, applied techniques, and verification. The student learns to reproduce that behavior through supervised fine-tuning on generated text rather than matching token probabilities. section 8.5.1 section 8.9

CoT functions as a practical transfer mechanism:

  • Expose intermediate decisions instead of transferring only final answers or per-token logits. section 8.5.1
  • Train a smaller student with the teacher’s complete reasoning traces using the standard next-token prediction objective. section 8.5.1
  • Use curated, verified-correct traces so imitation avoids the exploration burden that makes direct reinforcement learning difficult for small models. section 8.7.3 section 8.9

Summing the first 100 primes

A reasoning model may identify the primes, recall that the 100th prime is 541, select a summation strategy, calculate the result, and verify that the answer is 24,133. The useful training artifact is this coherent trace, not the probability assigned to each next token. section 8.5.1

Figure 8.27 Performance (AIME 2024) scales smoothly with model size for distilled models. Qwen-Math bases consistently outperform Llama bases at similar sizes, showing that the base model’s pre-existing capabilities interact with distillation quality.

Compare how distilled-model performance scales with model size and how the base model influences the quality of transferred reasoning. section 8.7.3

How Build a DeepSeek Model (From Scratch) covers it

How deep it goes
Explains trace content, supervised training, rejection sampling, and capacity limits, but does not provide implementation code.
Examples
Uses a prime-sum reasoning trace and an 800K-example dataset spanning mathematics, code, STEM, logic, and general tasks.
What it assumes
Assumes language-model training and knowledge-distillation concepts while contrasting trace supervision with logits, temperature scaling, and KL divergence.
What you can do after
Apply supervised fine-tuning to transfer verified teacher reasoning traces into a smaller student model.
How it connects
Connects chain-of-thought to knowledge distillation, supervised fine-tuning, next-token prediction, and reinforcement learning.

Also explained in

Compare how 29 books explain chain-of-thought prompting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a DeepSeek Model (From Scratch). The section links point to the parts of the book it draws on.