LLM Ensembling
AI Engineer path · lesson 107 of 124Combine multiple model calls into one better answer — self-consistency voting, Mixture-of-Agents, best-of-N reranking, weighted/stacked ensembling, and multi-agent debate — and see the cost/quality tradeoff each one makes.
Key insight
A single sample gets this wrong more often than you'd expect — "$0.10" is the answer most people (and models) blurt out first. Sample enough times and the majority vote converges on "$0.05", because the model is right more often than it's wrong, even though any individual sample can't be trusted alone. Watch how few samples it actually takes for the majority to stabilize — accuracy gains here are famously front-loaded, with diminishing returns after 5-10 samples.
Which ensembling strategy?
Sort each method by whether it needs one model or several.
Tap a piece, then tap where it goes — or drag it. Tap the tray to take one back.
One model, sampled repeatedly
Drop items hereSeveral different models
Drop items hereTest your knowledge
What does self-consistency ensembling do?
The short version
Ensembling is asking a committee instead of one person. One expert can be confidently wrong; several experts — sampled repeatedly, drawn from different backgrounds, or arguing it out — converge on the right answer far more often, at the cost of asking more than once.
In more depth
LLM Ensembling
A single model call is one opinion. Ensembling spends more compute on the same request — instead of picking one model to save cost (routing), it combines multiple outputs to raise quality and robustness.
Self-consistency (majority vote)
Sample the same model N times at temperature > 0 and take the majority answer. Works when there's a single checkable answer (math, logic, classification). Cost scales Nx; accuracy gains are front-loaded and plateau — most of the lift shows up in the first 5-10 samples.
Mixture-of-Agents (MoA)
Multiple "proposer" models each draft an independent answer; an "aggregator" model reads all drafts and synthesizes one final, improved answer. Best for open-ended generation where there's no clean vote. Risk: the aggregator can inherit a blind spot shared by every proposer, and it's one more model call (often a larger, pricier one) on the critical path.
Best-of-N + reranking
Generate N candidates from one policy; a reward/verifier model scores each and the top-scoring one is kept. Cost scales linearly with N; quality gains are sub-linear with clear diminishing returns. The reward model itself is a risk — a miscalibrated one can confidently pick a worse candidate.
Weighted / stacked ensembling
Combine multiple models' output scores as a weighted average rather than a simple vote. Fixed weights can be hand-set (e.g. trust a stronger model more); a learned stacking layer fits the weights from held-out data instead. Down-weighting a confident-but-wrong outlier model prevents it from dominating the combined decision.
Multi-agent debate
Several agents answer independently, then see each other's reasoning across multiple rounds and may revise their own answer, converging (or not) on a consensus. Distinct from agent orchestration (a supervisor delegating subtasks to workers) — debate has no delegation, just iterative critique of answers to the same question. Critically, round 1's majority can be confidently wrong; the value is in the rounds after, where peer critique corrects it. Production systems need a round budget and a fallback (majority-after-N-rounds, or escalate to a human) for cases that never converge.
Interview Questions
References & Further Reading
Love this visualization?
Sign up to track your progress, earn achievements, use the AI assistant, and access your personal learning dashboard.
100% free • No credit card required