airalcorn2/RankNet

split batches in one query for LambdaRank

LucyLu-LX opened this issue · 1 comments

Hi @airalcorn2 ,

Thanks for your clear code.

I am a little confused about LambdaRank that I hope you can help with. If I have a total of 2560 docs in one query, can I split it into 10 batches to do 10 backwards, or I have to include all 2560 docs in one batch to do 1 backward. Thanks.

The 2,560 documents need to be treated as a single batch because the lambdas are computed using the ranks over all the documents associated with the query. However, there might be a way to split up the weight updates using something like doc_scores[subset_idxs].backward(lambs[subset_idxs], retain_graph=True) if memory is an issue (see [1, 2]).