RAG & Agents Engineering

M04 lab, prompt engineering patterns

A vote fixes scattered errors, and locks in shared ones.

Self-consistency samples N reasoning paths and keeps the most common final answer. This lab computes the exact chance that the vote is right, for any N, any accuracy of one path, and any number of distinct wrong answers.

Distinct wrong answers a path can give

One path
Vote of N paths
Change, points
Calls, LLM aggregator

Vote accuracy by number of paths

Exact, ties split at random

What each extra path buys

NVote accuracyChange from one pathCalls, code voteCalls, LLM aggregator

Each path is an independent draw here. Paths sampled from one model share its blind spots, so a real vote gains less than this curve. Notebook 02a samples three paths and asks a fourth call to aggregate them.