Papers
Topics
Authors
Recent
Search
2000 character limit reached

Listwise Cross-Entropy Loss

Updated 22 May 2026
  • Listwise Cross-Entropy Loss is a ranking objective that computes loss over the whole candidate set, enhancing alignment with metrics such as NDCG.
  • It provides theoretical benefits including convex upper bounds on ranking metrics and Fisher consistency, ensuring improved ranking performance.
  • Scalable surrogate methods like Sampled Softmax, NCE, and SCE enable efficient use of this loss in large-scale recommendation and retrieval systems.

Listwise Cross-Entropy Loss is a foundational principle and optimization objective in modern learning-to-rank, sequential recommendation, and collaborative filtering. Its distinguishing feature is that the loss is defined as a function of the entire candidate set (or list), in contrast to pairwise or pointwise objectives, thereby directly aligning the optimization process with the structure of ranking metrics such as NDCG. Recent advances have deepened both the theoretical and practical understanding of listwise cross-entropy loss, establishing its superiority in aligning model learning with ranking performance and proposing scalable surrogates suitable for large candidate sets (Xu et al., 2024, Yang et al., 2024, Bruch, 2019).

1. Formal Definition and Variants

In its canonical form for sequential recommendation or learning-to-rank, the listwise cross-entropy loss is defined as the negative log-likelihood of the true next (or relevant) item, normalized over all candidate items I\mathcal{I}. For an input context qq (e.g., user history), an item vv, and a parameterized scoring function sθ(q,v)s_{\theta}(q,v), the standard listwise cross-entropy loss is: CE(q,v+;θ)=logexp(sθ(q,v+))vIexp(sθ(q,v))=sθ(q,v+)+logZCE(q)\ell_{\mathrm{CE}}(q, v_+; \theta) = - \log \frac{\exp(s_{\theta}(q, v_+))} {\sum_{v \in \mathcal{I}} \exp(s_{\theta}(q, v))} = -s_{\theta}(q, v_+) + \log Z_{\mathrm{CE}}(q) where ZCE(q)=vIexp(sθ(q,v))Z_{\mathrm{CE}}(q) = \sum_{v \in \mathcal{I}} \exp(s_{\theta}(q, v)).

For learning-to-rank with graded labels, the listwise cross-entropy “xe” proposed by Bruch et al. employs gain-normalized label distributions: xe(y,f;γ)=i=1mϕ(yi;γi)logρ(fi)\ell_{\mathrm{xe}}(y, f; \gamma) = - \sum_{i=1}^m \phi(y_i; \gamma_i) \log \rho(f_i) where

ρ(fi)=exp(fi)j=1mexp(fj),ϕ(yi;γi)=2yiγij=1m(2yjγj)\rho(f_i) = \frac{\exp(f_i)}{\sum_{j=1}^m \exp(f_j)}, \qquad \phi(y_i; \gamma_i) = \frac{2^{y_i} - \gamma_i}{\sum_{j=1}^m (2^{y_j} - \gamma_j)}

with yiy_i the relevance and fif_i the model score for document qq0, and qq1 a smoothing hyperparameter (Bruch, 2019). This formulation subsumes earlier listwise losses such as ListNet and ListMLE.

2. Distinctiveness Compared to Pointwise and Pairwise Objectives

Listwise cross-entropy loss jointly normalizes over all candidates in each query, in contrast to the following:

  • Pointwise losses (e.g., binary cross-entropy) optimize each context–item pair independently, typically applying a sigmoid to qq2. There is no competition among items.
  • Pairwise losses (e.g., Bayesian Personalized Ranking) optimize a positive–negative pair at a time, e.g., qq3, but do not consider the “whole list” structure (Xu et al., 2024, Yang et al., 2024).

This listwise normalization is essential for aligning the optimization with ranking metrics and for ensuring that training steps are sensitive to the global order induced by the scoring function.

3. Theoretical Guarantees: Metric Surrogacy and Consistency

Formally, minimizing listwise cross-entropy loss provides convex upper bounds on rank-based metrics. Specifically:

  • Lower Bound on NDCG: For a predicted rank qq4 of the target item, it holds that

qq5

where for the next-item case, qq6 (Xu et al., 2024). This ensures that minimizing the loss tightly controls the quality of ranking as measured by NDCG.

  • Fisher Consistency: The xe loss is both a convex function of the scores and Fisher-consistent for NDCG under standard IR data assumptions (graded or click-based labels) (Bruch, 2019). This means that any score vector that minimizes the loss asymptotically maximizes mean NDCG.
  • Comparative Surrogacy: ListNet and ListMLE do not bound a ranking metric and are not NDCG-consistent; LambdaMART’s loss is non-convex and heuristically tied to NDCG via "lambda-gradients" (Bruch, 2019).

The tight theoretical connection between listwise cross-entropy and core ranking metrics distinguishes it from previously used losses and underpins its empirical superiority.

