Self-Consistency Improves Chain of Thought Reasoning in Language Models

Wang et al., 2023, Self-Consistency Improves Chain of Thought Reasoning in Language Models (The Eleventh International Conference on Learning Representations (ICLR 2023))

Subscriber deck — free during early access

19 cards

1 Introduction

  1. What does self-consistency replace in chain-of-thought prompting?
    The greedy decoding of a single reasoning path. Self-consistency samples many diverse reasoning paths from the decoder and returns the answer most of them agree on.
  2. What intuition motivates self-consistency?
    A complex reasoning problem usually admits several different ways of thinking that lead to the same correct answer, while wrong reasoning paths tend to scatter over different wrong answers; if several independent lines of thought agree, the answer deserves more confidence.
  3. Which problems of single-sample decoding does self-consistency avoid?
    The repetitiveness and local optimality of greedy decoding, and the randomness of relying on one sampled generation.
  4. How does self-consistency differ from verifiers, re-rankers and ensembles?
    It needs no extra training, verifier, re-ranker, human annotation or fine-tuning, and it works off the shelf with one pretrained model, acting as a “self-ensemble” rather than aggregating several trained models.

2 Self-Consistency over Diverse Reasoning Paths

  1. State the three steps of self-consistency.
    (1) Prompt the model with manually written chain-of-thought exemplars; (2) sample a diverse set of reasoning paths from the decoder (e.g. temperature, top-\(k\) or nucleus sampling); (3) marginalize out the reasoning paths by choosing the most frequent final answer.
    CoT promptpath 1path 2path 3path 41291212majority vote: 12
    Sample several reasoning paths, then vote on their final answers (invented example)
  2. Formally, how is the final answer chosen?
    Each sample is a pair \((r_i, a_i)\): a reasoning path \(r_i\), treated as a latent variable, and a parsed answer \(a_i\) from a fixed answer set. The output is the majority vote \(\arg\max_a \sum_{i=1}^{m} \mathbb{1}(a_i = a)\).
  3. How does majority voting compare with probability-weighted aggregation?
    Weighting each \((r_i, a_i)\) by its length-normalized probability gives nearly the same accuracy as an unweighted majority vote (unnormalized weighting is much worse), because the model assigns the sampled paths similar normalized probabilities: it is poorly calibrated at telling right from wrong solutions.
  4. What is the main restriction on where self-consistency applies?
    The final answer must come from a fixed answer set so that answers can be compared and counted. In principle it extends to open-ended generation if a good consistency metric between generations is defined, e.g. whether two answers agree or contradict each other.
  5. Why use sampling for reasoning tasks that have a single correct answer?
    Sampling is normally used for open-ended generation, and fixed-answer tasks have usually been decoded greedily; Wang et al. found that even when the answer is fixed, diversity in the reasoning paths is highly beneficial.

3.1 Experiment Setup

  1. How were self-consistency’s experiments set up?
    Arithmetic, commonsense and symbolic reasoning benchmarks; four models (UL2-20B, GPT-3 175B via Codex engines, LaMDA-137B, PaLM-540B); few-shot prompting with the same chain-of-thought exemplars as Wei et al. (2022) and no training; 40 sampled paths per question, averaged over 10 runs.

3.2 Main Results

  1. What gains did self-consistency give over chain-of-thought prompting with greedy decoding?
    Large gains on all four models, e.g. GSM8K +17.9, SVAMP +11.0, AQuA +12.2, StrategyQA +6.4 and ARC-challenge +3.9 points (absolute), reaching new state of the art on most tasks without task-specific training.
  2. How did self-consistency’s gains depend on model scale?
    They grew with scale: about +3–6 points for UL2-20B but +9–23 for LaMDA-137B and GPT-3; for small models gains are lower because abilities such as arithmetic only emerge at sufficient scale.
  3. How does accuracy change with the number of sampled paths?
    It rises consistently from 1 to 40 paths, but most of the gain comes early: in practice 5 or 10 paths capture most of the benefit at modest cost.

3.3 Self-Consistency Helps When Chain-of-Thought Hurts Performance

  1. What did self-consistency do on tasks where chain-of-thought prompting hurts?
    On NLI and closed-book QA tasks (e.g. ANLI-R1, e-SNLI, RTE), adding rationales via chain-of-thought sometimes did worse than standard prompting, but self-consistency recovered and surpassed standard prompting, making rationales safe to add.

3.4 Compare to Other Existing Approaches

  1. Why does self-consistency beat sample-and-rank and beam search?
    Sample-and-rank keeps only the single most probable sequence, which helps far less than voting. Beam search produces less diverse outputs; even self-consistency over beam-search paths does worse than over sampled paths, since diversity of reasoning is the key.
  2. How does self-consistency compare with prompt ensembles?
    Majority votes over greedy outputs from 40 prompt-order permutations or from 3 hand-written prompt sets gave much smaller gains than 40 sampled paths from one prompt; the methods are compatible and can be combined.

3.5 Additional Studies

  1. Why can self-consistency serve as an uncertainty estimate?
    The share of sampled paths agreeing with the final answer is highly correlated with accuracy, so low consistency signals low confidence: the model gains some ability to “know when it doesn’t know”.
  2. How robust is self-consistency to prompts and reasoning formats?
    It helps with imperfect prompts (exemplars with wrong intermediate numbers), with equation-only reasoning (less gain, since short equations leave less room for diversity), and with zero-shot chain-of-thought (+26.2 points on GSM8K with PaLM-540B), and across sampling settings and model sizes.

5 Conclusion and Discussion

  1. What are self-consistency’s main limitations?
    It multiplies inference cost by the number of sampled paths, and models still sometimes produce incorrect or nonsensical reasoning paths even when the voted answer is right, so rationales need better grounding.

Source

  • Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery and Denny Zhou. 2023. Self-Consistency Improves Chain of Thought Reasoning in Language Models. In The Eleventh International Conference on Learning Representations (ICLR 2023). https://arxiv.org/abs/2203.11171