Prompt Engineering Tutorial 0/120 lessons ~6 min read Lesson 32

    Self-Consistency Prompting

    Self-consistency runs the same CoT prompt N times with high temperature, then takes the majority answer.

    Course progress0%
    Focus
    6 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    Self-consistency runs the same CoT prompt N times with high temperature, then takes the majority answer. It's a simple ensemble that often beats single-shot reasoning.

    Beginner analogy: Ask 5 students the same hard question; pick the answer most agree on. Crowd-sources the right answer from one model.

    Understanding the topic

    Core concepts to understand:

    • Run prompt N times (typically N = 5–10) with temperature ≥ 0.7.
    • Aggregate by majority vote on the final answer.
    • Works best when answers are discrete (numbers, classifications).
    • Costs N× as much; only use for high-value queries.

    Syntax reference

    Visual workflow / architecture:

    bash
    Same prompt × N
    Run 1: answer = 42
    Run 2: answer = 42
    Run 3: answer = 7
    Run 4: answer = 42
    Run 5: answer = 42
    Majority → 42

    Real-world use

    Used in math benchmarks, financial calculations, and any high-stakes single-number answer where the cost of being wrong >> the cost of running 5 prompts.

    Best practices

    • Pair with CoT (it's CoT × N).
    • Use only on tasks with discrete answers.
    • Cache the aggregated answer to avoid re-running.

    Hands-on exercise

    Interview preparation — practice these questions:

    • Q1. What is self-consistency?
    • Q2. Why use temperature > 0 here?
    • Q3. When NOT to use self-consistency?
    • Q4. How does it differ from beam search?
    Ready to mark this lesson complete?Track your journey across the entire course.