Curating Training Data and Managing Feedback

Consider an illustrative scenario. A team fine-tunes a model to draft replies to support tickets. It exports a year of tickets, keeps the ones that were closed with a reply, splits them at random into training and evaluation sets, and trains. The evaluation score is excellent. Three weeks later, three problems appear on the same day. Many evaluation tickets turn out to be near-copies of training tickets, because customers often paste the same error message into several tickets. The labels that mark a reply as “good” came from a single agent’s thumbs-up habit. A customer asks that their tickets be deleted, and nobody can say which dataset version the deployed model was trained on or whether that customer’s text is in it.

None of these is a modeling mistake. Each is a data-engineering gap: the dataset was treated as a query result and not as an artifact with a specification, an owner, a version, and obligations. This post covers the pipeline work that turns raw records and user feedback into training and evaluation data that can be defended. It covers sampling and labels, provenance and licensing, dataset versions, the quality of feedback, and the two ways data comes back to harm a project, contamination and privacy.

The previous post, Preserving Access Controls in Retrieval Data, follows permissions from source documents into retrieval copies. This post uses one idea from it: a copy of data carries the obligations of its source, and a pipeline has to record them because the copy will not. Training data differs from retrieval data in one way that matters here. Retrieval data is read at question time and can be removed from the index. Training data shapes model parameters, and removing a record from a later dataset does not change a model already trained on it. The reader is assumed to know the basics of supervised learning (features, labels, training and evaluation splits) and general data-pipeline practice. The statistical and annotation terms are explained where they are used.

A training set is an artifact with a specification

A dataset specification states what the data is supposed to represent and what it is allowed to be used for. Without one, every later decision is made by whoever happens to run the export. A useful specification answers six questions, and the rest of this post takes them in turn.

QuestionPipeline artifact that answers itWhere it appears below
Which population should the model serve, and which records can we actually select from?Sampling frame, selection method, inclusion probabilitiesSampling and labels
What does each label mean and how reliable is it?Labeling guideline version, annotator identity or source, agreement measureSampling and labels
Where did each record come from and what may be done with it?Per-source provenance and license or consent record, allowed usesProvenance and licensing
Exactly which records did a given model see?Immutable dataset version with manifest and fixed splitsDataset versions
Can the feedback we collect be trusted as a training signal?Feedback capture context, bias handling, audit sampleFeedback quality
Does evaluation data overlap training data, and does the data expose people?Overlap checks, redaction, retention and deletion rulesContamination and privacy

Sampling and labels

Population, frame, and selection method

Statistical sampling separates three things that are easy to blur: the population you want to describe, the frame you actually select from, and the selection method. For a support model, the intended population might be all tickets the product will see next year. The frame is the table of tickets that exist, which excludes customers who never wrote in and contains only tickets that reached the system. The method is how rows leave the frame for the dataset. Each gap between these three is a place where the dataset describes a different group from the one the model will meet, which is the pattern named by selection and nonresponse bias. A larger sample does not repair it, because the error is systematic and not random.

The common selection methods have different consequences for how the data can be used.

MethodHow rows are chosenGood forCost or risk
Simple randomEvery row has the same chanceUnbiased estimates of overall quality when the frame is rightRare classes may be almost absent, as the calculation below shows
StratifiedRows are drawn per stratum (class, product, language) at chosen ratesEnough examples of rare or important casesRates differ by stratum, so metrics need weights to describe the population
Grouped (cluster)Whole groups (a conversation, customer, document) are kept or dropped togetherPreventing near-copies of one group from landing on both sides of a splitFewer independent units than rows, so estimates are less certain
Time-basedOlder rows train, newer rows evaluateEstimating performance on data from after the training cutoffNeeds enough history; shifts in the product change what “new” means
Uncertainty or error drivenRows the current model finds hard are chosen for labelingSpending a labeling budget where it teaches the model mostBiased sample: fine for training, misleading as an estimate of overall quality

A rare class makes the size of the sample misleading

