MARGIN: Online Confidence Calibration for Coordinating Multi-Agent Foundation Models
MARGIN recalibrates each model's confidence from its own track record at runtime, avoiding retraining and lifting multi-LLM code selection accuracy.
Key Points
- Self-reported confidence is unreliable for choosing among multi-LLM outputs, especially on code tasks, where higher confidence often correlates with lower accuracy.
- MARGIN is a runtime confidence calibration method that learns each model’s reliability from its own historical track record, band by band.
- It requires no model retraining, no access to model internals, and no separate calibration set, making it suitable for deployed and mixed-provider systems.
- MARGIN substantially improves answer selection on code-generation benchmarks, raising correct picks to 81% in binary-choice settings on HumanEval and MBPP.
- It remains effective under workload shifts and suggests broader potential beyond code tasks, such as multi-step workflows, tool use, and safety-sensitive decisions.
Meta description: MARGIN fixes multi-LLM answer selection by learning confidence from each model's own track record, lifting correct picks to 81 percent on HumanEval and MBPP.
Tags: LLM ensembles, confidence calibration, MARGIN, code generation benchmarks, model routing
Featured image: An abstract technology scene showing layered decision bands, probability gradients, and code-like branching paths, with no people, logos, or text.
LLM confidence calibration is the practical question behind MARGIN, a runtime method that changes how systems choose among answers from multiple large language models. The problem matters because many code-generation pipelines already produce several candidate responses and need a reliable way to select the one most likely to pass tests. If the selector relies on each model's self-reported confidence, the result can be worse than a coin flip.
Before the Fix: Self-Reported Confidence Points the Wrong Way
Multi-model systems often use confidence scores as a shortcut for deciding which answer to keep. That shortcut looks reasonable: a model that sounds more certain may seem more trustworthy. The BigCodeBench evidence shows the opposite pattern for code tasks. Across 18 models, confidence runs backwards. Models with higher average confidence pass fewer tests. In the harder case where one of two answers is right and the other is wrong, the more confident model is correct only 42% of the time, which is worse than a coin toss.
This finding reframes the selection problem. The issue is not only whether a model is good at generating code. It is also whether its confidence score can be read as a probability of correctness. For an orchestrator that must choose among outputs, a misleading confidence score can turn a larger ensemble into a source of noise rather than a source of reliability.
At Runtime: MARGIN Recalibrates Each Model's Confidence
MARGIN addresses the problem at runtime. Instead of assuming that a high confidence score means high accuracy, it learns what each model's confidence means from that model's own track record, band by band. The design avoids three heavy requirements: no retraining, no model internals, and no calibration set. That makes the method relevant to deployed systems where models may be closed, versioned, or mixed across providers, and where teams cannot always access weights, logits, or labeled calibration data.
The band-by-band idea is central. A confidence score is not treated as a single global number that can be compared directly across models. It is mapped to observed outcomes from the same model, so a high score from one model can be understood through that model's own history rather than as a universal certainty level.
When the workload shifts, the method also needs to adapt. The source reports that MARGIN beats all five online calibration baselines on both coding transitions. That result points to a runtime calibration approach that remains useful when the workload changes between coding transitions.
After Calibration: Correct Picks Rise on HumanEval, MBPP and BigCodeBench
The improved selection behavior shows up in benchmark settings that are common in code-generation work. HumanEval and MBPP are programming benchmark suites used to evaluate models on generating correct code. In the case where one of two answers is right and the other is wrong, the coordinator using MARGIN picks the right answer 81% of the time, up from about half.
The gain is also visible on BigCodeBench, the benchmark where the 18-model confidence pattern was observed. The share of tasks where the selected answer is correct rises from 14% to 28%. The change is small in absolute terms, but it doubles the rate of correct selection on that benchmark without changing the underlying models.
The current stage of the work is a runtime confidence-correction method for multi-LLM answer selection, with evaluation on code-generation benchmarks and a public method page. The project's method, worked example and results are published at https://jossarmstrong.org/works/margin/. The next question for readers is how such calibration behaves when ensembles move beyond code tasks into longer workflows, tool use, and safety-sensitive decisions.
Comments
No comments yet. Be the first to comment.