Repository navigation
fix(deepconf): Vote and calibrate as in the DeepConf reference implementation - #348
Open
flyingdoubleG wants to merge 1 commit into
Open
flyingdoubleG wants to merge 1 commit into
flyingdoubleG wants to merge 1 commit into
Conversation
…entation - Score each answer by the sum of its traces' confidences, DeepConf's confidence-weighted majority vote. The 0.7 * mean confidence + 0.3 * frequency mix let one trace outvote many agreeing ones, since token confidences are several units while the frequency term is at most 1. - Leave early-terminated traces out of the vote, and let warmup traces vote only if they pass the threshold. - Treat a trace shorter than the window as one group of all its tokens, instead of reporting 0 for its lowest and bottom-10% group confidence. - Default confidence_metric to lowest_group, the trace confidence the online threshold is calibrated on.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deepconffollows DeepConf (Fu et al., 2025) for token and group confidences and for the low/high percentile thresholds. Its final vote and some of its trace statistics depart from the paper and from the reference implementation (facebookresearch/deepconf,utils.py/wrapper.py). This PR brings them in line.0.7 · mean(confidence) + 0.3 · count / total.−mean log P(top-k), are typically several units, while the frequency term is at most 1. The answer with the highest mean confidence therefore wins regardless of how many traces agree.V(a) = Σ_{t: answer_t = a} C_t, and the referenceweighted_majority_votesums the weights.stop_reason == 'gconf_threshold'). It also lets warmup traces vote only when their confidence reaches the threshold.window_sizetokens (2048 by default). A shorter trace reportslowest_group = bottom_10_percent = 0.0.compute_least_grouped/calculate_bottom_window_confidenceuse the mean over the whole trace in that case.min_confsin the reference).Changes
weighted_majority_vote: drops early-terminated traces and sumsconfidence_stats[confidence_metric]per answer. If every trace terminated early, it falls back to all of them.process_online: votes with the warmup traces that pass the threshold plus the online traces.ConfidenceCalculator: treats a trace shorter than the window as one group of all its tokens.confidence_metricnow defaults to"lowest_group". The README table is updated.Tests
Three new tests in
tests/test_deepconf.py, which CI runs: short-trace group confidence, sum-of-confidences voting, and skipping early-terminated traces. All three fail onmainand pass with this change.