Suppose 2% of tickets in the population belong to a class you care about, such as account-security reports, and you draw 1,000 tickets at random. The expected number of examples is 1,000 ร— 0.02 = 20, with a standard deviation near 4.4 under a binomial model. The binomial probability of drawing fewer than 10 is about 0.5%, and of fewer than 15 about 10%. A dataset with 12 examples of the class is therefore not unusual, and a model trained or scored on it has almost nothing to learn or measure from.

The usual fix is stratification: select 500 examples of the class and 500 of everything else. That repairs the count and breaks the meaning of the metrics, because the sample now contains 50% of the class while the population contains 2%. Precision computed on the sample is not the precision the population will see. Weights restore the population mix: each class-positive row gets weight 0.02 / 0.5 = 0.04 and each other row gets 0.98 / 0.5 = 1.96, and evaluation metrics are computed with those weights. Selection probabilities have to be known to compute them, which is the reason probability sampling matters. Rows chosen by convenience or by someone’s judgment have unknown probabilities and cannot be reweighted honestly.

The script below is an explanatory simulation written for this post, using only the Python standard library. It repeats the random draw 2,000 times against a synthetic population of 100,000 rows to compare the simulated frequency with the binomial calculation. It then applies the weights to a hypothetical classifier that flags 90% of the class and 5% of everything else (assumed rates). The same script also computes two agreement calculations and a position-bias correction that appear later in this post, and each is explained where it is used. It was run with Python 3.12.

import random
from math import comb

random.seed(11)

# --- 1. Random vs stratified sampling of a rare class (synthetic population) ---
POP, PREV, N = 100_000, 0.02, 1000
labels = [1] * int(POP * PREV) + [0] * (POP - int(POP * PREV))

trials, low10, low15 = 2000, 0, 0
for _ in range(trials):
    pos = sum(random.sample(labels, N))
    low10 += pos < 10
    low15 += pos < 15
def binom_cdf(n, p, k):
    return sum(comb(n, i) * p**i * (1 - p)**(n - i) for i in range(k + 1))
print("random sample of 1000, 2% prevalence")
print(f"  simulated  P(<10 positives)={low10/trials:.4f}  P(<15)={low15/trials:.4f}")
print(f"  binomial   P(<10 positives)={binom_cdf(N,PREV,9):.4f}  P(<15)={binom_cdf(N,PREV,14):.4f}")

# Stratified: 500 positives + 500 negatives; weights restore the population mix.
w_pos, w_neg = (PREV) / 0.5, (1 - PREV) / 0.5
print(f"  stratified weights: positive={w_pos:.2f} negative={w_neg:.2f}")
# a classifier that flags 90% of positives and 5% of negatives (assumed rates)
tp, fp = 0.90, 0.05
unweighted_precision = (500 * tp) / (500 * tp + 500 * fp)
weighted_precision = (500 * w_pos * tp) / (500 * w_pos * tp + 500 * w_neg * fp)
print(f"  precision on the balanced sample, unweighted: {unweighted_precision:.3f}")
print(f"  precision after population weights:           {weighted_precision:.3f}")

# --- 2. Cohen's kappa for two annotators ---
def kappa(both_yes, a_yes_b_no, a_no_b_yes, both_no):
    n = both_yes + a_yes_b_no + a_no_b_yes + both_no
    po = (both_yes + both_no) / n
    pa, pb = (both_yes + a_yes_b_no) / n, (both_yes + a_no_b_yes) / n
    pe = pa * pb + (1 - pa) * (1 - pb)
    return po, pe, (po - pe) / (1 - pe)
print("Cohen's kappa")
for name, t in [("balanced labels", (40, 10, 10, 40)), ("one dominant label", (85, 5, 5, 5))]:
    po, pe, k = kappa(*t)
    print(f"  {name:20s} observed={po:.2f} expected={pe:.2f} kappa={k:.2f}")

