liveBook · Manning

Self-consistency

As explained in Introduction to Generative AI, Second Edition

Self-consistency is an evaluation technique that compares multiple independently generated answers to the same input to estimate answer reliability.

If a chatbot gives different answers each time you ask a factual question, how much should you trust any one of them? Self-consistency compares multiple answers to the same input. Agreement can suggest a more stable answer; disagreement can reveal that the model may be guessing. Neither establishes that an answer is true. section 5.7

To check for possible hallucinations, ask the same question through separate, direct calls to the model and compare the replies. Repeating it within one chatbot conversation is different: the chatbot may use its earlier replies as context and double down on a mistake. section 5.7

In self-consistency prompting, the model generates multiple reasoning chains and selects the most common answer. This extends chain-of-thought prompting, which follows one step-by-step path. Comparing reasoning paths may help with a problem, but selecting a frequent answer is not the same as independently checking the facts. section 7.4 section 5.7

A simple prompt

“Generate five solutions, then select the most common answer.” This asks for several routes to an answer rather than relying on the first one produced. section 7.4

Table 7.3 Common advanced prompting techniques

Technique

Description

Example prompt

Chain-of-thought

Generate step-by-step reasoning before answering

“Let’s think step by step. John has 3 apples . . .”

Tree-of-thought

Explore multiple reasoning paths in parallel

“List three strategies, evaluate each, then choose the best.”

Self-consistency

Generate multiple reasoning chains and aggregate

“Generate five solutions, then select the most common answer.”

Reflexion

Critique and revise output iteratively

“Review your answer for errors and revise if needed.”

Verification

Add a final self-check before finalizing the response

“Double-check your answer for accuracy before submitting.”

Decomposition

Break the problem into subtasks executed sequentially

“Step 1: Extract metrics. Step 2: Summarize trends. Step 3: Write summary.”

Least-to-most

Solve easier subproblems first, then build up

“First, list known variables. Then calculate step by step.”

Pyramid priming

Build knowledge gradually in layers

“Step 1: Define carbon neutrality. Step 2: List targets. Step 3: Analyze impact.”

Generated knowledge

Surface key facts before answering

“List key concepts related to quantum entanglement before answering.”

Role-based prompting

Assign a role or persona to guide behavior

“You are an experienced employment lawyer advising a client.”

Prompt chaining

Connect multiple prompts into a pipeline

“Extract relevant quotes → Summarize → Generate final answer.”

Conversational context

Summarize prior dialogue to preserve coherence

“Summarize the student’s understanding before proceeding.”

Compare self-consistency with other prompting approaches, including chain-of-thought, tree-of-thought, and verification. section 7.4

How Introduction to Generative AI, Second Edition covers it

How deep it goes
Explains the comparison intuitively and gives a sample prompt, without a formal reliability measure.
Examples
Illustrates the technique with repeated factual questions and a prompt to generate five solutions and select the most common answer.
What it assumes
Introduces the approach through ordinary questions and step-by-step reasoning, without requiring technical model knowledge.
What you can do after
Practice/perform it by comparing separate model replies or prompting for multiple reasoning chains, while treating agreement as a clue rather than verification.
How it connects
Connects self-consistency to hallucinations, chain-of-thought prompting, and tree-of-thought prompting.

Also explained in

Compare how 6 books explain self-consistency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Introduction to Generative AI, Second Edition. The section links point to the parts of the book it draws on.