Provenance, duplicates and contamination
Record where every row came from, deduplicate before you split, audit the split for copies and shared groups, and treat a pretrained model's exposure to your benchmark as unknown until shown otherwise.
What runs in CodeSplash
- EVA057Benchmark contamination and Min-K% likelihood diagnostics Runs in CodeSplash
- N-gram language model perplexity Not verified yet
You will be able to
- List what a dataset manifest and a datasheet record, and why
- Treat annotations as measurements with their own error
- Read Predict's split integrity report and fix what it flags
- Explain what Min-K% Prob can and can't say about contamination
Where did each row come from?
ReadBefore any model, record how the data was collected, changed, labeled and permitted to be used. A usable manifest names the source, retrieval date, version, content hashes where you can, the population it covers, what was excluded, known sampling distortions and every transformation since.
Keep raw data and derived tables apart. When a benchmark arrives as a "cleaned copy", record the cleaning and how it relates to the original. The test is traceability: another person should be able to say why a row is present, how it was labeled and why it sits in its split, without reading your code.
A datasheet in Insights
In the appCodeSplash keeps a Datasheet for each dataset on its Insights page, following Datasheets for Datasets: Motivation ("Why was the dataset made, by whom, and for which task?"), Composition, Collection, Cleaning and labeling, Distribution, Maintenance, License and Test contamination ("How it was checked, against which data").
The fields are advisory: they never block an export or a model. A registered model's card quotes the training dataset's datasheet, so the record travels with the model.
Labels are measurements
ReadA label is an observation with error, not the truth. Write down the rubric, the ambiguous cases, how many annotators saw each item, how disagreements were settled and whether annotators saw model predictions first.
Agreement between annotators doesn't prove they are right: they can share a misconception. Keep genuine disagreement as information rather than forcing one label.
Label noise, class imbalance, censoring and missing values are four different problems. A class weight changes the training objective; it doesn't add rare events. A right-censored time isn't an ordinary missing value.
Deduplicate before you split
ReadIf copies or near copies can cross the split, the test score partly measures memory. Deduplicate first, then split. Keep legitimate repeated measurements by grouping them, rather than deleting them.
| Data | Hidden overlap | Split boundary |
|---|---|---|
| Clinical visits | Same patient, repeated lab results | Patient, sometimes hospital and time too |
| Speech | Speaker, microphone, room, session | Speaker or session |
| Video | Adjacent frames, edited copies | Original video or event |
| Documents | Translations, versions, shared passages | Document or source family |
| Sensors | Overlapping windows of one run | Machine or run, forward in time |
Look at what deduplication removes: it can drop rare dialects or templates more than common ones.
The split integrity report
In the appPredict's Validation step runs a Split integrity report on the plan. Its checks, worst first:
- Exact copies across the split: identical rows.
- Near copies across the split: rows with a token Jaccard of 0.9 or more.
- Groups on both sides of the split: one person, store or site on both sides (bind Groups in Setup).
- Judged on the past: test rows earlier than training rows (needs a time order column).
- Features that give the target away: columns that predict the target suspiciously well.
- Classes missing from training: a fold or the final model has no rows of a class.
Each check reads "No issue", "Check this", "Problem" or "Not checked", with the rows involved; Insights shows them too.
Did the pretrained model see the test?
ReadPretraining contaminationPretraining contaminationA pretrained model may have seen a benchmark, or a paraphrase, before your experiment. If you can't check, the status is unknown, not clean. is a separate problem from your own leakage. A foundation model may have read the benchmark, a paraphrase of it or a worked solution long before your experiment. Record the model's disclosed training data and cutoff date, the benchmark's publication date and any check you could actually run.
For a closed or poorly documented model, mark contamination unknown, not clean. Fresh, private or later evaluation items help, though new doesn't automatically mean representative.
Reference · EVA057 · Runs in CodeSplashBenchmark contamination and Min-K% likelihood diagnosticsInvestigates whether evaluation content may overlap training using provenance, duplicate detection, and calibrated likelihood diagnostics.Min-K% Prob
ExploreMin-K% ProbMin-K% ProbThe mean log-probability of a text's least likely K% of tokens; higher means the model may have seen the text. scores each text by the mean log-probability of its least likely K% of tokens. Text a model trained on tends to have fewer surprising tokens, so its score sits closer to zero.
GPT-2 small: perplexity 76.7 per token on 15 rows (6.26 bits per token); mean Min-20% log-probability -8.33.
- Perplexity per token
- 76.702
- Bits per token
- 6.261
- Perplexity per word
- 95.290
- Mean Min-20% log-probability
- −8.332
Plots
Higher (closer to 0) means GPT-2 finds even the text's least likely tokens predictable, as with text it saw in training.
View data
| Min-20% log-probability |
|---|
| −9.521 |
| −9.969 |
| −9.791 |
| −7.793 |
| −9.920 |
| −5.870 |
| −7.779 |
| −6.199 |
| −7.136 |
| −9.309 |
| −6.581 |
| −8.574 |
| −8.269 |
| −9.115 |
| −9.149 |
Assumptions
- Scored on held-out rows — GPT-2 small was not fitted to these rows: it was trained on WebText (English web pages, up to 2019). Rows marked "test" in split are summarized; the others are shown as training rows. A text that was in WebText looks more predictable than new text; Min-K% helps spot it.
- Same words and vocabulary — Perplexity here is per GPT-2 token, so compare it only with other GPT-2 perplexities. Word perplexity (per word, as the Words setting splits text) is closer to an n-gram model's, but not equal.
- Rows are independent — The interval resamples whole rows; repeated or threaded rows make it too narrow.
Least predictable rows
| Row | Tokens | Bits per token | Min-20% log-probability |
|---|---|---|---|
| 56 | 10 | 7.858 | −9.115 |
| 20 | 11 | 7.725 | −9.920 |
| 60 | 9 | 7.463 | −9.149 |
| 4 | 12 | 7.338 | −9.521 |
| 40 | 11 | 6.847 | −9.309 |
| 8 | 10 | 6.501 | −9.969 |
| 52 | 10 | 6.351 | −8.269 |
| 12 | 13 | 6.292 | −9.791 |
| 28 | 12 | 6.175 | −7.779 |
| 44 | 10 | 6.060 | −6.581 |
Most familiar rows (highest Min-K%)
| Row | Tokens | Min-20% log-probability | Bits per token |
|---|---|---|---|
| 24 | 15 | −5.870 | 4.697 |
| 32 | 12 | −6.199 | 4.584 |
| 44 | 10 | −6.581 | 6.060 |
| 36 | 12 | −7.136 | 5.510 |
| 28 | 12 | −7.779 | 6.175 |
| 16 | 11 | −7.793 | 5.557 |
| 52 | 10 | −8.269 | 6.351 |
| 48 | 10 | −8.574 | 6.006 |
| 56 | 10 | −9.115 | 7.858 |
| 60 | 9 | −9.149 | 7.463 |
- 1 rows have no text or no training/test label (or no words) and are left out.
The exact R script · R R version 4.5.1 (2025-06-13)
# N-gram language model perplexity
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.perplexity 1.1.1 · spec 7221e90eafd4cb1c
# Dataset: txt1_lm (version 1)
# Runs on its own: outside the app, cs_publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
library(codesplashr)
# %% Rows: text present (and a training/test label when that column is used), at least one word
TEXT <- "text"
SPLIT <- "split"
TOKENS <- "words"
LOWER <- TRUE
df <- as.data.frame(nanoparquet::read_parquet("tests/parity/fixtures/txt1_lm.parquet", col_select = c(TEXT, SPLIT)))
warnings <- list()
ok <- !is.na(df[[TEXT]])
if (!is.null(SPLIT)) ok <- ok & !is.na(df[[SPLIT]])
words_all <- vapply(seq_len(nrow(df)), function(i) if (ok[i]) length(cs_lm_tokenize(as.character(df[[TEXT]][i]), TOKENS, LOWER)) else 0L, integer(1))
rows <- which(ok & words_all > 0)
n_dropped <- nrow(df) - length(rows)
if (n_dropped) warnings <- c(warnings, sprintf("%d rows have no text%s (or no words) and are left out.", n_dropped, if (!is.null(SPLIT)) " or no training/test label" else ""))
if (!length(rows)) cs_error("CS_E_NO_ROWS") # no row has any words
# %% Rows summarized: those marked with the test label; without a training/test column, every row (nothing is fitted)
SEED <- 42
if (!is.null(SPLIT)) {
TEST_LEVEL <- "test"
is_test <- as.character(df[[SPLIT]][rows]) == TEST_LEVEL
if (all(is_test) || !any(is_test)) cs_error("CS_E_TOO_FEW_GROUPS", column = SPLIT, min = 2, k = 1) # needs rows on both sides
} else {
is_test <- rep(TRUE, length(rows))
}
# %% GPT-2 small (cs_gpt2_* ↔ codesplash.text.gpt2): log-probability of every token after <|endoftext|>
MODEL <- cs_gpt2_load() # stops with CS_WEIGHTS_MISSING when GPT-2 isn't downloaded
K <- 20
lp_row <- numeric(length(rows)); n_row <- numeric(length(rows)); mk_row <- numeric(length(rows)); cut_row <- logical(length(rows))
for (j in seq_along(rows)) {
s <- cs_gpt2_token_logprobs(as.character(df[[TEXT]][rows[j]]), MODEL)
lp_row[j] <- sum(s$lp)
n_row[j] <- s$n
mk_row[j] <- cs_gpt2_min_k(s$lp, K)
cut_row[j] <- s$cut
}
words <- as.numeric(words_all[rows])
te <- is_test; tr <- !is_test
ppl <- cs_lm_perplexity(lp_row[te], n_row[te])
train_ppl <- if (any(tr)) cs_lm_perplexity(lp_row[tr], n_row[tr]) else NULL
n_cut <- sum(cut_row)
# %% Bootstrap over the summarized rows (shared Wichmann-Hill stream)
B <- 200
CONF <- 0.95
lo <- NULL; hi <- NULL
if (B > 0) {
reps <- cs_lm_bootstrap(lp_row[te], n_row[te], B, SEED + 1)
ci <- cs_tm_percentile_ci(reps, CONF)
lo <- ci[1]; hi <- ci[2]
}
# %% Artifacts: one row per input row
out <- cs_ml_out_dir("target/academy-parity/run-8142/evaluate.perplexity/gpt2_split/out-r")
nanoparquet::write_parquet(data.frame(row = as.integer(rows - 1L), split = ifelse(is_test, "test", "train"), tokens = as.integer(n_row),
words = as.integer(words), logprob = lp_row, perplexity = exp(-lp_row / n_row), min_k = mk_row),
file.path(out, "scores.parquet"))
# %% Result
values <- list(
n_train = sum(tr), n_test = sum(te), n_dropped = n_dropped,
train_tokens = sum(n_row[tr]), test_tokens = sum(n_row[te]),
vocab_size = NULL, oov_rate = NULL, order = NULL, smoothing = NULL, # n-gram settings: none for GPT-2
perplexity = ppl, perplexity_ci_low = lo, perplexity_ci_high = hi, cross_entropy = log2(ppl),
train_perplexity = train_ppl,
lm_name = "GPT-2 small", lm_word_perplexity = exp(-sum(lp_row[te]) / sum(words[te])),
lm_min_k = mean(mk_row[te]), lm_train_min_k = if (any(tr)) mean(mk_row[tr]) else NULL,
lm_min_k_percent = K, lm_truncated = n_cut
)
for (k in c("vocab_size", "oov_rate", "order", "smoothing", "perplexity_ci_low", "perplexity_ci_high", "train_perplexity", "lm_train_min_k"))
if (is.null(values[[k]])) values[k] <- list(NULL)
scored <- if (!is.null(SPLIT)) sprintf("Rows marked \"%s\" in %s are summarized; the others are shown as training rows.", TEST_LEVEL, SPLIT) else "Every row is summarized."
assumptions <- list(
list(key = "held_out", label = "Scored on held-out rows", status = "info",
detail = sprintf("GPT-2 small was not fitted to these rows: it was trained on WebText (English web pages, up to 2019). %s A text that was in WebText looks more predictable than new text; Min-K%% helps spot it.", scored)),
list(key = "same_vocabulary", label = "Same words and vocabulary", status = "info",
detail = "Perplexity here is per GPT-2 token, so compare it only with other GPT-2 perplexities. Word perplexity (per word, as the Words setting splits text) is closer to an n-gram model's, but not equal."),
list(key = "rows_independent", label = "Rows are independent", status = "info",
detail = "The interval resamples whole rows; repeated or threaded rows make it too narrow.")
)
if (n_cut) warnings <- c(warnings, sprintf("%d texts are longer than 1,023 GPT-2 tokens; only their first 1,023 tokens are scored.", n_cut))
bits <- (-lp_row / n_row) / log(2)
idx <- which(te)
top <- head(idx[order(-bits[idx], idx, method = "radix")], 10)
surprise_rows <- lapply(top, function(j) list(row = as.integer(rows[j]), tokens = as.integer(n_row[j]), bits = bits[j], min_k = mk_row[j]))
fam <- head(idx[order(-mk_row[idx], idx, method = "radix")], 10)
familiar_rows <- lapply(fam, function(j) list(row = as.integer(rows[j]), tokens = as.integer(n_row[j]), min_k = mk_row[j], bits = bits[j]))
mk_label <- sprintf("Min-%g%% log-probability", K)
cols <- list(list(key = "row", label = "Row", type = "number"), list(key = "tokens", label = "Tokens", type = "number"),
list(key = "bits", label = "Bits per token", type = "number"), list(key = "min_k", label = mk_label, type = "number"))
fam_cols <- cols[c(1, 2, 4, 3)]
charts <- list(cs_chart("min_k", "histogram", sprintf("Min-%g%% log-probability per text", K), list(x = cs_col(mk_label, mk_row[te])),
note = "Higher (closer to 0) means GPT-2 finds even the text's least likely tokens predictable, as with text it saw in training."))
cs_publish(list(
title = "N-gram language model perplexity",
engine = cs_engine_info("codesplashr", "nanoparquet"),
n = length(rows),
summary = sprintf("GPT-2 small: perplexity %.1f per token on %d rows (%.2f bits per token); mean Min-%g%% log-probability %.2f.", ppl, sum(te), log2(ppl), K, values$lm_min_k),
statistics = list(
list(key = "perplexity", label = "Perplexity per token", value = ppl),
list(key = "cross_entropy", label = "Bits per token", value = values$cross_entropy),
list(key = "lm_word_perplexity", label = "Perplexity per word", value = values$lm_word_perplexity),
list(key = "lm_min_k", label = sprintf("Mean Min-%g%% log-probability", K), value = values$lm_min_k)
),
tables = list(
list(key = "surprising", title = "Least predictable rows", columns = cols, rows = surprise_rows),
list(key = "familiar", title = "Most familiar rows (highest Min-K%)", columns = fam_cols, rows = familiar_rows)
),
assumptions = assumptions,
charts = charts,
values = values,
warnings = warnings,
artifacts = list(list(key = "scores", path = file.path(out, "scores.parquet"), format = "parquet"))
))
GPT-2 small: perplexity 76.7 per token on 15 rows (6.26 bits per token); mean Min-20% log-probability -8.33.
- Perplexity per token
- 76.702
- Bits per token
- 6.261
- Perplexity per word
- 95.290
- Mean Min-20% log-probability
- −8.332
To keep this page light, the plots are shown once, under the R tab.
Assumptions
- Scored on held-out rows — GPT-2 small was not fitted to these rows: it was trained on WebText (English web pages, up to 2019). Rows marked "test" in split are summarized; the others are shown as training rows. A text that was in WebText looks more predictable than new text; Min-K% helps spot it.
- Same words and vocabulary — Perplexity here is per GPT-2 token, so compare it only with other GPT-2 perplexities. Word perplexity (per word, as the Words setting splits text) is closer to an n-gram model's, but not equal.
- Rows are independent — The interval resamples whole rows; repeated or threaded rows make it too narrow.
Least predictable rows
| Row | Tokens | Bits per token | Min-20% log-probability |
|---|---|---|---|
| 56 | 10 | 7.858 | −9.115 |
| 20 | 11 | 7.725 | −9.920 |
| 60 | 9 | 7.463 | −9.149 |
| 4 | 12 | 7.338 | −9.521 |
| 40 | 11 | 6.847 | −9.309 |
| 8 | 10 | 6.501 | −9.969 |
| 52 | 10 | 6.351 | −8.269 |
| 12 | 13 | 6.292 | −9.791 |
| 28 | 12 | 6.175 | −7.779 |
| 44 | 10 | 6.060 | −6.581 |
Most familiar rows (highest Min-K%)
| Row | Tokens | Min-20% log-probability | Bits per token |
|---|---|---|---|
| 24 | 15 | −5.870 | 4.697 |
| 32 | 12 | −6.199 | 4.584 |
| 44 | 10 | −6.581 | 6.060 |
| 36 | 12 | −7.136 | 5.510 |
| 28 | 12 | −7.779 | 6.175 |
| 16 | 11 | −7.793 | 5.557 |
| 52 | 10 | −8.269 | 6.351 |
| 48 | 10 | −8.574 | 6.006 |
| 56 | 10 | −9.115 | 7.858 |
| 60 | 9 | −9.149 | 7.463 |
- 1 rows have no text or no training/test label (or no words) and are left out.
The exact Python script · Python Python 3.13.5 · scipy 1.18.1 · pandas 3.1.0
# N-gram language model perplexity
# Generated by CodeSplash Analytics 1.0.0 on 2026-11-09 · method evaluate.perplexity 1.1.1 · spec 7221e90eafd4cb1c
# Dataset: txt1_lm (version 1)
# Runs on its own: outside the app, cs.publish() writes $CS_RESULT_PATH or prints the result JSON.
# %% Setup
import math
import os
import numpy as np
import pandas as pd
import codesplash as cs
from codesplash import ml as csml
from codesplash.text import gpt2
from codesplash.text import metrics as tm
from codesplash.text import ngram_lm as lm
# %% Rows: text present (and a training/test label when that column is used), at least one word
TEXT = "text"
SPLIT = "split"
TOKENS = "words"
LOWER = True
df = pd.read_parquet("tests/parity/fixtures/txt1_lm.parquet", columns=[TEXT] + ([SPLIT] if SPLIT else []))
warnings = []
ok = df[TEXT].notna().to_numpy()
if SPLIT:
ok = ok & df[SPLIT].notna().to_numpy()
words_all = [len(lm.tokenize(t, TOKENS, LOWER)) if o else 0 for t, o in zip(df[TEXT], ok)]
rows = np.array([i for i in range(len(df)) if ok[i] and words_all[i] > 0], dtype=int)
n_dropped = len(df) - len(rows)
if n_dropped:
warnings.append(f"{n_dropped} rows have no text{' or no training/test label' if SPLIT else ''} (or no words) and are left out.")
if not len(rows):
cs.cs_error("CS_E_NO_ROWS") # no row has any words
# %% Rows summarized: those marked with the test label; without a training/test column, every row (nothing is fitted)
SEED = 42
if SPLIT:
TEST_LEVEL = "test"
is_test = np.array([str(v) == TEST_LEVEL for v in df[SPLIT].iloc[rows]])
if is_test.all() or not is_test.any():
cs.cs_error("CS_E_TOO_FEW_GROUPS", column=SPLIT, min=2, k=1) # needs rows on both sides
else:
is_test = np.ones(len(rows), dtype=bool)
# %% GPT-2 small (codesplash.text.gpt2 ↔ codesplashr cs_gpt2_*): log-probability of every token after <|endoftext|>
MODEL = gpt2.Model() # stops with CS_WEIGHTS_MISSING when GPT-2 isn't downloaded
K = 20
lp_row, n_row, mk_row, cut_row = [], [], [], []
for i in rows:
t_lp, t_n, t_cut = gpt2.token_logprobs(str(df[TEXT].iloc[i]), MODEL)
lp_row.append(float(np.sum(t_lp)))
n_row.append(t_n)
mk_row.append(gpt2.min_k(t_lp, K))
cut_row.append(t_cut)
lp_row, n_row, mk_row = np.array(lp_row), np.array(n_row, dtype=float), np.array(mk_row, dtype=float)
words = np.array([words_all[i] for i in rows], dtype=float)
te, tr = is_test, ~is_test
ppl = lm.perplexity(lp_row[te], n_row[te])
train_ppl = lm.perplexity(lp_row[tr], n_row[tr]) if tr.any() else None
n_cut = int(sum(cut_row))
# %% Bootstrap over the summarized rows (shared Wichmann–Hill stream)
B = 200
CONF = 0.95
lo = hi = None
if B > 0:
reps = lm.bootstrap_ppl(lp_row[te], n_row[te], B, SEED + 1)
lo, hi = tm.percentile_ci(reps, CONF)
# %% Artifacts: one row per input row
out = csml.out_dir("target/academy-parity/run-8142/evaluate.perplexity/gpt2_split/out-python")
pd.DataFrame({
"row": rows.astype(int), "split": np.where(is_test, "test", "train"), "tokens": n_row.astype(int), "words": words.astype(int),
"logprob": lp_row, "perplexity": np.exp(-lp_row / n_row), "min_k": mk_row,
}).to_parquet(os.path.join(out, "scores.parquet"), index=False)
# %% Result
values = {
"n_train": int(tr.sum()), "n_test": int(te.sum()), "n_dropped": n_dropped,
"train_tokens": int(n_row[tr].sum()), "test_tokens": int(n_row[te].sum()),
"vocab_size": None, "oov_rate": None, "order": None, "smoothing": None, # n-gram settings: none for GPT-2
"perplexity": ppl, "perplexity_ci_low": lo, "perplexity_ci_high": hi, "cross_entropy": math.log2(ppl),
"train_perplexity": train_ppl,
"lm_name": "GPT-2 small", "lm_word_perplexity": math.exp(-float(np.sum(lp_row[te])) / float(np.sum(words[te]))),
"lm_min_k": float(np.mean(mk_row[te])), "lm_train_min_k": float(np.mean(mk_row[tr])) if tr.any() else None,
"lm_min_k_percent": K, "lm_truncated": n_cut,
}
scored = (f'Rows marked "{TEST_LEVEL}" in {SPLIT} are summarized; the others are shown as training rows.' if SPLIT else "Every row is summarized.")
assumptions = [
{"key": "held_out", "label": "Scored on held-out rows", "status": "info",
"detail": f"GPT-2 small was not fitted to these rows: it was trained on WebText (English web pages, up to 2019). {scored} A text that was in WebText looks more predictable than new text; Min-K% helps spot it."},
{"key": "same_vocabulary", "label": "Same words and vocabulary", "status": "info",
"detail": "Perplexity here is per GPT-2 token, so compare it only with other GPT-2 perplexities. Word perplexity (per word, as the Words setting splits text) is closer to an n-gram model's, but not equal."},
{"key": "rows_independent", "label": "Rows are independent", "status": "info",
"detail": "The interval resamples whole rows; repeated or threaded rows make it too narrow."},
]
if n_cut:
warnings.append(f"{n_cut} texts are longer than 1,023 GPT-2 tokens; only their first 1,023 tokens are scored.")
bits = (-lp_row / n_row) / math.log(2)
idx = [int(j) for j in np.flatnonzero(te)]
top = sorted(idx, key=lambda j: (-bits[j], j))[:10]
surprise_rows = [{"row": int(rows[j]) + 1, "tokens": int(n_row[j]), "bits": float(bits[j]), "min_k": float(mk_row[j])} for j in top]
fam = sorted(idx, key=lambda j: (-mk_row[j], j))[:10]
familiar_rows = [{"row": int(rows[j]) + 1, "tokens": int(n_row[j]), "min_k": float(mk_row[j]), "bits": float(bits[j])} for j in fam]
cols = [{"key": "row", "label": "Row", "type": "number"}, {"key": "tokens", "label": "Tokens", "type": "number"},
{"key": "bits", "label": "Bits per token", "type": "number"}, {"key": "min_k", "label": f"Min-{K:g}% log-probability", "type": "number"}]
fam_cols = [cols[0], cols[1], cols[3], cols[2]]
charts = [cs.chart("min_k", "histogram", f"Min-{K:g}% log-probability per text", {"x": cs.col(f"Min-{K:g}% log-probability", mk_row[te])},
note="Higher (closer to 0) means GPT-2 finds even the text's least likely tokens predictable, as with text it saw in training.")]
cs.publish({
"title": "N-gram language model perplexity",
"engine": cs.engine_info("numpy", "pandas"),
"n": len(rows),
"summary": f"GPT-2 small: perplexity {ppl:.1f} per token on {int(te.sum())} rows ({math.log2(ppl):.2f} bits per token); mean Min-{K:g}% log-probability {values['lm_min_k']:.2f}.",
"statistics": [
{"key": "perplexity", "label": "Perplexity per token", "value": ppl},
{"key": "cross_entropy", "label": "Bits per token", "value": values["cross_entropy"]},
{"key": "lm_word_perplexity", "label": "Perplexity per word", "value": values["lm_word_perplexity"]},
{"key": "lm_min_k", "label": f"Mean Min-{K:g}% log-probability", "value": values["lm_min_k"]},
],
"tables": [
{"key": "surprising", "title": "Least predictable rows", "columns": cols, "rows": surprise_rows},
{"key": "familiar", "title": "Most familiar rows (highest Min-K%)", "columns": fam_cols, "rows": familiar_rows},
],
"assumptions": assumptions,
"charts": charts,
"values": values,
"warnings": warnings,
"artifacts": [{"key": "scores", "path": os.path.join(out, "scores.parquet"), "format": "parquet"}],
})
Here GPT-2 small scores two splits of a small corpus of sentences written for CodeSplash's tests, years after GPT-2 was trained. The training rows' mean Min-20% log-probability is −8.08 and the held-out rows' is −8.33. Neither split can have been in GPT-2's training, so the gap is ordinary variation between two sets of texts. That is the point: a Min-K% score means something only next to matched controls of known status.
What a scan can't prove
ReadMin-K% is a likelihood diagnostic, not proof. Unusual wording, a later time period or harder texts can look like "never seen". Removing exact duplicates leaves paraphrases. Audit lineage and near duplicates first, then compare likelihood scores against controls matched on domain, time, length and difficulty, and report the error rates and uncertainty.
Check: provenance and contamination
CheckpointCheck yourself
When should near-duplicate rows be found and handled?
Show the answer
Answer: a
Copies that cross the split let the model score by memory. Handle them first; group real repeated measurements rather than deleting them.
Check yourself
The split integrity report says "Groups on both sides of the split" for a customer column. What does that mean for the test score?
Show the answer
Answer: b
A model can learn a customer's habits from their training rows and reuse them on the same customer's test rows, which won't happen for new customers.
Check yourself
Three annotators agree on almost every label. What does that establish?
Show the answer
Answer: b
Agreement measures consistency, not truth. A shared misreading of the rubric gives perfect agreement on wrong labels.
Check yourself
You evaluate a closed language model whose training data isn't disclosed. What contamination status should the report give?
Show the answer
Answer: b
Without disclosed training data you can't rule exposure out. Say unknown, list what you checked, and add fresh or later items where you can.
Check yourself
A text's Min-20% log-probability under a model is close to zero. What can you conclude on its own?
Show the answer
Answer: c
Easy, common wording also scores near zero. Compare against texts known to be in and out of training, matched on domain, time, length and difficulty.
Check yourself
You removed every exact copy of the benchmark from your fine-tuning data. Which risk remains?
Show the answer
Answer: b
Exact-match removal misses paraphrases and translations, and it says nothing about what the pretrained model read before you started.
Check yourself
A team adds class weights "to fix" a rare outcome with 40 events. What did the weights change?
Show the answer
Answer: b
Weights change how errors are counted during training. The evidence about the rare outcome is still 40 events, and weighted probabilities usually need recalibration.
Recap
Recap- Record source, version, hashes, population, exclusions and every transformation; keep a datasheet.
- Labels are measurements: document the rubric and keep real disagreement.
- Deduplicate and group before splitting; Predict's split integrity report checks copies, near copies, shared groups, time order, target leaks and classes missing from training.
- Pretraining exposure is unknown until checked; Min-K% Prob needs matched controls and can't prove membership.
Concepts in this lesson