# --- 3. Position-bias correction with assumed examination propensities ---
exam = {1: 0.60, 3: 0.20}      # assumed probability that a user looks at the rank
items = {"A": (1, 30, 100), "B": (3, 12, 100)}   # rank, clicks, impressions
print("clicks per impression vs propensity-corrected score")
for name, (rank, clicks, imps) in items.items():
    raw = clicks / imps
    print(f"  item {name} rank {rank}: raw={raw:.2f} corrected={raw / exam[rank]:.2f}")

The output of that run was:

random sample of 1000, 2% prevalence
  simulated  P(<10 positives)=0.0030  P(<15)=0.1030
  binomial   P(<10 positives)=0.0047  P(<15)=0.1025
  stratified weights: positive=0.04 negative=1.96
  precision on the balanced sample, unweighted: 0.947
  precision after population weights:           0.269
Cohen's kappa
  balanced labels      observed=0.80 expected=0.50 kappa=0.60
  one dominant label   observed=0.90 expected=0.82 kappa=0.44
clicks per impression vs propensity-corrected score
  item A rank 1: raw=0.30 corrected=0.50
  item B rank 3: raw=0.12 corrected=0.60

The simulated frequencies (0.30% below ten, 10.3% below fifteen) are close to the binomial values (0.47%, 10.25%). The small gap at the low end comes from sampling without replacement from a finite population and from running only 2,000 trials, so about three extra events in 2,000 trials account for the difference. The more important result is the precision pair. The unweighted precision on the balanced sample is 0.947, and after weighting to the population mix it is 0.269. With the assumed flag rates, the population contains 0.02 ร— 0.90 = 1.8% true flags and 0.98 ร— 0.05 = 4.9% false flags, so about 73% of the flags in production would be false. A report that quoted 0.947 would overstate production precision by a large factor. The numbers describe a hypothetical classifier on synthetic data, and the lesson is the mechanism: stratify to get enough examples, then weight to report population metrics.

Labels: definitions, sources, and agreement

A label is a decision made by a person, a rule, or a model, under a specific definition. Treating labels as ground truth hides that every label has a source and a guideline, and that both can change. The pipeline should record, for each label, who or what produced it, under which guideline version, and when.

Label sourceStrengthTypical failureWhat to record
Trained human annotatorsCan apply nuanced guidelinesFatigue, ambiguity in the guideline, drift between annotatorsAnnotator identifier (pseudonymous), guideline version, time
Domain expertsHandle specialized judgmentExpensive; disagree with each other on edge casesSame, plus the adjudication rule
Rules or heuristics (weak labels)Cheap and consistentEncode the rule’s blind spots as truthRule version and its coverage
Model-generated labelsScaleReproduce the labeling model’s errors; evaluation of a model against its own labels is circularLabeling model name and version, prompt or configuration
Delayed outcomes (a chargeback, a returned item, a reopened ticket)Reflect what actually happenedArrive late and only for some cases; see label delayEvent time and label time separately

Inter-annotator agreement measures how consistently people apply a guideline. Raw agreement is the fraction of items given the same label. It is high whenever one label dominates, even if the annotators disagree about every hard case. Cohen’s kappa compares observed agreement po with the agreement pe that would be expected if the two annotators labeled independently with their own label frequencies: \( \kappa = (p_o – p_e) / (1 – p_e) \). It equals 1 for perfect agreement, 0 when agreement matches the chance expectation, and is undefined when both annotators use only one label because the denominator is zero.

The script above computes kappa for two illustrative tables of 100 items. In the first, the annotators agree on 40 “yes” items and 40 “no” items and disagree on 20, so po = 0.80 and pe = 0.5 ร— 0.5 + 0.5 ร— 0.5 = 0.50, which gives kappa = 0.60. In the second, they agree on 85 “yes” and 5 “no” items and disagree on 10, so po = 0.90 but pe = 0.9 ร— 0.9 + 0.1 ร— 0.1 = 0.82 and kappa = 0.44. The second pair agrees more often in raw terms and less in chance-adjusted terms, because most of its agreement comes from a label that nearly everything receives. Report both numbers and the label counts. Kappa depends on prevalence and offers no universal threshold of “good enough”; use it to find guidelines that need work, and read disagreements before assigning a cause, since ambiguity in the guideline, missing context, or a legitimate difference of judgment each call for a different fix.

