ML Systems Lab Open interactive version →
Advanced 25 min read LTRlearning-to-rankLambdaMARTposition bias

Learning-to-Rank Systems

Pointwise vs pairwise vs listwise, LambdaMART, position bias, distillation

A trap that catches almost everyone: training a classifier to predict relevance and sorting by its score is *not* the same as training a ranker. A classifier tuned for per-item accuracy can achieve low average error across all items and still order them wrong — because ranking is *relative*. What matters is which item beats which, not the exact number on each.


Three ways to train for order. *Pointwise* scores each item alone and misses the relative point. *Pairwise* learns "A should rank above B" — fixes pairs but treats a swap at rank 1 the same as a swap at rank 100. *Listwise* optimizes the whole list, which is what you want, but it's expensive and sensitive to label noise. For tabular ranking (web search, ads) the practical winner is LambdaMART: gradient-boosted trees whose gradients are weighted by NDCG impact, so a swap near the top gets a far bigger push than one near the bottom — a ranking-aware signal without needing NDCG to be differentiable (it isn't).


The deeper problem none of these fixes alone: position bias. Click data is contaminated by *where* items were shown. Position 1 collects clicks whether or not it deserved them, so training on raw clicks teaches the model to reproduce position effects — a self-reinforcing loop where it keeps promoting whatever the last model promoted. Breaking it needs inverse-propensity weighting: weight each example by 1/P(click|position), so position-1 examples count less and position-5 examples count more.

Key points

Takeaway

Ranking is a relative problem, so you train for order (LambdaMART weights each gradient by NDCG impact) not for per-item accuracy — but click-trained rankers also inherit position bias, which only inverse-propensity weighting (not a better loss) removes.

Recap

Check your understanding

Q1. A classifier achieves high average accuracy on its relevance-score predictions across all items, yet its ranking is worse than a pairwise model with less accurate scores. How is that possible?

Q2. Select the two correct statements about why LambdaMART weights each pairwise gradient by |ΔNDCG| instead of optimizing NDCG directly.

Q3. You deploy an online-distilled student ranker. It matches the teacher on held-out ranking but underperforms in production. What's the most likely cause tied to distillation?

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →