Glossary
Learning to rank
Learning to rank (LTR) is the use of machine learning to order search results, by training a model on labelled examples to combine many relevance signals into one ranking score.
Learning to rank (LTR) is the use of machine learning to order search results, by training a model on examples of good rankings so that it learns how to combine many relevance signals into a single score. A typical system retrieves a few hundred candidates with a fast method such as BM25 or vector search, computes features for each one, and uses the trained model to reorder them. Learning to rank powers most large web, e-commerce and enterprise search engines, and its ideas underpin the neural rerankers used in RAG pipelines today.
How learning to rank works
A learning to rank system has three ingredients: candidate documents, features that describe each query and document pair, and relevance labels that say which documents should come first. The candidates come from a cheap first-stage retriever such as BM25 or vector search, typically the top 100 to 1,000 results. Features are numbers computed for each pair: the BM25 score of the title, the BM25 score of the body, the cosine similarity between query and document embeddings, document age, click-through rate, page authority, whether the query terms appear in the URL. Labels come from human judgements, often on a 0 to 4 scale, or from user behaviour such as clicks and purchases.
A model learns a function that maps features to a score, trained so that sorting by that score reproduces the labelled order as closely as possible. At query time the system retrieves candidates, computes features for each, scores them with the model, and returns the new order. Because the model only sees a few hundred candidates, it can afford features that would be too slow to compute across the whole index.
Pointwise, pairwise and listwise approaches
Learning to rank methods differ in what they treat as a training example. The choice affects what the model optimises and how well it matches the way rankings are judged.
Approach | What the model learns | Example algorithms | Trade-off |
|---|---|---|---|
Pointwise | A relevance score for each document on its own | Linear or logistic regression, gradient boosted regression | Simple, but ignores that only relative order matters |
Pairwise | Which of two documents should rank higher | RankNet, RankSVM, LambdaRank | Matches ranking better, but treats every pair as equally important |
Listwise | The quality of a whole ranked list | LambdaMART, ListNet, SoftRank | Optimises ranking metrics most directly, more complex to train |
Pairwise methods were the breakthrough. RankNet, published by Microsoft researchers in 2005, trained a neural network on pairs of documents and learned to prefer the more relevant one. LambdaRank and then LambdaMART weighted each pair by how much swapping them would change a ranking metric such as NDCG, which pushed the model to get the top positions right. LambdaMART, a gradient boosted tree version, won the Yahoo! Learning to Rank Challenge in 2010 and is still a strong baseline. Libraries such as XGBoost and LightGBM include LambdaMART-style objectives, which is how most teams train ranking models today.
A worked example
Consider an internal help centre with 40,000 articles. Users search for things like “reset 2FA” and “expense limit for travel”. The first-stage retriever is hybrid search, returning 200 candidates per query. The team collects six months of search logs and turns them into labels: an article clicked and read for more than 30 seconds counts as relevant, an article skipped above a clicked one counts as less relevant.
They compute twelve features per query and article pair: keyword score on title and body, semantic similarity, article age, view count, whether the article is in the user’s department, and a few others. A LambdaMART model with a few hundred trees is trained on 50,000 queries and evaluated on a held-out month. NDCG at 10 rises from 0.61 with the hybrid order to 0.70 with the learned order. The biggest gains come from the department feature and article age, two signals that no text similarity score could capture.
Most real gains look like this. The text retrievers do a reasonable job of finding candidates, and learning to rank adds the business and behavioural context that decides which of them a particular user wants.
Where the training labels come from
Labels are the hard part. Human judgements are clean but slow and expensive: assessors read each query and grade each candidate, and a few thousand graded queries can take weeks. A golden dataset built this way is valuable for evaluation even when it is too small for training.
Click data is plentiful but biased. Users click what is shown first, so a document at position one gets clicks partly because of its position. Training directly on raw clicks teaches the model to reproduce the old ranking. Counterfactual learning to rank corrects for this with position bias estimates, for example by randomising the top results for a small share of traffic and measuring how click rates change with position. Interleaving experiments compare two rankers live by mixing their results and counting which one’s results get clicked.
A newer source is model-generated labels. Teams ask a large language model to grade query and document pairs, an approach related to LLM-as-a-judge. This is fast and cheap, but the labels inherit the model’s blind spots, so a sample still needs human review.
Learning to rank vs reranking
The two terms overlap. Reranking describes the position in the pipeline: a second stage that reorders a shortlist. Learning to rank describes how the ranking function is built: by training on labelled data. A gradient boosted model over hand-built features is learning to rank used as a reranker. A cross-encoder, a transformer that reads the query and document together and outputs a relevance score, is also a learned ranking model, trained on relevance pairs from datasets such as MS MARCO. The difference is that a cross-encoder learns its own features from text, while classic learning to rank relies on features you engineer.
In practice, the two are often stacked. A cross-encoder score becomes one feature among many, and a LambdaMART model combines it with freshness, popularity and permissions. That lets the system weigh text relevance against everything else the business knows. It also differs from reciprocal rank fusion, which merges lists by rank with no training at all. RRF is a good default when there are no labels; learning to rank becomes worthwhile once there are.
Where learning to rank is used
Web search engines were the first large users, and most still combine hundreds of ranking signals through learned models. E-commerce search uses it to balance relevance with margin, stock and conversion rate. Job boards, dating apps and marketplaces use it to rank people and listings. In enterprise search, it adds signals such as department, recency and document authority to text matching.
Search engines expose it as a feature. Apache Solr ships a learning to rank module, OpenSearch has a learning to rank plugin, Elasticsearch supports learning to rank models through its rescoring API, and Vespa lets teams express ranking functions, including gradient boosted models, as part of the schema. Check the current documentation for each, because support and model formats change between versions.
Evaluating a ranking model
Ranking models are judged with ranking metrics, not accuracy. NDCG at k rewards putting highly relevant documents near the top and discounts lower positions. Mean reciprocal rank looks at where the first relevant result appears, which suits question answering. Recall at k and precision and recall more broadly tell you whether relevant items are in the shortlist at all. Offline metrics should be confirmed online, with an A/B test or interleaving, because a model can improve NDCG on old labels and still disappoint real users. The broader discipline is retrieval evaluation.
Limits and pitfalls
Learning to rank cannot rescue a poor first stage. If the right document is not among the candidates, no model will place it first, which is the argument in why reranking can’t fix a bad first pass. Feature drift is a second risk: if the click-through feature is computed differently in production than in training, the model quietly degrades. Feedback loops are a third. A model trained on clicks from its own rankings can entrench whatever it already favours. And there is a maintenance cost: features need pipelines, labels need refreshing, and models need retraining as content and users change.
For AI agents and RAG systems, the stakes are slightly different. The ranked list feeds a language model, not a person, so the top few chunks matter most and position bias in clicks is less relevant. Many teams use a cross-encoder or an LLM-based reranker here instead of a feature-based model, because they rarely have click logs and the text itself carries most of the signal.
Ranking with Exabase
Exabase handles ranking as part of retrieval rather than as a model you train. Deep Search combines typo-tolerant keyword matching with semantic search by default, returns sub-document chunks with per-hit and per-chunk relevance scores, and lets you set a precision value from 0 to 1 to trade recall for relevance. Results can be sorted by relevance or by creation date, and filtered by kind, folder, tag, user and date. The searching resources guide and search API reference list the options.
Memory retrieval adds recency weighting and an optional rerank pass: rerankCandidates sets how many results the reranker considers (1 to 500), and rerankThreshold drops the lowest-scoring share. Both are described in the memory search reference. Exabase does not train a custom ranking model on your click data or business features. If your product needs that, Exabase serves as the first-stage retriever and you run your own learning to rank model on the candidates it returns, using its scores as features. The RAG accuracy solution covers the retrieval side, and the best reranking models roundup and Exabase vs Cohere cover hosted rerankers.
Frequently asked questions
What is learning to rank in simple terms?
Learning to rank is training a machine learning model to sort search results in the best order. The model learns from examples of good rankings and combines many signals, such as text relevance, freshness and popularity, into one score.
What is the difference between pointwise, pairwise and listwise ranking?
Pointwise methods score each document alone, pairwise methods learn which of two documents should rank higher, and listwise methods optimise the quality of a whole ranked list. Listwise and lambda-based pairwise methods usually perform best on ranking metrics.
What is LambdaMART?
LambdaMART is a gradient boosted tree algorithm for learning to rank that weights training pairs by how much swapping them would change a metric such as NDCG. It remains a strong, widely used baseline and is available in XGBoost and LightGBM.
Is a cross-encoder a learning to rank model?
Yes, in a broad sense. A cross-encoder is trained on relevance data to score query and document pairs, so it is a learned ranker. Classic learning to rank usually refers to models over engineered features, and the two are often combined.
Do I need click data for learning to rank?
No, but you need labels of some kind. Human judgements, click logs corrected for position bias, and grades from a language model are all used, often together.
When is learning to rank worth the effort?
When you have labelled data and signals beyond text relevance, such as recency, popularity or user context, that matter to users. Without labels, hybrid retrieval with reciprocal rank fusion and a pretrained reranker is usually the better starting point.
Can I use learning to rank with Exabase?
Yes, as a second stage. Deep Search returns candidates with relevance scores, which you can feed into your own ranking model alongside business features. Exabase does not train ranking models for you.
Related pages: reranking, cross-encoder, reciprocal rank fusion, NDCG, search relevance, relevance score, evaluating retrieval without a labelled dataset, Cohere Rerank pricing, RAG pipelines, RAG accuracy