Labels also contain plain errors, and evaluation data is not exempt. A study of ten widely used benchmark datasets estimated an average of at least 3.3% label errors in their test sets, and at least 6% in the ImageNet validation set, using algorithmic flagging followed by crowd validation, of which about half of the flagged candidates were confirmed as errors. These figures come from the paper’s abstract. They are a reminder that test sets contain errors, not a rate to assume for your data. The practical consequence is that a small, carefully adjudicated evaluation set is worth more than a large noisy one when the differences you want to detect are small. The effect of noise is described in label noise. Keep a stable, adjudicated evaluation set, version it separately from training data, and fix errors in it by creating a new version, not by editing in place.

Provenance and licensing

Provenance is the record of where each piece of data came from and what happened to it on the way. For training data it has to answer a harder question than it does for analytics: what may this record be used for, including training a model that others will use? The answer depends on terms attached to the data at its source, and it must travel with the data through every copy and transformation, or it is lost. Data lineage records the derivation path; provenance adds the rights and conditions attached at the start of that path.

What to record

FieldWhy it mattersCommon mistake
Source and collection methodEstablishes the population and the selection bias of the frameRecording the table name but not how rows entered it
Collection date and source versionLets you reproduce or retire a snapshotOverwriting the source and keeping only the latest export
License or terms, with versionRights to use, modify, redistribute, and train depend on the textCopying the label from a hosting site without reading the license
Allowed usesSeparates “may be read” from “may train a model that is deployed” and “may be shared”One boolean called “approved”
Basis for personal data (notice, consent, contract)Determines whether the purpose is compatible with trainingAssuming the original purpose covers a new use
Access restrictions at the sourceA model that many users can query should not be trained on text few users may readDropping the source permission when exporting
Transformations appliedRedaction, deduplication, filtering and relabeling change what the record isApplying them in a notebook with no record

Datasheets for datasets, a documentation proposal from Gebru and colleagues, suggests that every dataset ship with a record of its motivation, composition, collection process, and recommended uses, by analogy with the datasheets that accompany electronic components. The pipeline version of that idea is a structured record generated at build time, not a document written afterward from memory.

Licenses are not labels on a portal

A license is a legal text, and the label a dataset hosting page shows may be wrong. The Data Provenance Initiative audited more than 1,800 text datasets, tracing their sources, creators, license conditions, and later uses, and reported that licenses were omitted on popular hosting sites for more than 70% of the datasets examined and misclassified in more than 50% (figures from the paper’s abstract; the study covers text datasets used for language models). The conclusion for a pipeline is procedural: record the license text and version you read, at the time you read it, and not only the name shown on the page.

It also matters what a license permits. An open license in the sense of the Open Definition allows use, redistribution, modification, and use for any purpose, with limited conditions such as attribution. Licenses that restrict the field of use, for example “research only” or “non-commercial”, can be reasonable, but they are not open in that sense and may not permit the use you have in mind. Whether a particular use is permitted, including whether training counts as the licensed use, is a legal question that varies by jurisdiction and license. The pipeline’s job is to keep the terms attached to the data, to block admission when they are missing or incompatible, and to route unclear cases to whoever makes that decision. Nothing in this post is legal advice.

Restricted sources and the audience of the model

A rule worth enforcing mechanically comes from the previous post’s topic. If a document is readable by three people, text from it should not train a model that the whole company can query. A model’s outputs can reproduce training text. Researchers demonstrated a training-data extraction attack on GPT-2 that recovered hundreds of verbatim sequences, including names, phone numbers, and email addresses, even from sequences that appeared in only one training document, and found that larger models were more vulnerable (from the paper’s abstract). So training eligibility should be a property computed from the source permission and classification: a record is eligible only if the audience of the model is within the audience allowed to read the record, or the record is transformed and assessed first. Treat this as an admission gate in the dataset build, with a reason code for each excluded record.

