[bugfix] support negative-only pointwise reranker data and fix evaluation metrics#8503
Open
yinpu wants to merge 5 commits intomodelscope:mainfrom
Open
[bugfix] support negative-only pointwise reranker data and fix evaluation metrics#8503yinpu wants to merge 5 commits intomodelscope:mainfrom
yinpu wants to merge 5 commits intomodelscope:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for pointwise reranking and improves query boundary tracking using a new group_sizes attribute. Key changes include updating the reranker data collator to handle negative-only samples for pointwise loss, enhancing RerankerMetrics to calculate classification metrics (accuracy, precision, recall, and F1), and modifying the trainer to propagate group_sizes through the evaluation loop. Additionally, new test suites were added to verify the collator, metrics, and trainer logic. I have no feedback to provide.
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.
PR type
PR information
This PR fixes several reranker evaluation and data handling issues around pointwise training.
Background
The current reranker pipeline has a few gaps in pointwise evaluation/training:
for BCE-style pointwise reranker training
group_sizesneeds to be carried throughevaluation
These issues can lead to incomplete training data usage and incorrect reranker metrics during
evaluation.
Changes
This PR includes the following fixes:
group_sizesfor pointwise reranker evaluation so query boundaries are explicit(labels, group_sizes)tuplesflow
Affected areas
swift/template/base.pyswift/metrics/reranker.pyswift/trainers/reranker_trainer.pyTest coverage
Added/updated tests:
tests/train/test_reranker_collator.pytests/train/test_reranker_metrics.pytests/train/test_reranker_trainer.pyCovered cases include:
group_sizesis only emitted when neededmetric_key_prefixCompatibility / Risk
This PR only changes reranker-specific collation and evaluation paths.
Main risk:
Mitigation:
Experiment results
Unit tests added for reranker collator, metrics, and trainer regression cases.