The user wants a concise overview of offline evaluation for ranking systems.
The key components mentioned are:
- Labels: What kind of data is used for evaluation?
- MRR/NDCG: The specific metrics.
- Bias checks: Ensuring the evaluation is fair and representative.
1. Labels (The Ground Truth):
- What are they? Explicit (ratings, likes) vs. Implicit (clicks, dwell time, purchases).
- Grading: Binary (relevant/irrelevant) vs. Graded (highly relevant, partially relevant).
- Relevance: How do we know a document is relevant to a query? Human judgment (judges) or data mining.
- Scale: Per query, we need a list of documents with associated relevance scores.
- Issues: Missing labels (unjudged documents), noise in human labeling.
2. Metrics (Measuring Performance):
- MRR (Mean Reciprocal Rank): Focuses on the first relevant item. Good for "I want one right answer" (factoid search, navigational queries). Formula: 1/rank.
- NDCG (Normalized Discounted Cumulative Gain): The gold standard for ranking.
- CG (Cumulative Gain): Sum of relevances.
- DCG (Discounted CG): Penalizes lower ranks (logarithmic discount).
- NDCG: Normalized against the Ideal DCG (IDCG). Allows handling graded relevance and comparing across queries.
- Other metrics (brief mention): MAP (Mean Average Precision), Precision@k, Recall@k (though NDCG is usually preferred for modern ranking).
3. Bias Checks (Fairness and Robustness):
- Position Bias: Users click the top results more often, regardless of relevance. If training on clicks, this is a problem. In offline eval, we usually use judged labels, so it's less of an issue during calculation but crucial to understand where labels come from (if using implicit labels). Or, is the model biased?
- Selection Bias: Only certain queries/items get evaluated.
- Popularity Bias: Does the model just rank popular items higher?
- Fairness/Representation: Are certain demographics underrepresented in the top ranks?
- Interpolation/Extrapolation: Evaluating on a hold-out set. Is the hold-out set representative?
Structure of the Response:
I should structure this logically:
- Introduction: Define offline eval.
- 1. Data & Labels: Explain the foundation.
- 2. Key Metrics: Deep dive into MRR and NDCG (formulas + intuition).
- 3. Bias & Robustness: Crucial sanity checks.
- Summary/Best Practices: A quick wrap-up.
Drafting the Content:
- Labels: Mention relevance grades (0,1,2,3). Mention implicit vs. explicit.
- MRR: Formula 1/∣Ri∣. Simple, focuses on top result.
- NDCG: Break it down: Gain -> Discounted -> Normalized. Why normalize? Because some queries have no good results.
- Bias:
- Position Bias (in implicit labels): Must correct (e.g., IPW) or use human labels.
- Evaluation Bias: Hold-out sets need to match production traffic.
- Slicing: Segment eval by query frequency (head vs. tail).
Refining the Tone:
The user used a telegraphic style ("Offline eval for ranking: labels, MRR/NDCG, bias checks"). They likely want a structured, dense, technical summary, not a fluffy blog post. I should use bullet points and bold text for readability.
Self-Correction/Refinement:
- Initial thought: Should I include MAP?
- Correction: The prompt specifically asked for MRR/NDCG. I'll stick primarily to those but maybe mention MAP briefly as a cousin to NDCG.
- Bias: Make sure to distinguish between bias in the training data (which affects the model) and bias in the evaluation data (which affects the metric validity). The prompt implies evaluating the system, so I should focus on the validity of the test set (slicing, position bias in labels).
Let's flesh out the Bias section more.
- Slicing: Don't just look at global NDCG. Look at NDCG for "head" queries vs. "tail" queries. Look at different verticals (e.g., ecommerce: electronics vs. clothing).
- Position Bias in Labels: If using clicks as labels, high rank = more clicks. Need to mention that judged labels are better for offline eval to avoid this circularity.
Final Plan:
- Labels: Graded relevance, explicit vs. implicit.
- Metrics: MRR (first hit), NDCG (graded, positional penalty).
- Bias Checks: Slicing, Position Bias (in clicks), Popularity Bias.
- Process: Train/Test split, statistical significance.
Let's write it.
Here is a structured guide to offline evaluation for ranking systems, focusing on the three pillars you identified: Data (Labels), Metrics (MRR/NDCG), and Validity (Bias Checks).
1. Labels (Ground Truth)
Before calculating metrics, you must define what "relevant" means. In offline eval, labels usually come in two forms:
- Binary Labels (0/1): Simple relevant vs. irrelevant.
- Source: Clicks (CTR), manual human annotation.
- Use Case: Foundational, but misses nuance (e.g., a document that answers the query perfectly vs. one that merely mentions the keyword).
- Graded Relevance (0–k): A scale of relevance (e.g., 0=Bad, 1=Fair, 2=Good, 3=Perfect).
- Source: Human rating guidelines (e.g., Google’s Rater Guidelines), detailed user feedback (surveys).
- Use Case: Essential for NDCG, as it allows you to reward highly relevant documents appearing at the top more than marginally relevant ones.
Common Pitfall: Interpolation. If you have sparse human labels, do not assume unlabeled documents are irrelevant. Treat them as "unknown" rather than "0" to avoid penalizing good but unjudged results.
2. Metrics (MRR & NDCG)
Ranking metrics reward placing relevant items at the top of the list.
MRR (Mean Reciprocal Rank)
- Focus: User effort to find the first relevant answer.
- Formula: The average of the reciprocal ranks of the first relevant item for a set of queries.
MRR=∣Q∣1∑
NDCG (Normalized Discounted Cumulative Gain)
- Focus: The overall quality of the entire ranking list.
- Components:
- Gain (G): The relevance score of a document (e.g., 3 for perfect).
- Cumulative (CG): Sum of gains (doesn't care about order).
- Discounted (DCG): Reduces the gain score logarithmically based on position. A relevance score of 3 at rank 1 is worth more than a 3 at rank 10.
- Normalized (N): Divides the DCG by the IDCG (Ideal DCG—the best possible score for that query) to bound the result between 0 and 1.
- When to use: Exploratory search, e-commerce (user wants options), streaming services. It handles graded relevance well.
3. Bias Checks
Offline metrics are often skewed by how the data was collected. You must check for these biases before trusting your eval:
A. Position Bias (The "Trust" Bias)
- The Issue: Users click on results at the top of the page because they are at the top, not necessarily because they are the most relevant.
- Impact: If you train on clicks, the model learns to rank items high simply because they were historically high.
- Check: Compare Click-Through Rate (CTR) by position. If position 1 has a massive CTR regardless of the query intent, you have severe position bias.
- Correction: Use Inverse Propensity Scoring (IPS) or run Interventional Tests (shuffling results slightly) to decouple relevance from position.
B. Popularity Bias
- The Issue: Popular items (bestsellers) get clicked more often, drowning out niche but highly relevant items (the "long tail").
- Impact: The ranking becomes a "trending" list rather than a relevance list.
- Check: Segment your evaluation metrics by item frequency. Does the model perform well on items that appear < 100 times in the training set?
C. Selection Bias (Unjudged Items)
- The Issue: In offline judging, we usually only label the top k results from the current production model. New items or bad results from the old model are never judged.
- Impact: The new model retrieves a great result that the old model missed. Because there is no label for it, it counts as "irrelevant," artificially lowering your offline score.
- Correction: Regularly perform "cocoa" sampling (random sampling of the corpus) to label documents that your current model currently ignores.
Summary Table
| Metric | Best For | Key Weakness |
|---|
| MRR | Finding one right answer (FAQs, Navigation) | Ignores the quality of lower results |
| NDCG | Browsing, Shopping, Graded relevance | Computationally more complex; requires IDCG calculation |
| Bias Check | Validating the metric | Requires separate data analysis (IPS, slicing) |