Admission checkRecord is admitted ifOtherwise
License or terms presentA license, contract, or notice basis is recorded and its allowed uses include this useExclude and log the reason
Personal dataIt is absent, redacted by a measured method, or covered by a recorded basisExclude, or route for assessment
Source audienceThe intended audience of the model is within the source audienceExclude
Deletion stateThe record is not on a deletion or opt-out list as of the build timeExclude and keep the exclusion list with the version
Label provenanceSource, guideline version, and time are recordedTreat as unlabeled

Dataset versions

A model can only be explained, rolled back, or corrected if the data it learned from can be identified exactly. Data versioning covers four ways to name a version: an immutable snapshot, a manifest, object-store versions, and table history. A table built by a query that is re-run later is not a version, because upstream corrections, late rows, and deletions change what the query returns. For training data the practical form is a manifest that lists exactly what was included and how it was produced, in the spirit of a dataset publication manifest, and an identifier derived from that content.

What a version records

The sketch below shows an illustrative manifest. The field names are invented for this post and are not a standard format.

{
  "dataset": "support-replies",
  "version": "a28b0686ea93",
  "built_at": "2024-11-13T04:00:00Z",
  "source_snapshots": ["tickets-export-2024-11-12", "feedback-export-2024-11-12"],
  "selection": {"method": "stratified", "seed": 11, "strata": {"security": 500, "other": 500}},
  "weights": {"security": 0.04, "other": 1.96},
  "label_guideline": "g3",
  "splits": {"method": "hash(group_id, salt=split-v1)", "test_fraction": 0.10},
  "admission": {"excluded": {"no_license": 41, "restricted_source": 12, "deletion_list": 7}},
  "files": [{"path": "train-00000.parquet", "sha256": "..."}, {"path": "test-00000.parquet", "sha256": "..."}],
  "licenses": {"tickets": "internal, notice v4", "docs": "CC-BY-4.0 (text read 2024-11-12)"}
}

Every field answers a later question. The source snapshots say what was selected from. The seed and strata allow the selection to be audited. The guideline version says which label definition applies. The exclusion counts show what the admission gate removed. File checksums let you detect that a file has changed after the fact, and the license summary lets a consumer see the terms without opening the sources.

Frozen splits and stable identifiers

Two engineering choices prevent subtle damage when the dataset is rebuilt. The first is to assign the split from a stable key and not from a random shuffle of the current rows. If each new build re-shuffles, an example that was in last month’s evaluation set can appear in this month’s training set, and every comparison across versions is contaminated. Hashing the group identifier with a fixed salt gives each group a permanent split, and also keeps all rows of one group on the same side. The second is a content-derived version identifier, so that any change to a record, a label, or the guideline produces a new identifier and an unchanged dataset keeps the old one.

The script below is an explanatory sketch written for this post (Python 3.12, standard library). It shows both properties and, in its last part, an n-gram contamination check that is explained in the contamination section.

import hashlib, json

# --- 1. Stable, group-aware split assignment by hashing the group key ---
def split_of(group_id, salt="split-v1"):
    h = int(hashlib.sha256(f"{salt}:{group_id}".encode()).hexdigest(), 16) % 100
    return "test" if h < 10 else "train"

v1_groups = [f"conv-{i}" for i in range(1000)]
v2_groups = v1_groups + [f"conv-{i}" for i in range(1000, 1300)]   # 300 new conversations arrive
a = {g: split_of(g) for g in v1_groups}
b = {g: split_of(g) for g in v2_groups}
moved = sum(a[g] != b[g] for g in v1_groups)
print("split assignment by hash of the conversation id")
print(f"  v1 test groups={sum(s=='test' for s in a.values())} of {len(a)}, v2 test groups={sum(s=='test' for s in b.values())} of {len(b)}")
print(f"  v1 groups whose split changed in v2: {moved}")

