UKPLab / sentence-transformers

State-of-the-Art Text Embeddings
https://www.sbert.net
Apache License 2.0
15.36k stars 2.49k forks source link

Can sentence-transformers easily adapt to listwise loss function (e.g. lambdarank)? #2563

Open shangh1 opened 7 months ago

shangh1 commented 7 months ago

Hi, I'd like to run a cross-encoder model training with a listwise loss function. Do you have any suggestions whether there is an easy way for this?

The input data is (query, item) level. To train with listwise loss, I need to

Thanks, Hongwei

tomaarsen commented 7 months ago

Hello!

I think it might make more sense to implement this in a DataLoader or collator which are responsible for loading the data. That way you always have confidence that the values in the loss function correspond with the correct batch.