4. Scalable Approximations and Surrogate Losses

Computing the full softmax denominator scales as qq7 per training example, which is prohibitive for large candidate sets. Several surrogate approaches are established:

  • Sampled Softmax (SSM): Sample qq8 negatives per positive, compute loss over observed plus negatives: qq9
  • Noise Contrastive Estimation (NCE): Incorporates a correction term vv0 in the negative logits and uses both positive and negative classification sub-tasks. Proper tuning of vv1 governs the strength of the approximation (Xu et al., 2024).
  • Importance Sampling (IS) and Scaled Cross-Entropy (SCE): IS adjusts softmax weights using the sampling distribution, while SCE introduces a scaling parameter vv2 to adjust for the magnitude loss caused by sampling: vv3 SCE with vv4 can recover tight metric-aligned bounds with minor computational cost (Xu et al., 2024).
  • SimCE (“Simplified Sampled Softmax Cross-Entropy”): An upper-bound of SSM, focusing on the hardest negative: vv5 When vv6, SimCE reduces to the pairwise hinge and upper-bounds BPR (Yang et al., 2024).

These approximations allow practical deployment of listwise loss in large-scale systems, so long as sampling is tuned to preserve ranking sensitivity.

5. Empirical Outcomes and Comparative Analysis

Empirical evaluations consistently demonstrate the superiority of listwise cross-entropy–based training:

  • On public next-item recommendation datasets (Beauty, MovieLens-1M, Yelp), state-of-the-art sequential models (e.g., SASRec) trained with full CE substantially outperform the same backbones trained with BCE or BPR, and also surpass LLMs by a notable margin in HR@10 despite being orders of magnitude smaller (Xu et al., 2024).
  • SCE achieves nearly the same ranking performance as full CE with vv7 as low as 100–500 negatives (5% of item set), reducing training cost by 10–100× while remaining stable across models and datasets.
  • In collaborative filtering, SimCE leads to 20–40% gains in Recall@20 for MF backbones and up to 68.7% improvements in Recall@10 on some large datasets. SimCE and SSM converge in 20–40 epochs versus 80–200 for BPR (Yang et al., 2024).
  • Across information retrieval benchmarks (Web30K, Yahoo! LTR), the xe loss provides small but statistically significant NDCG@5 and NDCG@10 improvements over LambdaMART and ListNet, achieves faster convergence, and is more robust to irrelevant document augmentation and label noise (Bruch, 2019).
Loss Function Consistency with NDCG Full-List Required Empirical Ranking Quality
CE/xe (Listwise CE) Yes Yes Superior, reliable, robust
SCE, SSM, SimCE Approximately No (sample-based) Equivalent if vv8 tuned
BPR, BCE (Pair/Point) No No Inferior, slow, thin gradient signals

6. Implementation Guidance for Large-Scale Systems

  • Loss Selection: Use full CE where vv9 is manageable (sθ(q,v)s_{\theta}(q,v)0 tens of thousands). For larger sets, SCE with uniform sampling and sθ(q,v)s_{\theta}(q,v)1 provides a robust, scalable surrogate (Xu et al., 2024).
  • Sampling Practice: sθ(q,v)s_{\theta}(q,v)2–500 negatives suffices for sθ(q,v)s_{\theta}(q,v)3k–20k. Sample size sθ(q,v)s_{\theta}(q,v)4 is effective.
  • Hyperparameters: For SCE, set sθ(q,v)s_{\theta}(q,v)5; for NCE, sθ(q,v)s_{\theta}(q,v)6 avoids slow early convergence. SimCE recommends margin sθ(q,v)s_{\theta}(q,v)7–sθ(q,v)s_{\theta}(q,v)8.
  • Batching and Negatives: Form user–positive pairs in batches, sample negatives per batch; ensure consistency of negative sampling across training and inference phases.
  • Sequence and Embeddings: Use sliding-window augmentation for long sequences; embedding size beyond sθ(q,v)s_{\theta}(q,v)9–128 offers diminishing returns compared to cost.
  • Monitoring: Track both surrogate loss and true ranking metrics (NDCG, RR) to ensure the surrogate bound tightens in training. Monotonic improvement is expected with CE and SCE, while pointwise/pairwise losses may plateau early.

The xe loss is a convex gain-weighted variant tied to NDCG; ListNet and ListMLE generalize the listwise CE to permutation probability models but lack direct metric surrogacy. LambdaMART, despite its empirical dominance, optimizes an implicit, non-convex loss and does not provide convexity or Fisher consistency with NDCG (Bruch, 2019). Surrogate techniques for CE, including sampled softmax, NCE, IS, and SCE, have established frameworks for scalable, theoretically-justified ranking optimization.

A plausible implication is that future ranking systems for recommendation and retrieval will standardize on listwise CE surrogates (SCE, SimCE) for scalable, robust training, given their superior alignment with target metrics and computational feasibility in large-scale applications.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Listwise Cross-Entropy Loss.