Dataset Lineage and Provenance › Evaluation Provenance and Contamination
Language AI HandbookAll chapters Record the benchmark edition, split and any sampled subset with the prompt template, decoding configuration and scoring code. This identifies the examples and protocol behind a reported score. Exposure to benchmark content during training can inflate its score. The toy screen below measures literal five-gram overlap before packing.
We construct two positive controls from the retained transit document. The first copies it in full, and the second copies one sentence. The third example uses unrelated text as a negative control. The check compares their five-grams with those in the retained documents before packing.
where:
- : an evaluation example
- : the set of training documents
- : the set of contiguous 5-grams in the evaluation example
- : the set of contiguous 5-grams in training document
- : the union of all 5-grams appearing in any training document
- : the number of elements in a set
The numerator counts the evaluation 5-grams that also appear in training; the denominator is the total number of evaluation 5-grams. The result is a fraction between 0 and 1 for a nonempty evaluation five-gram set. When the set is empty, the fixture uses zero for its report, which indicates no available five-gram comparison. A paraphrase, translation, or code rewrite can evade exact matching when it preserves no five-grams. Common phrases can create matches without demonstrating that evaluation data entered training. Use the result to decide which examples need inspection.
PythonIn [27]Expand
eval_examples = [
{
"eval_id": "eval-001",
"task": "transit",
"text": raw_docs[0]["text"],
},
{
"eval_id": "eval-002",
"task": "transit",
"text": "The plan adds bus lanes and extends service hours across the region.",
},
{
"eval_id": "eval-003",
"task": "cooking",
"text": "A recipe for lentil soup with carrots and thyme.",
},
]
N_EVAL = 5
REVIEW_OVERLAP_THRESHOLD = 0.2
train_ngrams = set()
train_ngram_sources = defaultdict(set)
for doc in kept:
toks = doc_tokens[doc["doc_id"]]
for i in range(len(toks) - N_EVAL + 1):
ngram = tuple(toks[i : i + N_EVAL])
train_ngrams.add(ngram)
train_ngram_sources[ngram].add(doc["doc_id"])
contam_rows = []
for example in eval_examples:
toks = tokenize(example["text"])
eval_ngrams = {
tuple(toks[i : i + N_EVAL])
for i in range(max(0, len(toks) - N_EVAL + 1))
}
hits = eval_ngrams & train_ngrams
overlap = len(hits) / len(eval_ngrams) if eval_ngrams else 0.0
source_docs = set()
for ngram in hits:
source_docs |= train_ngram_sources[ngram]
contam_rows.append(
{
"eval_id": example["eval_id"],
"task": example["task"],
"eval_ngrams": len(eval_ngrams),
"matched_ngrams": len(hits),
"overlap_fraction": overlap,
"source_docs": sorted(source_docs),
"status": "flag_for_review"
if overlap > REVIEW_OVERLAP_THRESHOLD
else "below_threshold",
}
)
contam_df = pd.DataFrame(contam_rows)| eval_id | task | eval_ngrams | matched_ngrams | overlap_fraction | source_docs | status | |
|---|---|---|---|---|---|---|---|
| 0 | eval-001 | transit | 20 | 20 | 1.0 | [doc-6bd4bf650451] | flag_for_review |
| 1 | eval-002 | transit | 9 | 9 | 1.0 | [doc-6bd4bf650451] | flag_for_review |
| 2 | eval-003 | cooking | 6 | 0 | 0.0 | [] | below_threshold |
All five-grams in both constructed positive controls appear in the retained transit document. The unrelated control has zero overlap. The controls exercise the screen without estimating leakage or performance for a benchmark edition or split. For a real benchmark, state which examples were screened and inspect matches across n-gram lengths and at sentence or document granularity where appropriate. Check task-specific artifacts such as answer formatting, prompt overlap, and label leakage separately.
The fixture flags overlap strictly above 0.2 for review and returns the matching document IDs. A low score leaves other forms of leakage open. In an audit, use these IDs to join to ingestion records and look for source, license, or consent evidence. The separate document trace below illustrates the lookup for the redacted web-006 item.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!