Repository navigation
Add Bayes@N corpus metric for repeated generations - #1219
Open
mohsenhariri wants to merge 3 commits into
Open
mohsenhariri wants to merge 3 commits into
mohsenhariri wants to merge 3 commits into
Conversation
Author
|
Please review the metric API linked in #1440 and enable the pending fork workflows for this PR when appropriate. Tests, Quality, Build PR Documentation and Slow end to end tests currently need approval. The refreshed head |
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.
Feature design: #1440.
Bayes@N adds posterior uncertainty to repeated generative evaluation. A task selects
Metrics.bayes_at_n(sample_params={"n": 16})to score 16 candidates per question and reportbayes@n(posterior mean) andbayes@n_sigma(posterior standard deviation).Metrics.bayes_at_n_mathuses the existing math answer extraction.Each question has an independent categorical Dirichlet posterior with one pseudo-count per category. The corpus result is the mean score over the fixed question set. Binary exact match is the default; custom categorical scorers provide category weights. Optional prior outcomes are attached to the current document through a callable. The native NumPy implementation follows Algorithm 1 of Don't Pass@k and the MIT-licensed Scorio reference, without adding a dependency.
The collectors reject missing generations, ragged outcome rows, invalid category ids and inconsistent weights or prior availability. Reward scaling avoids overflow in posterior variances. Grouped metric names accept CLI sampling parameters. The metric documentation includes task configuration, categorical scoring and prior examples.
Task and suite summaries retain Lighteval's equal-task mean. For the Bayes SD, they use
sqrt(sum(sigma_t**2))/number_of_tasks, assuming independent, non-overlapping question sets. Per-task means and SDs remain available when that assumption does not hold. The metric adds neither a bootstrap stderr nor a credible interval.Validation uses the checkout's Python 3.13.11
.venvwith.[dev]and CPU PyTorch:python -m pytest -q tests/unit/metrics/test_bayes_at_n.py tests/unit/metrics/test_normalizations.py: 48 passed. Cases include exact rational binary results, an independent categorical Fraction oracle, prior alignment through serialization/reordering, registered math scoring, Registry CLI parameters and real task/logger aggregation, pipeline metric execution and JSON/Parquet export.rtol=1e-13.make quality: passed, with existing suppression-comment warnings intest_evaluation_tracker.py.HF_DATASETS_CACHE=/tmp/lighteval-datasets python -m pytest -q tests/unit/logging/test_evaluation_tracker.py: 8 passed, 1 skipped and 133 passed subtests.7fa19dc6f53a713ba8bb6541e7ed66dad2e24fd7. Full GPU/model/download suites were not run.