# --- 2. A content-derived dataset identifier ---
def record_hash(r):
    return hashlib.sha256(json.dumps(r, sort_keys=True).encode()).hexdigest()
def dataset_id(records, guideline="g3"):
    body = "\n".join(sorted(record_hash(r) for r in records)) + "|" + guideline
    return hashlib.sha256(body.encode()).hexdigest()[:12]
recs = [{"id": 1, "text": "refund request", "label": "billing"},
        {"id": 2, "text": "cannot log in", "label": "access"}]
print("dataset identifier")
print("  original           ", dataset_id(recs))
recs[1]["label"] = "account"
print("  one label changed  ", dataset_id(recs))
recs[1]["label"] = "access"
print("  label restored     ", dataset_id(recs))
print("  guideline g4       ", dataset_id(recs, guideline="g4"))

# --- 3. Contamination check with word n-grams ---
def ngrams(text, n):
    w = text.lower().split()
    return {tuple(w[i:i + n]) for i in range(max(1, len(w) - n + 1))} if len(w) >= n else {tuple(w)}
train_docs = [
    "to reset your password open settings choose security and select reset password then follow the emailed link",
    "invoices are issued on the first day of each month and are payable within thirty days of the issue date",
]
eval_items = {
    "exact copy":        "invoices are issued on the first day of each month and are payable within thirty days of the issue date",
    "light edit":        "invoices are issued on the first day of every month and are payable within thirty days of the issue date",
    "paraphrase":        "you receive a bill at the start of each month and must pay it inside a month",
    "unrelated":         "the warehouse ships orders on weekdays before noon",
}
N = 5  # the GPT-3 paper used 13 on web-scale text; 5 suits these short toy sentences
index = set().union(*(ngrams(d, N) for d in train_docs))
print(f"contamination check, n={N}")
for name, text in eval_items.items():
    g = ngrams(text, N)
    hit = len(g & index)
    print(f"  {name:11s} overlapping {N}-grams: {hit:2d} of {len(g):2d}  flagged={hit > 0}")

The output of that run was:

split assignment by hash of the conversation id
  v1 test groups=89 of 1000, v2 test groups=126 of 1300
  v1 groups whose split changed in v2: 0
dataset identifier
  original            a28b0686ea93
  one label changed   861822cbf61f
  label restored      a28b0686ea93
  guideline g4        3bf87a1b8f03
contamination check, n=5
  exact copy  overlapping 5-grams: 16 of 16  flagged=True
  light edit  overlapping 5-grams: 11 of 16  flagged=True
  paraphrase  overlapping 5-grams:  0 of 13  flagged=False
  unrelated   overlapping 5-grams:  0 of  4  flagged=False

In the first block, 300 new conversations were added to 1,000 existing ones. About 10% of groups fall into the test split (89 of 1,000 before, 126 of 1,300 after, with the usual random variation around 10%), and none of the original 1,000 groups changed sides. In the second block, changing one label changed the identifier from a28b0686ea93 to 861822cbf61f, restoring it returned the original identifier, and changing only the guideline version produced a third identifier. The identifier here covers records and the guideline label; a real build would also hash the selection settings and the admission outcome. Sorting the record hashes before combining them makes the identifier independent of row order.

Versioning has limits. A dataset version identifies the data, but not the model: training also depends on code, hyperparameters, hardware, and randomness, so the same dataset version does not guarantee the same model. A manifest is only as durable as the files it names, so retention for old versions must be an explicit decision, because deleting the files makes the identifier meaningless. And when a record has to be removed, the response is a new version that excludes it plus a record of which earlier versions contained it and which models used those versions. That record is what lets you answer the customer in the opening scenario.

Feedback quality

Feedback from users is attractive training data: it is current, abundant, and reflects the real distribution of requests. It is also the least controlled data in the pipeline. The sources differ in what they measure and how they fail.

