Topic 3 of 5 · 4 min read
Parallel sectioning and voting
Goal: Decide whether a task benefits from sectioning or voting and specify how the parallel results are merged.
Parallelization runs several model calls at the same time, either on different parts of a task (sectioning) or on the same task several times (voting), and then merges the results with code. Sectioning buys speed and focus. Voting buys confidence.
Check yourself · 1 of 3
What is the difference between sectioning and voting?
Why it matters
Some tasks have independent parts. Reviewing a contract for payment terms, liability and termination can be three calls that never need each other's output, so running them one after another wastes time. Other tasks have one high-stakes answer where a single call is sometimes wrong. Asking several times and taking the majority is a known way to improve reliability on reasoning tasks (see the self-consistency paper in the references), and it is also how a guardrail avoids missing a rare unsafe input.
Sectioning
Split the work into pieces that do not depend on each other, run them together, then combine. Check independence first: if part B needs part A's answer, it is a chain, not a parallel job. A common use is to run the main answer in one call and a safety or policy check in another, so a slow check does not slow the answer and each prompt stays focused on one job.
Voting
Run the same prompt, or slightly different prompts, several times and decide by rule. Agree on the rule before you run it:
- Majority for a label such as
spamornot spam. - Any-flag for a safety check, where one call raising a concern is enough to block.
- Threshold such as "at least two of three reviewers flag a vulnerability".
Voting needs variation to help. Three calls at temperature zero with the same prompt often return the same answer, and the same mistake. Use sampling, different phrasings or different models.
Before and after
# Before: sequential, 3 x latency
terms = llm(PAY_PROMPT, contract)
risk = llm(LIABILITY_PROMPT, contract)
exit = llm(TERMINATION_PROMPT, contract)
# After: sectioned, latency of the slowest call
terms, risk, exit = await asyncio.gather(
llm(PAY_PROMPT, contract),
llm(LIABILITY_PROMPT, contract),
llm(TERMINATION_PROMPT, contract),
)
What goes wrong
- Sectioning dependent work. Parts that need each other's results produce answers that contradict one another.
- No merge rule. Three results arrive and nobody decided how to combine them.
- Voting on identical calls. Correlated errors vote together, so you pay three times for one opinion.
- Ignoring cost and rate limits. Parallel calls multiply token spend, and a burst can hit provider limits.
Examples
Sectioned code review
A pull request is reviewed by three parallel calls: one for security issues, one for test coverage, one for naming and style. Code merges the three comment lists, removes duplicates by file and line, and posts one review. The calls ran in the time of the slowest one.
Voting on a moderation label
A forum post is classified safe or unsafe by three calls with different prompt wordings. Rule: any unsafe sends the post to a human. The team chose any-flag over majority because a missed unsafe post costs more than an extra human look.
Key points
- Sectioning runs independent parts of a task at once; voting runs the same task several times to build confidence.
- Check that parts really are independent: if one needs another's output, it is a chain.
- Decide the merge rule before running: majority, any-flag or a threshold.
- Voting helps only when the calls can differ, through sampling, varied prompts or different models.
- Parallel calls multiply token cost and can hit rate limits, so use them where speed or reliability justifies it.
Common mistakes
- Running dependent subtasks in parallel and getting contradictory results.
- Starting parallel calls without deciding how results are merged.
- Voting with identical prompts and settings that tend to repeat the same answer.
- Ignoring the multiplied token cost and provider rate limits.
Check yourself · 2 of 3
A safety check should block a post if any of three reviewer calls flags it. Which merge rule is that?
Check yourself · 3 of 3
A team votes by running the same prompt three times at temperature zero. Why is the vote likely to add little?
Practice items, not counted towards your mastery.
Start here
- Building effective agents (Anthropic) (opens in a new tab)ArticleFree
Defines the five workflow patterns in this skill and when each earns its added cost.
- Workflows and agents (LangGraph docs) (opens in a new tab)DocsFree
Runnable code for chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer.
- How we built our multi-agent research system (Anthropic) (opens in a new tab)ArticleFree
A production orchestrator-workers system, with the failures and trade-offs the team met.
More for this topic
- Self-Consistency Improves Chain of Thought Reasoning (opens in a new tab)PaperFree
The paper behind majority voting over several sampled answers.