liveBook · Manning

Self-consistency

As explained in AI Agents in Action

Self-consistency is a reasoning technique that samples multiple candidate reasoning paths and selects an answer supported by their agreement.

Self-consistency generates several candidate reasoning paths or solutions for one problem, evaluates their agreement, and accepts the most frequent or most similar answer. It improves evaluation without requiring a low temperature; varied outputs can reveal which solution is most reliable. section 10.3.1

A practical self-consistency workflow:

  • Prompt the model several times for the same problem, using reasoning examples when needed. section 10.3.1
  • Collect the resulting plans or answers through repeated or batch processing. section 10.3.1
  • Compare the outputs and select the answer with the strongest consistency or similarity. section 10.3.1

Time-travel reasoning with Prompt flow

A Prompt flow DAG processes a complex time-travel statement three times, using a few-shot Chain-of-Thought template. Batch execution collects the outputs, then an evaluation tool computes a mean embedding, ranks each answer by cosine similarity, and returns the most similar result. section 10.3.1

Figure 10.7 The self-consistency prompt generation beside the evaluation flow
figure

Shows the generation flow beside the evaluation flow, making the separation between producing candidates and selecting an answer easy to inspect. section 10.3.1

How AI Agents in Action covers it

How deep it goes
Explains generation, batching, aggregation, and similarity ranking, while stopping short of broader reliability guarantees.
Examples
Demonstrates time-travel problems, few-shot prompts, Prompt flow DAGs, JSONL batch runs, embeddings, and cosine similarity.
What it assumes
Uses prompt engineering and Chain-of-Thought examples as the starting point for generating candidate solutions.
What you can do after
Operate/configure Prompt flow to batch-generate candidate answers and select one using an evaluation tool.
How it connects
Connects self-consistency with Chain-of-Thought prompting, tree-of-thought prompting, prompt chaining, and evaluation.

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 AI Agents in Action. The section links point to the parts of the book it draws on.