Feedback typeExamplesWhat it measuresMain weaknesses
Explicit ratingThumbs up or down, star ratingStated satisfactionFew users respond; extremes are over-represented; unclear what was judged (tone, correctness, speed)
Explicit correctionUser edits a draft or supplies the right answerA concrete targetEdits may fix style and leave facts wrong; users may lack the knowledge to correct
Implicit behaviorClick, copy, dwell time, regenerate, abandonRevealed preferenceConfounded by what was shown and where
Downstream outcomeTicket reopened, order returned, escalationWhat happened nextDelayed, partial, caused by many things at once

Exposure and position bias

Implicit feedback is shaped by the system that collects it. A result at the top of a list is clicked more because it is seen more, not only because it is better. Joachims and colleagues describe position bias as a key obstacle to learning from click data and propose counterfactual correction that weights each observation by the inverse of the probability that it was examined, with click models serving as the estimator of those probabilities (abstract-level summary).

The last block of the first script applies that idea with assumed numbers. Suppose users examine rank 1 with probability 0.60 and rank 3 with probability 0.20. Item A at rank 1 receives 30 clicks in 100 impressions, and item B at rank 3 receives 12 clicks in 100 impressions. The raw click rates are 0.30 and 0.12, so raw clicks favor A by 2.5 times. Dividing each rate by its examination probability gives 0.30 / 0.60 = 0.50 for A and 0.12 / 0.20 = 0.60 for B, and the order reverses. This is a calculation example, not a measurement. The correction is only as good as the propensities, which must be estimated, for example from controlled randomization of positions, and it assumes the click depends on examination and relevance in a simple way. Small propensities also give large weights and noisy estimates, so weights are usually capped or smoothed.

Loops and selection

A model that influences what users see influences the data used to train its successor, the pattern described in feedback loop (machine learning). Labels are observed only for the cases the system surfaced, so the next model may learn to predict the current model’s behavior and score well on data it shaped. A system that never shows an answer type will never receive feedback on it. Countermeasures are deliberate: keep a small randomized exploration slice with a known probability so that exposure can be corrected, hold out an evaluation set that was not shaped by the model, and keep feedback that is used to evaluate separate from feedback that is used to train.

A feedback intake pipeline

Raw thumbs-down events are not training examples. A usable record needs the context in which the feedback was given. A reasonable intake path captures the prompt, the response, the model and prompt version, the identifiers of any retrieved chunks, the feedback signal, and the time. It then filters automated or abusive submissions, deduplicates repeated events, joins late outcomes when they arrive, samples a fraction for human audit, measures agreement between the audit and the signal, and routes each record to one of four destinations: training, evaluation, bug report, or discard. The audit sample is what tells you whether thumbs-down means “wrong” in practice. If agreement is low for a segment, that segment’s feedback is not a training label, whatever its volume.

Feedback may contain personal data, secrets pasted by users, and text from documents they were allowed to read. The same admission gate applies: check consent or notice basis, apply redaction, and remember that a user’s retrieval permissions do not authorize copying text from the documents they saw into a shared training set.

Contamination and privacy

Contamination: when evaluation data was seen in training

Contamination means evaluation examples, or close variants of them, are present in training data, so the score measures recall and not generalization. It resembles data leakage, which covers train-test contamination, temporal leakage, and group leakage, and the grouped splits described in stratified group k-fold address one source of it. The routes include exact duplicates, near duplicates with small edits, the same source document split into different examples, the same user or conversation on both sides, and public benchmark text that was scraped into a large web corpus.

