Evaluating a model: from score to experimental protocol
Transfer exercise — no new implementation
Goal
Practice designing a defensible evaluation for a scientific-passage ranker. The exercise focuses on the estimand, dependence between observations, leakage, selection bias, metric interpretation, and uncertainty. It adds no model implementation and is not a benchmark result.
Before starting
- Mathematical foundations — objectives, probabilities, and assumptions;
- Cross-entropy — the training objective;
- Exercises — active recall;
- Scikit-learn: average precision;
- Scikit-learn: grouped cross-validation;
- Scikit-learn: nested versus non-nested cross-validation;
- Dror et al., statistical significance testing in NLP.
Attempt the questions before consulting references.
Concrete case
A team wants to rank scientific passages for a fixed, pre-specified distribution of research questions. Its intended deployment is on papers not present in the development corpus.
The corpus contains 200 papers and approximately 20 passages per paper (about 4,000 passages). A passage is labelled relevant or not relevant to a query. Around 5% of passages are relevant—roughly one in twenty. Multiple passages can come from the same paper and therefore share wording, topic, authors, and source-specific artefacts.
The team compares 40 configurations and reports the highest average-precision (AP) score from random passage-level cross-validation. No separate final evaluation is described.
For this exercise, assume labels and paper IDs are available, but do not assume that papers are independent of queries. If deployment must also generalize to unseen queries, state how the design would change.
Questions — answer before reading the checklist
- Target and estimand. State the target population and the quantity the reported score is supposed to estimate. For rankings produced separately for each query, do you define AP per query and then average it (macro-AP), or compute AP over all query–passage pairs (micro-AP)? What is the independent sampling unit for the stated deployment target? These two aggregations do not necessarily answer the same question.
- Split design. Explain why random passage-level splitting can overstate performance on unseen papers. What additional grouping issue arises if the target includes unseen queries?
- Leakage-safe pipeline. Where must learned preprocessing, feature selection, threshold choice, and hyperparameter tuning occur? What may the final test set be used for?
- Selection bias. Why is the maximum score among 40 configurations optimistic as a final estimate, even if every individual cross-validation procedure is implemented correctly? Propose either a locked test protocol or a nested/grouped evaluation design.
- Metric interpretation. Define AP in plain language. What does the 5% prevalence imply for a random ranking’s expected AP, approximately? What does AP not tell us about predicted probabilities?
- Uncertainty and comparison. If two systems score the same held-out papers, how would you compare them while preserving pairing and dependence? Which unit(s) would you resample, and what limitation would you report if there are few independent papers or queries?
- Reproducibility and scope. What must be recorded to reproduce the comparison? What conclusion would remain unjustified even if the selected system achieved a high AP?
Checklist for correction
- AP (Average Precision) summarizes precision at the points where recall increases as the ranking is traversed. Precision is TP/(TP+FP); recall is TP/(TP+FN). AP is a ranking metric, not a calibration metric.
- With a random ranking, expected AP is approximately the relevant prevalence. The 0.05 reference therefore applies only when prevalence is 5% in the evaluation unit being scored. For macro-AP, the expected random baseline depends on per-query prevalence and query weighting; overall passage prevalence is not enough to determine it. For micro-AP, the prevalence among the pooled query–passage pairs is relevant. This is a rough baseline, not a universal finite-sample identity. AP scores from different populations or aggregation schemes are not directly interchangeable.
- Calibration asks whether predictions assigned probability p are positive about p of the time. AP alone cannot answer this. A system can rank well while its probabilities are systematically too high or too low.
- If deployment is to unseen papers, keep all passages from a paper in one partition. If unseen queries are also part of the target, paper grouping alone may be insufficient: the split and estimand must reflect the query/document sampling structure, potentially with query-level or crossed-group holdouts.
- Every learned operation must be fitted using only the relevant training fold. Validation data can guide model selection; a locked final test must not be used to tune, select, calibrate, or repeatedly revise the system.
- Selecting the maximum among 40 noisy estimates creates winner’s-curse optimism. More metrics do not remove this selection bias. Use a locked test that is untouched by all 40 choices, or a nested evaluation whose outer folds estimate the full selection procedure.
- Compare systems on the same held-out units with paired differences. Resampling should follow the target sampling design (for example, papers when papers are the independent target units). If the same queries recur across multiple papers, papers and queries may form crossed dependence dimensions: a paper-only bootstrap then quantifies uncertainty conditional on the observed queries, but not necessarily uncertainty over their population. If generalization over both dimensions is required, use a design and method that reflect both (for example, multiway or hierarchical resampling). Few clusters yield unstable uncertainty estimates; state that limitation rather than implying precision.
- Record corpus/version and licence, query and paper IDs, label definition, inclusion rules, split assignments, random seeds, code and dependency versions, all 40 configurations, selection metric, final metric, uncertainty method, exclusions, and error analysis.
Self-assessment
Score each answer 0 (incorrect/absent), 1 (partially correct), or 2 (justified and includes a relevant limitation). Record confidence before consulting the checklist. A correct term without the assumptions, independent unit, or consequence for the protocol is only partial evidence.
The score is a learning diagnostic, not a certification of mastery.
References
- HELM — Holistic Evaluation of Language Models
- Scikit-learn: average precision
- Scikit-learn: grouped cross-validation
- Scikit-learn: nested versus non-nested cross-validation
- Dror et al. — The Hitchhiker’s Guide to Testing Statistical Significance in NLP
This is a teaching exercise, not a benchmark or research result.