Sub topic 5
Documenting training data
This chapter covers the "Training data" section of a model card. It assumes you know what train, validation, and test sets are, can read basic Python, and have seen the other card sections: model details, intended use, and evaluation. The goal is a section that lets a reader judge whether the model's behavior can be trusted for their case, and that lets an auditor trace a problem back to its source.
Why the training data section matters
A model's behavior comes from its data. Two models with the same architecture and different data can behave very differently. When someone asks "why does this model fail on short tickets?" or "can we use it in another country?", the answer usually sits in how the data was collected, filtered, and labeled.
A card cannot hold the whole dataset. It should hold enough facts that a reader can:
- Judge whether their own inputs resemble the training inputs.
- Spot likely gaps, such as missing languages, regions, or time periods.
- Check legal and privacy constraints before reuse.
- Reproduce or audit the training run.
If you maintain a full datasheet for the dataset, the card summarizes it and links to it. The next chapters cover how the two documents relate. If no datasheet exists, the card section carries the full burden.
What to document
Cover the full path from raw source to the examples the model saw. Each stage can introduce bias or error.
The table lists the questions to answer for each part.
| Aspect | Question to answer | Example entry |
|---|---|---|
| Source | Where did the data come from, and who produced it? | Tickets submitted through the web form of one product |
| Collection | When and how was it gathered? | Exported from the helpdesk database, 2022-2024 |
| Size and shape | How many examples, and in what format? | 120k tickets, plain text plus queue label |
| Population | Who or what does it represent, and who is missing? | English only, 80% from North America |
| Preprocessing | What was removed, changed, or added? | Removed 6% as duplicates; masked emails and phone numbers |
| Labels | How were labels created and checked? | Queue chosen by the agent who resolved the ticket |
| Splits | How were train, validation, and test sets made? | Split by customer account, not by ticket |
| Rights and privacy | What license, consent, and personal data rules apply? | Internal data; anonymized; not redistributable |
Source and collection
Name the source precisely enough that someone could find it again, or explain why they cannot. "Web data" is not a source. "A crawl of public forum posts from 2021 to 2023, filtered to English" is. State the collection period, because data ages. A model trained on 2022 tickets may not know about a product launched in 2025.
If the data was scraped, state what rules you followed, such as robots.txt compliance and license filters. If it came from users, state under what terms. Where you cannot share these details, say so and say why, rather than leaving the gap silent.
Population and coverage
Describe who the data represents. The most useful statements are about gaps: languages, regions, devices, age groups, or content types that are absent or rare. A reader cannot discover those gaps from the model, and they drive many of the limitations you will list later.
Be careful with demographic attributes. Report them only when you collected them with a legitimate purpose and can describe how. Do not infer sensitive attributes with another model and then present the result as fact. If you inferred them, say how and give the error rate if you know it.
Preprocessing
Every filter changes the population. If you dropped tickets under three words, the model never saw short tickets, and that belongs in the card. Record the rule, the share of data it removed, and the reason. Also record what you added, such as augmented or synthetic examples, and mark their share separately from real data.
Labels
For supervised models, label quality bounds model quality. Document:
- Who labeled the data (domain experts, crowd workers, end users, an automated system).
- What instructions they received, with a link to the guideline.
- How disagreement was handled, and a measure of agreement if you have one.
- Known label noise, for example labels derived from a proxy such as "the queue where the ticket ended up".
A proxy label deserves explicit warning. If the label is "which queue resolved it" and not "which queue should have received it", the model learns to reproduce past routing, including past mistakes.
Splits and leakage
Say how you made the evaluation sets and whether they are independent of the training set. Random splits of data with natural groups (many tickets per customer, many frames per video, many records per patient) leak information. The model sees the same customer in training and in test, and reported metrics look better than real-world performance. Split by the group, and say so in the card.
Generating the facts from the data
Hand-written numbers go stale or turn out wrong. Compute the descriptive facts from the data and paste them into the card. This script produces the data summary lines for the training data section.
from collections import Counter
from datetime import date
records = [
{"text": "Cannot log in to my account", "label": "account", "created": date(2022, 3, 1)},
{"text": "Refund for duplicate charge", "label": "billing", "created": date(2023, 7, 15)},
{"text": "App crashes on start", "label": "technical", "created": date(2024, 1, 9)},
{"text": "Reset password", "label": "account", "created": date(2024, 5, 2)},
{"text": "Invoice shows wrong amount", "label": "billing", "created": date(2024, 6, 30)},
{"text": "Slow upload speed", "label": "technical", "created": date(2023, 2, 11)},
]
def summarize(records, label_key="label", date_key="created"):
total = len(records)
labels = Counter(r[label_key] for r in records)
dates = [r[date_key] for r in records]
lines = [
"## Training data",
f"- Records: {total}",
f"- Collected: {min(dates)} to {max(dates)}",
"- Label distribution:",
]
for label, count in labels.most_common():
lines.append(f" - {label}: {count} ({count / total:.0%})")
return "\n".join(lines)
print(summarize(records))The output starts like this:
## Training data
- Records: 6
- Collected: 2022-03-01 to 2024-06-30
- Label distribution:
- account: 2 (33%)
- billing: 2 (33%)
- technical: 2 (33%)The script gives you facts, not judgment. A human still has to write why the data looks this way and what it means for users.
A leakage check
A second automated check catches one of the most damaging errors, which is test examples that also appear in training.
def normalize(text):
return " ".join(text.lower().split())
def overlap(train_texts, test_texts):
train_set = {normalize(t) for t in train_texts}
return [t for t in test_texts if normalize(t) in train_set]
train = ["Reset password", "App crashes on start"]
test = ["reset PASSWORD", "Slow upload speed"]
leaked = overlap(train, test)
print(f"{len(leaked)} of {len(test)} test examples also appear in training")This prints 1 of 2 test examples also appear in training. It finds only exact matches after normalization. Near-duplicates, such as the same message with a changed greeting, need fuzzy matching or hashing methods. Say in the card which kind of check you ran.
Privacy, consent, and legal notes
The card is not a legal document, but it should record what a downstream team needs to ask before reuse:
- The license or terms under which the data was obtained.
- Whether it contains personal data, and how it was anonymized or masked.
- Whether people could opt out, and how opt-outs were honored.
- Whether the data can be shared, and if not, who to contact for access.
Do not paste sensitive examples into the card. Describe the categories (for example, "emails and phone numbers masked with placeholder tokens") and keep real samples out of public documentation. If you publish a few illustrative examples, make them synthetic or cleared for release.
Common errors
- Vague sources. "Internal data" or "public data" tells the reader nothing. Name the system, the period, and the collection method.
- Reporting size only. A count of 120k says little without the population and label distribution.
- Omitting what was removed. Filters shape the model. An undocumented filter is an invisible limitation.
- Treating labels as ground truth. Describe how labels were made and where they are noisy.
- Stale numbers. A card written for version 1.0 and copied to 1.2 while the data was refreshed misleads readers. Regenerate the summary when the data changes.
- Hiding unknowns. For pretrained or third-party models you may not know the data. Write "unknown" or "not disclosed by the provider" and name the base model, so readers can look up its own documentation.
- Over-sharing. Documenting provenance does not require exposing personal data or trade secrets. Describe categories and link to access-controlled detail.
Writing the section
A short, readable section is better than an exhaustive one nobody reads. A good structure is:
- One paragraph naming the source, period, size, and population.
- A short list of preprocessing steps with the share of data affected.
- A paragraph on labels and their quality.
- A sentence on how the splits were made.
- Links to the datasheet, the data version, and the contact for access questions.
Compare two entries for the same dataset.
Weak: "Trained on a large dataset of customer support tickets."
Better: "Trained on 120k anonymized English tickets from one product's web form, collected 2022-2024. Tickets under three words and exact duplicates were removed (11% of the raw export). Labels are the queue that resolved each ticket, so past routing errors are present in the labels. Train, validation, and test sets were split by customer account. Data version: tickets-2024-09 (datasheet linked)."
The second entry lets a reader see immediately that the model has not seen other languages, short messages, or other products.
Exercise
Your team splits 100,000 support tickets randomly into 80% train and 20% test, and reports 94% test accuracy. After deployment, accuracy on new customers is 85%. Name the likely documentation and evaluation problem, and state what the card's training data section should say to prevent it.
Show answer
Many tickets come from the same customers, so a random split puts the same customers (their vocabulary, products, and templates) in both train and test. The model partly memorizes customer-specific patterns, and the test score overstates how well it handles unseen customers. The card should state the split method, preferably splitting by customer account, report the leakage checks that were run and their limits, and note that results for new customers should be measured on a held-out set of accounts. Reporting the population (which customers and products are covered) also warns readers about expected performance differences.