Add Bayes@N metric#1219
Open
mohsenhariri wants to merge 1 commit intohuggingface:mainfrom
Open
Conversation
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
This PR adds Bayes@N as a corpus-level sampling metric for repeated generative evaluations.
Bayes@N estimates model performance from repeated categorical outcomes using posterior moments, returning:
bayes@n: posterior mean performance estimatebayes@n_sigma: posterior standard deviation, representing posterior uncertaintyThe implementation supports binary outcomes by default and multi-category outcomes when category weights are provided. It also supports optional row-aligned prior observations.
Related resources:
Changes
lighteval.metrics.bayes_at_n.BayesAtNsample-level row collection for repeated generations.BayesAtNCorpuscorpus-level aggregators for posterior mean and posterior standard deviation.Metrics.bayes_at_nMetrics.bayes_at_n_math["bayes@n", "bayes@n_sigma"].Testing
ruff check src/lighteval/metrics/bayes_at_n.py src/lighteval/metrics/metrics_corpus.py src/lighteval/metrics/metrics_sample.py src/lighteval/metrics/metrics.py src/lighteval/tasks/registry.py src/lighteval/pipeline.py tests/unit/metrics/test_bayes_at_n.pypytest -q tests/unit/metrics/test_bayes_at_n.py