03 · Thought generation

Think step by step

03Thought generation

Group 03 · 12 techniques

Thought generation

Think step by step. Ask the AI to show its thinking. Example: 'Let's think step by step.'

Each slide shows one technique: the plain prompt, the same prompt with the technique applied, and what changed. Use the arrows, the keys ← →, or pick a technique on the left.

Chain-of-Thought (CoT) Prompting

Few-shot exemplars include a question, a reasoning path and the correct answer, so the model reasons before answering.

Before

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? A: The answer is 11.

After · new words marked

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.

What happened

PaLM 540B with 8 CoT exemplars: 58.1% on GSM8K, up from 17.9% standard prompting, beating prior SOTA (fine-tuned GPT-3 with verifier, 55%).

Zero-Shot Chain-of-Thought

Append a thought-inducing phrase, with no exemplars.

Before

Q: [math question] A: The answer is

After · new words marked

Q: [math question] A: Let's think step by step.

What happened

InstructGPT (text-davinci-002): MultiArith 17.7% to 78.7%, GSM8K 10.4% to 40.7%, with no hand-crafted examples. Note: on MMLU with gpt-3.5-turbo it dropped below plain Zero-Shot.

Step-Back Prompting

First ask a generic high-level question about the relevant concepts or facts, then reason.

Before

Solve this physics problem: [problem]

After · new words marked

First, what are the general principles behind this kind of problem? Then use them to solve it step by step.

What happened

Improved performance significantly on multiple reasoning benchmarks for PaLM-2L and GPT-4 (Zheng et al. 2023).

Analogical Prompting

The model auto-generates exemplars that include chains of thought, like SG-ICL for CoT.

Before

Solve this problem: [problem]

After · new words marked

Before solving, recall three relevant example problems with their step-by-step solutions, then solve this one.

What happened

Improvements in mathematical reasoning and code generation (Yasunaga et al. 2023).

Thread-of-Thought (ThoT)

Improved thought inducer for CoT, for large or complex contexts.

Before

Summarise this long document and answer the question.

After · new words marked

Walk me through this context in manageable parts step by step, summarizing and analyzing as we go.

What happened

Works well in QA / retrieval with large complex contexts (Zhou et al. 2023).

Tabular Chain-of-Thought (Tab-CoT)

Zero-shot CoT where the model outputs its reasoning as a Markdown table.

Before

Solve step by step: [problem]

After · new words marked

Solve step by step, showing each step as a row in a Markdown table with columns Step, Reasoning, Result.

What happened

Tabular structure improves reasoning structure (Jin & Lu 2023).

Contrastive CoT Prompting

CoT exemplars include BOTH incorrect and correct explanations, showing how not to reason.

Before

Here are correct worked examples: [examples]

After · new words marked

Here are worked examples, including one with a wrong explanation and why it is wrong, and one correct: [examples]

What happened

Significant improvement in Arithmetic Reasoning and Factual QA (Chia et al. 2023).

Plan-and-Solve Prompting

Improved Zero-Shot-CoT: plan first, then execute the plan step by step.

Before

Q: [problem] A: Let's think step by step.

After · new words marked

Let's first understand the problem and devise a plan to solve it. Then, let's carry out the plan and solve the problem step by step.

What happened

Beats Zero-Shot-CoT on all 10 datasets tested, comparable to 8-shot CoT on math (Wang et al. 2023).

Automatic Chain-of-Thought (Auto-CoT)

Use Zero-Shot-CoT to auto-generate chains of thought, then build a few-shot CoT prompt for the test sample.

Before

Solve with no examples.

After · new words marked

Generate reasoning chains for similar questions with 'Let's think step by step', then use the best ones as few-shot examples to solve this question.

What happened

Automates CoT exemplar creation (Zhang et al. 2022).

Complexity-based Prompting

Select complex examples for annotation, and majority-vote only among chains exceeding a length threshold.

Before

Use any CoT examples.

After · new words marked

Use only the longest, most complex reasoning examples, and vote only among the longest generated chains.

What happened

Improvements on three mathematical reasoning datasets (Fu et al. 2023).

Active Prompting

The LLM solves training questions; humans rewrite the exemplars with the highest uncertainty (disagreement).

Before

Annotate these random CoT examples.

After · new words marked

Annotate the examples where the model's sampled answers disagree most, then use those as exemplars.

What happened

Targets annotation effort where the model is most uncertain (Diao et al. 2023).

Memory-of-Thought Prompting

Run CoT on unlabelled training exemplars before test time; at test time retrieve similar instances to build few-shot CoT prompts.

Before

Answer with no examples.

After · new words marked

Retrieve the most similar previously reasoned-through examples and use them as few-shot CoT exemplars.

What happened

Substantial improvements in Arithmetic, commonsense, and factual reasoning (Li & Qiu 2023).