Skip to content

Conversation

@yjoonjang
Copy link

RankNetLoss Implementation for Cross Encoder Trainer

This PR adds RankNetLoss functionality to the Cross Encoder Trainer feature.

Changes

  • Implemented RankNetLoss as a pairwise loss function
  • Added RankNetLoss to class LambdaLoss with NoWeightingScheme
  • Created an example script demonstrating RankNetLoss usage

Implementation Details

RankNetLoss is a pairwise loss function which learns a ranking function by optimizing pairwise document comparisons using a neural network.
The implementation inherits from the LambdaLoss base class and uses a NoWeightingScheme, focusing solely on the pairwise comparison of documents.

The loss function implements the core RankNet algorithm from the Burges et al. paper (2005), which uses gradient descent to learn a ranking function by optimizing a probabilistic cost function based on pairwise document comparisons.

Reference: https://icml.cc/Conferences/2015/wp-content/uploads/2015/06/icml_ranking.pdf

@yjoonjang
Copy link
Author

@yjoonjang
Copy link
Author

yjoonjang commented Mar 20, 2025

Hi @tomaarsen, I've added RankNetLoss.
Would be grateful if you could take a look at it!

@tomaarsen tomaarsen force-pushed the feat/cross_encoder_trainer branch from c1dc495 to 79f9e22 Compare March 20, 2025 07:36
@tomaarsen
Copy link
Owner

I think this is looking great! I'm merging it now 🤗
Thanks a bunch. Hopefully I can push out a release with all of this soon!

  • Tom Aarsen

@tomaarsen tomaarsen merged commit e694233 into tomaarsen:feat/cross_encoder_trainer Mar 20, 2025
@yjoonjang
Copy link
Author

Thank you and great work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants