NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Training on the Test Model: Contamination in Ranking Distillation

Vishakha Suresh Kalal, Andrew Parry, Sean MacAvaneyarXiv 2024

TL;DR

Distilling knowledge from powerful, closed-source Large Language Models (LLMs) into smaller, production-ready ranking models is a popular way to cut computational costs. However, this paper reveals a hidden danger: if a black-box teacher model has been contaminated with test data, that contamination easily leaks into the student model during distillation, artificially inflating evaluation scores. Crucially, this leakage occurs even when using order-based distillation methods that don't have access to the teacher's explicit probability scores.

What Problem Does This Paper Address?

Neural ranking models are highly effective for search tasks but are often too computationally expensive to run in production. To solve this, researchers use knowledge distillation (KD), where a smaller "student" model is trained to mimic a high-performing "teacher" model (often a commercial LLM like GPT-4).

The catch? Most commercial LLMs are black boxes with proprietary, opaque training datasets. It is highly possible that these models have already "seen" standard evaluation benchmarks during their pre-training or fine-tuning phases—a phenomenon known as data contamination.

The authors set out to answer a critical question: If a teacher model is contaminated with a test set, does that contamination transfer to the student model during distillation? If so, our public benchmarks might just be measuring leaked data rather than genuine algorithmic improvements.

Methods

To investigate this, the authors simulated a "worst-case scenario" where the exact test data is known to be part of the teacher's training set.

  1. Contaminating the Teacher: They took an ELECTRA-based cross-encoder (the teacher) and explicitly trained it on binarized query-document pairs from common test sets using a cross-entropy loss function (Localized Contrastive Estimation).
  2. Distilling to the Student: They then trained student models (ELECTRA cross-encoders and BERT bi-encoders) using the contaminated teacher's signals across three common distillation loss criteria:
  3. MarginMSE: Optimizes the score margin between positive and negative document pairs.
  4. KL Divergence: Aligns the full score distributions between teacher and student.
  5. RankNet: An order-based loss that minimizes ranking errors. This is particularly important because it only requires the relative order of documents, mimicking how researchers distill from commercial LLMs that only output text rankings without explicit logit scores.

Datasets

  • MSMARCO Passage Collection: The primary training corpus, containing over 8.8 million passages mined from Bing query logs.
  • TREC Deep Learning (DL) 2019 & 2020: Densely annotated query sets used for in-distribution (ID) evaluation and contamination.
  • TREC COVID: A specialized medical dataset used to evaluate out-of-distribution (OOD) contamination effects.

Key Insights and Ideas

  • Contamination is Highly Contagious: Even when the leaked test data makes up less than 0.1% of the total training examples, student models consistently absorb this bias and show inflated performance on the target benchmark.
  • Hiding Logits Won't Save You: You might think that restricting a student's access to raw teacher scores (logits) by using list-wise or pairwise text ordering (like RankNet) would prevent leakage. Surprisingly, the authors found that RankNet distillation led to the largest disparities in distilled effectiveness, making it highly susceptible to passing on contamination.
  • The Sneakiness of Cross-Contamination: Contaminating the teacher with an out-of-distribution dataset (like TREC COVID) didn't just improve student performance on COVID queries; it also boosted performance on completely unrelated in-distribution datasets (TREC DL). This means a teacher contaminated on Dataset A can secretly inflate a student's performance on Dataset B.

Key Results

  • Direct Teacher Inflation: Directly contaminating the teacher model (LCE 💀) caused its nDCG@10 on TREC COVID to jump from 0.590 to 0.746.
  • Downstream Student Leakage: When distilling the contaminated teacher into a cross-encoder student via RankNet, the student's nDCG@10 on TREC COVID rose significantly from 0.604 to 0.718.
Main distillation results showing performance inflation across various loss criteria.
  • Cross-Contamination Effects: As shown in Table 2, exposing the model to TREC COVID data actually improved its performance on the DL2019 benchmark (from 0.704 to 0.717), proving that out-of-distribution leakage can subtly warp standard evaluations.
Table 2: Comparing ranking effectiveness of student models in terms of nDCG@10 with different contamination sources. Each model was trained using KL-Divergence minimisation with its respective teacher.

Limitations and Future Work

While this paper establishes that contamination easily transfers through distillation, it focuses on a simulated "worst-case" scenario where the exact test text is fed to the teacher. In the wild, contamination might be more indirect, such as through paraphrased text or overlapping web scrapes.

Additionally, the authors noticed an anomaly: in the case of the DL2020 dataset, direct contamination actually degraded the teacher's standard performance, even though the signal was still strong enough to cause downstream student inflation. The authors leave the investigation of this specific edge case, alongside methods to detect and mitigate black-box teacher contamination, to future work.

Summary updated

BibTeX
@misc{kalal2024training,
  author = {Vishakha Suresh Kalal and Andrew Parry and Sean MacAvaney},
  title = {{Training on the Test Model: Contamination in Ranking Distillation}},
  year = {2024},
  eprint = {2411.02284},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.02284},
}

Loading related content...

Figure