Chapter 6: Voter: Leveraging stochasticity for improved outputs
This introduction shows how the Voter pattern turns variable model outputs into a more robust answer and a signal of uncertainty.
After this chapter you will be able to
- Stochastic output as a resource. Explain why repeated runs of a language model can produce different answers to the same question, and why that variability is both a risk in agentic workflows and a source of useful evidence.
- Ensemble voting for robust answers. Describe how Voter runs the same process several times and reconciles the results, using the math example in which 10 appears in five of eight trials and wins by majority vote.
- Vote distributions and confidence. Describe how agreement across runs can signal uncertainty through the most frequent answer's share or the spread of votes, and why similarity of reasoning matters even when final answers agree.
- Repeated sampling and majority choice. Explain why variable outputs are a problem when a task calls for one answer, and how the Voter pattern invokes the same worker IE several times and selects the most frequent answer.
- Outcome distribution and confidence signals. Describe how Voter can compile repeated IE outputs into a distribution of possible outcomes, using their probabilities or the distribution's entropy as signals for later processing rather than choosing only one answer.
- Voter components and vote flow. Trace how a Voter sends an input through a dispatch element to multiple parallel invocations of a worker IE, extracts an identifiable answer from each voting trajectory, and passes those votes to reconciliation.
- Diverse independent voting trajectories. Explain how the dispatch element encourages distinct voting trajectories through different seeds or perturbed inputs, and why independently runnable invocations can be dispatched in parallel.
- Reconciliation and correctness assumption. Describe reconciliation as an unintelligent, often deterministic procedure that normalizes votes and can return a distribution, a majority winner, or favorable outcomes. Explain that, for single-correct-answer tasks, repeated voting assumes the worker can reach the correct answer and can dampen noisy departures from correct trajectories.
- Voter benefit and cost tradeoff. Explain that adding a Voter aims to improve an agent’s capability and robustness, while multiplying the cost of the wrapped IE compared with a single invocation and reducing overall efficiency.
- Voter execution sequence. Trace how the generic Voter class optionally perturbs the input, runs the worker IE n times in parallel, stores every trajectory’s result, waits for completion, and then executes reconciliation.
- Single-answer robustness. Explain how Voter selects the most strongly represented outcome from multiple executions when a task has one expected answer, making repeated runs less likely to disagree and potentially improving the chance of finding a true answer.
- Multiple-outcome exploration. Describe how an ensemble of executions helps map the possible results of a task with more than one outcome, supporting ideation or communication of uncertainty.
- Outcome-based confidence estimates. Explain how Voter’s reconciliation step can estimate confidence or likelihood when an inference engine produces several results, and describe ways to report the outcome distribution.
- Independent Voter trials. Distinguish Voter trials from Resampler attempts: Voter trials do not depend on one another's failures, so they can run in parallel, though multiple trials increase cost.
- Committee composition and variation. Describe a committee as a Voter configuration that uses different inference elements (IEs) for individual voting trajectories. Explain that the trajectories can use the same prompt or agent with different underlying models, or differently designed IEs.
- Shared committee objective. Explain that the IEs in a committee must share the same objective so the subsequent Voter element can reconcile their results into a final output as intended.
- Divergent Committee purpose and design. Explain that a Divergent Committee is a Voter variant used to map possible outcomes: its inference engines differ in both implementation and objective and are deliberately designed to produce distinct outputs for the same task.
- Parallel reasoning and majority vote. Trace how the TTCS math reasoner runs parallel instances of the same solver on an identical problem, extracts their final answers, and selects the most frequent answer by simple-majority vote.
- Accuracy and inference cost. Explain why varied reasoning paths can improve the final answer: a single bad logical step can spoil one attempt, while majority voting can filter out stochastic errors. State that the accuracy gain requires more inference compute.
- Diverse judge committee scoring. Explain why a committee of distinct judge IEs can assess open-ended text more reliably than a single judge, and describe how its scores become a final quality estimate.
- Aggregative specialist committee. Describe how the Voter uses distinct safety specialists to assess risks and reconciles their outputs by taking the union of unique risks, retaining each assessment’s confidence or severity rather than choosing one winning answer. Explain why this keeps a threat found by only one specialist in the final report.
What it builds on
- How the Resampler pattern works (chapter 5) · How Resampler uses repeated attempts.
Section by section
Introduction
This introduction shows how the Voter pattern turns variable model outputs into a more robust answer and a signal of uncertainty.
- Stochastic output as a resource: Explain why repeated runs of a language model can produce different answers to the same question, and why that variability is both a risk in agentic workflows and a source of useful evidence.
Why it matters: Voter makes use of variability that an agent would otherwise treat only as a reliability problem. - Ensemble voting for robust answers: Describe how Voter runs the same process several times and reconciles the results, using the math example in which 10 appears in five of eight trials and wins by majority vote.
Why it matters: The vote can filter out some errors from individual reasoning runs, at the cost of more inference compute. - Vote distributions and confidence: Describe how agreement across runs can signal uncertainty through the most frequent answer's share or the spread of votes, and why similarity of reasoning matters even when final answers agree.
Why it matters: A selected answer is more useful when the agent also has a signal for whether it may need error handling.
Key terms: stochasticity, generation temperature, probabilistic engines, distribution, Voter pattern, ensemble, voting trajectories, majority vote, mode, probability weight
6.1 To quickly summarize the above: By running an ensemble of probabilistic model instances on the same problem, one can arrive at a distribution of outcomes or results. This distribution can then be leveraged to explore the set of possible answers, find the most favored answer, or to estimate the confidence one should place in any given answer. This approach is captured by the Voter pattern. The pain point: Stochastic inference producing variable outputs
The section introduces the Voter pattern as a way to turn variable inference outputs into either a favored answer or a distribution of possible outcomes.
- Repeated sampling and majority choice: Explain why variable outputs are a problem when a task calls for one answer, and how the Voter pattern invokes the same worker IE several times and selects the most frequent answer.
Why it matters: Repeated sampling can make a single-answer component more reliable than one invocation alone. - Outcome distribution and confidence signals: Describe how Voter can compile repeated IE outputs into a distribution of possible outcomes, using their probabilities or the distribution's entropy as signals for later processing rather than choosing only one answer.
Why it matters: The spread of answers can be useful information, not just noise to eliminate.
Key terms: IE, worker IE, Voter pattern, stochasticity, popularity vote, execution IE, probability distribution, distribution entropy, confidence
6.2 How the Voter pattern works
This section explains how a Voter dispatches diverse, independent runs of a worker, treats their answers as votes, and reconciles those votes into a result.
- Voter components and vote flow: Trace how a Voter sends an input through a dispatch element to multiple parallel invocations of a worker IE, extracts an identifiable answer from each voting trajectory, and passes those votes to reconciliation.
Why it matters: This flow is the basis for understanding how a Voter turns repeated model or agent runs into one result. - Diverse independent voting trajectories: Explain how the dispatch element encourages distinct voting trajectories through different seeds or perturbed inputs, and why independently runnable invocations can be dispatched in parallel.
Why it matters: Diverse, independent attempts give voting more than repeated copies of the same answer. - Reconciliation and correctness assumption: Describe reconciliation as an unintelligent, often deterministic procedure that normalizes votes and can return a distribution, a majority winner, or favorable outcomes. Explain that, for single-correct-answer tasks, repeated voting assumes the worker can reach the correct answer and can dampen noisy departures from correct trajectories.
Why it matters: Voting helps only when aggregation can make useful sense of the worker's answers; repetition does not create an ability the worker lacks.
Key terms: Voter, dispatch element, worker IE, voting trajectory, vote, reconciliation procedure, explicit solicitation of diversity, independence of IE invocations, natural stochasticity, seeded differently
6.2.1 Tradeoffs
Adding a Voter can improve an agent’s capability and robustness, but increases the cost of the IE it wraps and reduces efficiency.
- Voter benefit and cost tradeoff: Explain that adding a Voter aims to improve an agent’s capability and robustness, while multiplying the cost of the wrapped IE compared with a single invocation and reducing overall efficiency.
Why it matters: This tradeoff helps you decide whether the expected improvement is worth the added cost.
Key terms: Voter, IE, capability, robustness, efficiency
6.2.2 Implementation sketch
This subsection sketches a Voter implementation that runs multiple worker trajectories, collects their results, and reconciles them, with an optional early-stop optimization.
- Voter execution sequence: Trace how the generic Voter class optionally perturbs the input, runs the worker IE n times in parallel, stores every trajectory’s result, waits for completion, and then executes reconciliation.
Why it matters: The order of these steps determines which results are available when the Voter makes its decision. - Early voting termination: Explain when the basic implementation could stop unfinished voting trajectories: reconciliation can already be concluded, such as when a majority has been reached and remaining votes cannot change it.
Why it matters: Stopping votes that cannot affect the outcome can avoid unnecessary work.
Key terms: Voter class, input perturbation, worker IE, voting trajectories, reconciliation element, reconciliation mechanism, abort voting trajectories, majority
6.2.3 When and where to use the Voter pattern
This section identifies three situations for using the Voter pattern: stabilizing a single answer, exploring multiple possible outcomes, and estimating confidence from an ensemble of results.
- Single-answer robustness: Explain how Voter selects the most strongly represented outcome from multiple executions when a task has one expected answer, making repeated runs less likely to disagree and potentially improving the chance of finding a true answer.
Why it matters: This is when voting helps make an agent’s answer more stable. - Multiple-outcome exploration: Describe how an ensemble of executions helps map the possible results of a task with more than one outcome, supporting ideation or communication of uncertainty.
Why it matters: Not every task has one correct answer; sometimes the range of answers is the useful result. - Outcome-based confidence estimates: Explain how Voter’s reconciliation step can estimate confidence or likelihood when an inference engine produces several results, and describe ways to report the outcome distribution.
Why it matters: The distribution of results can convey uncertainty, not just supply a final choice.
Key terms: answer robustness, ensemble of executions, outcome set, exploring outcomes, outcome space, agentic ideation, IE, reconciliation mechanism, probability distribution, most likely choice
6.2.4 How Voter works with other patterns
This section distinguishes Voter from Resampler, coordinated agent teams, and DPR by how their executions relate to one another and how their outputs are combined.
- Independent Voter trials: Distinguish Voter trials from Resampler attempts: Voter trials do not depend on one another's failures, so they can run in parallel, though multiple trials increase cost.
Why it matters: This distinction explains both a performance advantage and a cost of Voter. - Shared versus distinct agent intelligence: Explain that Voter invokes the same operational intelligence with a different random seed or perturbed input, whereas Orchestrator and Agent Swarm use subordinate agents with fundamentally different operational intelligences that usually work together on the task.
Why it matters: Several agents or runs do not necessarily constitute the same design pattern. - DPR decomposition and recomposition: Distinguish DPR from Voter: DPR's Decomposer dispatches major input perturbations rather than minor ones, and its Recomposer intelligently reconciles partial intermediaries into one outcome.
Why it matters: DPR does more than collect varied runs: it divides the input substantially and reconciles the resulting parts.
Key terms: Voter, Resampler, independent, parallel execution, operational intelligence, IE, random seed, perturbed input, Orchestrator, Agent Swarm
6.3.1 Committee
This subsection explains how a Voter committee uses different inference elements across voting trajectories while keeping a shared objective for reconciliation.
- Committee composition and variation: Describe a committee as a Voter configuration that uses different inference elements (IEs) for individual voting trajectories. Explain that the trajectories can use the same prompt or agent with different underlying models, or differently designed IEs.
Why it matters: This explains what makes a set of voting trajectories a committee. - Shared committee objective: Explain that the IEs in a committee must share the same objective so the subsequent Voter element can reconcile their results into a final output as intended.
Why it matters: A common objective makes the committee’s outputs suitable for reconciliation. - On the fly committee creation: State that a committee's IEs can also be generated during the agent's execution, rather than all being set up beforehand.
Why it matters: Committee membership can be created dynamically during a run.
Key terms: Voter, IEs, committee, voting trajectory, underlying model, same objective, reconciliation, final output, on the fly, agents execution
6.3.2 Divergent Committee (“Loose Ensemble”)
This subsection explains how a Divergent Committee uses deliberately different inference engines to explore the range of possible outcomes for the same task.
- Divergent Committee purpose and design: Explain that a Divergent Committee is a Voter variant used to map possible outcomes: its inference engines differ in both implementation and objective and are deliberately designed to produce distinct outputs for the same task.
Why it matters: The point of this committee is to explore different possibilities, not merely to repeat the same approach.
Key terms: Voter, Divergent Committee, Loose Ensemble, IE's
6.4.1 Simple test-time compute scaling (TTCS) of mathematical reasoning
This subsection shows how a Voter can improve mathematical reasoning by running multiple solver instances and selecting the most common final answer.
- Parallel reasoning and majority vote: Trace how the TTCS math reasoner runs parallel instances of the same solver on an identical problem, extracts their final answers, and selects the most frequent answer by simple-majority vote.
Why it matters: The vote turns multiple reasoning attempts into one answer. - Accuracy and inference cost: Explain why varied reasoning paths can improve the final answer: a single bad logical step can spoil one attempt, while majority voting can filter out stochastic errors. State that the accuracy gain requires more inference compute.
Why it matters: This explains both the benefit of extra reasoning attempts and their cost.
Key terms: test-time compute scaling, solver IE, Voter instance, reasoning chains, simple-majority voting reconciliation, stochasticity, mathematical reasoning errors, inference compute
6.4.2 Committee of judges
This section applies the Voter pattern to subjective text evaluation by using diverse judges and averaging their scores.
- Diverse judge committee scoring: Explain why a committee of distinct judge IEs can assess open-ended text more reliably than a single judge, and describe how its scores become a final quality estimate.
Why it matters: A committee can reduce the effect of one judge’s biases or variable scoring.
Key terms: Voter pattern, committee of judges, worker IEs, reconciliation, low-variance quality estimate
6.4.3 Automatic travel safety assessment
This section applies an aggregative Voter committee to travel safety assessment, combining specialist risk assessments into a comprehensive report rather than a single safe-or-unsafe verdict.
- Multifaceted safety assessment: Explain why a single model’s binary safe-or-unsafe answer is insufficient for a location-specific travel safety question, and describe the desired output as a breakdown of potential risks and their severity.
Why it matters: A useful safety answer needs to show which risks matter, not just give an uncalibrated verdict. - Aggregative specialist committee: Describe how the Voter uses distinct safety specialists to assess risks and reconciles their outputs by taking the union of unique risks, retaining each assessment’s confidence or severity rather than choosing one winning answer. Explain why this keeps a threat found by only one specialist in the final report.
Why it matters: Combining specialist findings prevents a risk from disappearing merely because other specialists were not equipped to spot it.
Key terms: calibration, multi-element analysis, severity, Committee, aggregative reconciliation, union operation, distinct specialists, confidence
6.5 Summary
The section recaps how the Voter pattern turns stochastic variation into more robust outputs and interpretable distributions, while trading additional inference compute for those benefits.
Where this is used later
- Decompose-Voter (chapter 8) · The Decompose-Voter variant combines ideas from the two patterns.
Concepts explained in this chapter
- VoterVoter is an agent design pattern that aggregates outputs from multiple invocations to provide a robust result or confidence information.
- randomnessThe property of involving chance or probabilistic variation rather than fully deterministic behavior.
- samplingSampling is the process of generating or selecting an output from a stochastic model or operation.
- intelligent elementAn agent component that uses AI to assess information or perform a focused function.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
