Sub topic 5
Documenting Training Data
This chapter assumes basic supervised machine learning, including training, validation, and test sets. You should also know common metrics such as accuracy, precision, and recall, plus basic Python, Markdown, and Git.
Training data documentation explains where a model's examples came from and how those examples became the data used for training. A useful description lets another person judge whether the model fits a new task. It also helps reviewers find privacy, licensing, quality, and fairness problems before deployment.
Record the data's provenance
Provenance is the history of a dataset. Record enough information to identify the source and reproduce the dataset version without exposing private data.
Document:
- The source, such as an internal database, public archive, or vendor.
- The collection dates and time range.
- The dataset version, snapshot identifier, or commit hash.
- The selection rules and excluded records.
- The organization responsible for collecting or preparing the data.
- The license, consent basis, and permitted uses.
- Any transformations applied before training.
Do not write “data from customer tickets” without more detail. State which ticket system supplied the records, which dates were included, and whether personal information was removed.
| Field | Example |
|---|---|
| Source | Internal support-ticket export |
| Time range | January 2022 to December 2024 |
| Version | Export `2024-12-31`, schema version 3 |
| Selection | English tickets with one resolved queue label |
| Exclusions | Spam, duplicate tickets, and tickets missing labels |
| Privacy processing | Names, email addresses, and phone numbers removed |
A model card should link to a fuller data record when the source cannot be published. The link might point to a data governance document, a dataset datasheet, or an access-controlled registry.
Describe composition and preparation
Composition tells readers what the dataset contains. Include the number of records, input fields, label definitions, and important distributions. State whether records are unique and whether multiple records can come from the same person, device, or organization.
Preparation describes operations such as:
- Removing duplicates.
- Redacting or replacing personal information.
- Normalizing text, images, or audio.
- Filtering invalid or low-quality records.
- Creating labels through experts, rules, crowdsourcing, or inherited metadata.
- Resolving disagreements between annotators.
Explain labels in operational terms. “Urgency” is ambiguous unless the card says what makes a ticket urgent and who assigned that label. If labels come from historical decisions, note that those decisions may contain organizational or human bias.
A small script can produce part of a factual data summary:
from collections import Counter
records = [
{"split": "train", "label": "billing"},
{"split": "train", "label": "technical"},
{"split": "validation", "label": "billing"},
{"split": "test", "label": "technical"},
]
split_counts = Counter(record["split"] for record in records)
label_counts = Counter(record["label"] for record in records)
print("Records by split:", dict(split_counts))
print("Records by label:", dict(label_counts))The output should be generated from the exact snapshot used for training. Do not manually copy counts into a card if a pipeline can calculate them.
Explain splits, leakage, and representativeness
Describe how records were divided into training, validation, and test sets. State whether the split was random, time-based, group-based, or stratified. A group-based split keeps records from the same customer or device in one split. This prevents nearly identical records from appearing on both sides of evaluation.
Data leakage occurs when information unavailable at prediction time enters the features or labels. For example, a support-ticket model leaks information if it uses the final resolution code while claiming to predict the queue at ticket creation. Document checks for duplicated records, future fields, and shared entities.
Representativeness is a comparison between the training data and the conditions where the model will operate. Report important gaps, such as:
- Languages or regions with few examples.
- Rare classes.
- Older data that may not match current behavior.
- Missing device types or operating systems.
- Synthetic or augmented examples.
- Labels that reflect only one team's decisions.
Show the data's limits
End the training-data section with consequences for model use. Connect known data weaknesses to likely failure modes. For example, “The dataset contains few tickets from mobile users, so performance may be lower for mobile-app reports” is more useful than “The data may be biased.”
A model card does not need to publish confidential records. It does need to disclose material facts, explain access restrictions, and identify the documentation owner. When the dataset changes, update its version, counts, preprocessing description, and any evaluation results affected by the change.
Exercise
A dataset contains 100,000 support tickets, but 95% are from one country and labels were copied from final resolutions. Name two facts that must appear in the training-data documentation.
Show answer
The card should report the geographic imbalance and explain that labels came from final resolutions. It should also discuss the resulting risks, such as weak performance in other countries and possible leakage when final resolution information is unavailable at prediction time.