An order, not a label
The topic Anomaly detection ended with a score for every point and an analyst who reads the list from the top. Only the order of the scores mattered there: a detector is useful if the true anomalies come first, and nobody reads the thousandth line. That was already a ranking problem, solved without labels. This topic adds labels. A search engine, a product catalogue and a news feed all return an ordered list, and people judge the list by its top. The answer is an order, not a label.
Ranking data are grouped. A query comes with candidate documents, usually a few hundred that a cheap first stage picked out of millions. Document has a feature vector that describes the pair (query, document). An assessor who read both gives it a graded relevance label , from irrelevant to perfect. Binary relevance, , is the special case. A model gives each document a score , and the ranking sorts the documents by decreasing score. We write for the label of the document in position .
The features come in three kinds:
- Query features depend only on the query: its length, its frequency in the logs. They are the same for every document of the query.
- Document features depend only on the document: its length, its freshness, its link-based importance such as PageRank, the stationary distribution of a random surfer from the topic Markov chains.
- Query–document features measure the match: a text-matching score such as BM25, the cosine between embeddings, the share of query words in the title.
Orders are compared only within a query. Whether a page about the jaguar the animal should come before one about Jaguar the car depends on what was asked. So adding a constant to all scores of one query changes nothing, and scores mean something only up to a shift per query.
Two practical rules follow. Validation splits by query, never by row: this is the group split of the topic Validation and overfitting, and documents of one query on both sides would be the train–test contamination of Data, features and leakage. And a learned ranker is usually the second stage of a cascade. A fast retriever narrows millions of documents to hundreds, and the ranker orders those.