Duplication in real corpora is large. A study of language-model datasets found many near-duplicate examples and long repeated substrings, removed a single 61-word sentence that appeared over 60,000 times from C4, reported that deduplication let models emit memorized text ten times less often, and found train-test overlap affecting over 4% of the validation sets of standard datasets (from the abstract). The GPT-3 paper describes the detection method used for benchmarks: an example counts as potentially contaminated if it shares a 13-gram with anything in the pretraining set, or overlaps in its entirety when it is shorter than 13 words. The authors then compared performance on the “clean” subset with performance on the full benchmark. They also report that a bug in their filtering let some overlaps through, that retraining was not feasible, and that a limitation of the clean-subset comparison is that the clean subset may differ in distribution from the full set. The point for a pipeline is that exact matching is a floor, the check should be run as part of the build and not afterward, and the result needs interpretation.

The last part of the second script above implements the n-gram idea at toy scale. Training documents are indexed by their word 5-grams (a smaller n than the paper’s 13, because the sentences are short), and each evaluation item is flagged if any of its 5-grams appears in the index. The output shows an exact copy flagged with 16 of 16 overlapping 5-grams, and a lightly edited copy flagged with 11 of 16, so a single changed word did not hide it. A paraphrase with different wording produced zero overlapping 5-grams and was not flagged, and an unrelated sentence produced zero. The paraphrase result is the limit of the method: n-gram overlap catches copying and light editing but not rewording, so paraphrase-level contamination needs similarity search on embeddings or semantic matching, with a threshold that trades missed contamination against false alarms and human inspection of matches.

Contamination routeDetectionPrevention
Exact duplicateHash of normalized textDeduplicate before splitting
Near duplicate or light editWord n-gram overlap, MinHash-style signaturesDeduplicate across splits, not only within one
Same group on both sides (user, conversation, document)Group key present in both splitsAssign split by group key, with a frozen hash
Public benchmark text in the corpusOverlap of benchmark items with the corpusRemove benchmark items at build time; keep a private evaluation set
ParaphraseEmbedding similarity above a threshold, plus sampled human inspectionAccept as residual risk; prefer evaluation data created after the training cutoff
Evaluation reuse over timeCount of how often the same set guided decisionsRotate or refresh the evaluation set; see holdout reuse

Privacy: what the dataset exposes

Data privacy concerns how handling information affects people, and a dataset used for training is a new use of the information with its own risks. Three ideas matter for the pipeline.

  • Models can reproduce training text. The extraction study cited above shows that recovering individual training examples by querying a model is possible, and that duplication and model size affect how much leaks. Deduplication is therefore a privacy measure as well as an evaluation measure, and it does not make leakage impossible.
  • Removing identifiers is not anonymization. Pseudonymization replaces direct identifiers while records may remain linkable, and a hash of an email can be matched against guessed addresses. Redaction by pattern matching misses forms it was not written for. Measure the redaction method on a labeled sample and report its recall, not only its precision, and keep the unredacted source access-controlled.
  • Deleting from the dataset is not deleting from the model. When a person asks for deletion or withdraws consent, a later dataset version can exclude their records and the exclusion list persists with the version. A model already trained on an earlier version still carries what it learned. The options are retraining on a schedule that bounds how long removed data can persist in a deployed model, documenting the limit, or applying a method for removing training influence whose effectiveness you have verified for your case. Which is acceptable is a policy and legal question for the organization, and the pipeline must at least be able to say which versions and models contained the record.

Retention applies to the dataset, its snapshots, and the feedback store. Keep raw feedback only as long as a stated purpose requires, keep derived datasets as long as the models trained on them are in service or must be explained, and make deletion requests traceable from the source record through every version that contained it.

Limits

No pipeline guarantees a clean dataset. Sampling controls the frame you select from, and not the frame you never see. Agreement measures consistency, not correctness: annotators can agree on an error, and a better-informed judge may disagree with both. A manifest proves what was used and says nothing about whether it was right to use it. Contamination checks have blind spots, with paraphrase the clearest one, and they detect only what they are configured to look for. Feedback corrections depend on estimates of exposure that can be wrong. Privacy controls reduce risk, and a deployed model can still reveal training text. The useful discipline is to record what was checked, with which method and threshold, so that the remaining risk is stated and not assumed to be zero.

References


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.