All articles
December 21, 2024 4 min read

Parallelization: run LLM calls side by side, then combine

Fan a task out into independent LLM calls that run at once — either sectioning a job into parts, or voting for reliability — then aggregate the results.

Written forEngineering
AI WorkflowsDesign PatternsParallelization

Some work doesn't need to happen in sequence — it needs to happen at the same time. Parallelization fans a task out into independent LLM calls that run concurrently, then aggregates their outputs. It comes in two flavours, and both are useful for different reasons.

InLLM Call 1LLM Call 2LLM Call 3Aggregate / voteOut
Independent calls run concurrently; an aggregator merges (sectioning) or tallies (voting) the results.

Two flavours

  • Sectioning — split a task into independent subtasks (summarise each chapter, review each file) and run them at once, then stitch the results together.
  • Voting — run the same prompt several times and aggregate by majority or threshold, trading tokens for reliability on high-stakes calls.

Sectioning wins on latency: three subtasks that would take 6s in sequence finish in ~2s in parallel. Voting wins on confidence: asking the model the same thing five times and taking the consensus catches the occasional bad roll.

Fan out, then aggregate
const parts = await Promise.all([
  llm(prompt, sectionA),
  llm(prompt, sectionB),
  llm(prompt, sectionC),
]);

return aggregate(parts);   // merge, or take the majority vote

When to use it

Use sectioning when subtasks are genuinely independent and latency matters. Use voting when a single call is too unreliable for the stakes — content moderation, code review, anything where a false negative is expensive. The cost is more tokens; the payoff is speed or confidence.

If the subtasks don't depend on each other, waiting for them one at a time is just latency you chose to keep.
Building something with LLMs?
I help teams ship GenAI that’s reliable and cost-efficient.
Let’s talk