[Paper Review] Context-Aware Learning to Rank with Self-Attention
This paper proposes a context-aware neural ranking model that uses self-attention to dynamically score items based on their interactions within a list, both during training and inference—unlike traditional learning-to-rank methods that score items in isolation. The approach achieves state-of-the-art performance on MSLR-WEB30K, setting a new SOTA NDCG@5 of 52.86 using ordinal loss with optimized hyperparameters.
Learning to rank is a key component of many e-commerce search engines. In learning to rank, one is interested in optimising the global ordering of a list of items according to their utility for users.Popular approaches learn a scoring function that scores items individually (i.e. without the context of other items in the list) by optimising a pointwise, pairwise or listwise loss. The list is then sorted in the descending order of the scores. Possible interactions between items present in the same list are taken into account in the training phase at the loss level. However, during inference, items are scored individually, and possible interactions between them are not considered. In this paper, we propose a context-aware neural network model that learns item scores by applying a self-attention mechanism. The relevance of a given item is thus determined in the context of all other items present in the list, both in training and in inference. We empirically demonstrate significant performance gains of self-attention based neural architecture over Multi-LayerPerceptron baselines, in particular on a dataset coming from search logs of a large scale e-commerce marketplace, Allegro.pl. This effect is consistent across popular pointwise, pairwise and listwise losses.Finally, we report new state-of-the-art results on MSLR-WEB30K, the learning to rank benchmark.
Motivation & Objective
- To address the limitation of traditional learning-to-rank models that score items in isolation, ignoring inter-item dependencies during inference.
- To develop a neural scoring function that captures contextual relationships between items in a list through self-attention, enabling dynamic relevance assessment.
- To evaluate the proposed model across pointwise, pairwise, and listwise losses on both benchmark and real-world e-commerce data.
- To establish new state-of-the-art performance on the MSLR-WEB30K benchmark, particularly in NDCG@5.
- To investigate the impact of different loss functions and hyperparameters on model generalization and performance.
Proposed method
- Adapts the Transformer architecture with multi-head self-attention to model item relevance in context, allowing each item to attend to all others in the list.
- Uses a learnable, permutation-equivariant scoring function that is invariant to input order, making it suitable for ranking tasks.
- Applies learnable positional encodings to enable the model to capture relative item positions, especially useful in re-ranking scenarios.
- Employs a multi-layer encoder with residual connections and feed-forward networks to refine contextual representations.
- Trains the model using various loss functions including ordinal, NDCGLoss 2++, RMSE, ListNet, LambdaRank, ListMLE, and RankNet.
- Applies dropout, batch normalization, and hyperparameter tuning to mitigate overfitting and improve generalization.
Experimental results
Research questions
- RQ1Can a self-attention-based model improve ranking performance by modeling inter-item dependencies not only in the loss but also in the scoring function?
- RQ2How does the performance of the self-attention model compare to MLP baselines across different loss functions (pointwise, pairwise, listwise)?
- RQ3Does the inclusion of positional encodings improve performance in re-ranking tasks?
- RQ4Which loss function yields the best generalization and highest NDCG performance on MSLR-WEB30K?
- RQ5What hyperparameter settings (e.g., number of heads, layers, dropout) yield optimal performance without overfitting?
Key findings
- The self-attention model achieves a new state-of-the-art NDCG@5 of 52.86 on the MSLR-WEB30K benchmark, surpassing previous results.
- The model significantly outperforms MLP baselines across all tested loss functions, including ordinal, NDCGLoss 2++, LambdaRank, and ListMLE.
- Models trained with ordinal loss achieved the highest performance, outperforming well-established losses like NDCGLoss 2++ and LambdaRank.
- The ablation study shows that a dropout rate of 0.3 and a hidden dimension of 1024 yield optimal performance, while higher dropout or more than two attention heads degrades results.
- The model with positional encodings achieves better performance on the re-ranking task, confirming the value of positional information in list ordering.
- The model's inference complexity is O(n²) due to self-attention, but techniques like distillation, quantization, or pruning can enable deployment in latency-sensitive environments.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.