Add support for selecting few-shot examples by id#1284
Open
ErenAta16 wants to merge 1 commit into
Open
Conversation
Custom tasks currently choose few-shot examples through few_shots_select (sequential, random, or balanced), which always picks from the pool programmatically. There was no way to pin a task to a specific, reproducible set of few-shot examples the way the LM-Evaluation-Harness id_sampler does, which matters when comparing against a published harness run or when a paper specifies exact few-shot examples by id. LightevalTaskConfig gains two new fields: - few_shots_id_column: name of a dataset column to use as a stable identifier for few-shot rows. When set, this value becomes the id of the corresponding few-shot Doc instead of the row's position in the split. Evaluation docs are unaffected and keep using the row position, so this is opt-in and backward compatible. - few_shots_id_list: an explicit list of ids (matching few_shots_id_column, or the row position if it is not set) to use as few-shot examples, in the given order, instead of applying few_shots_select. FewShotSampler picks up few_shots_id_list ahead of the existing sorting strategies and raises a clear error if any requested id is missing from the few-shot pool, rather than failing silently or picking something else instead. Fixes huggingface#634
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.
Custom tasks currently choose few-shot examples through few_shots_select (sequential, random, or balanced), which always picks from the pool programmatically. There was no way to pin a task to a specific, reproducible set of few-shot examples the way the LM-Evaluation-Harness id_sampler does, which matters when comparing against a published harness run or when a paper specifies exact few-shot examples by id.
LightevalTaskConfig gains two new fields:
FewShotSampler picks up few_shots_id_list ahead of the existing sorting strategies and raises a clear error if any requested id is missing from the few-shot pool, rather than failing silently or picking something else instead.
Fixes #634