Field guide · Data and datasets
Data and datasets: from a pile of files to trainable material
You pull 200,000 conversations from a shared drive and call it “enough data”. Training starts and the problems appear: some customers never consented, some fields contain phone numbers, train and test share the same samples, and nobody can delete a bad batch cleanly. Whether data is usable is not a size question. It has to answer: where it came from, why you may use it, how it was processed, how to reproduce it and how to delete it.
- Write the use sentence first: what exactly is this data training?
- Check copyright, contract, privacy and likeness separately; do not collapse them into “licensed”.
- Split train, validation and test by source, not just randomly.
The full guide starts below. Use the tables for reference; you do not need to memorise them.
Take one concrete job: 2,000 support conversations to train a ticket classifier with three labels: refund, shipping and product. Write the source, licence, fields, split and deletion method first.
1 · Fix the purpose: pretraining, fine-tuning, preference, evaluation and RAG need different data
“Not enough data” can mean five different problems: pretraining lacks scale and diversity, fine-tuning lacks task examples, preference data lacks paired comparisons, evaluation lacks discrimination, RAG lacks retrievable and citable documents. Their minimum fields, quality bars and risks differ completely. Fine-tuning on an evaluation set or building RAG from raw web text only reveals the mismatch at the end.
Write the purpose as an input–output–judgement sentence. For example: “given a customer-support dialogue, output the issue category and whether to escalate; a human judges against 12 labels.” Without input, output and judgement, annotators improvise and quality cannot reproduce.
| Purpose | Minimum fields | Quality bar | Main risk |
|---|---|---|---|
| Pretraining / continued pretraining | Text or image-text, source, licence, language, date | Scale, deduplication, language coverage, low-quality filtering | Copyright, privacy, contamination, long-tail removal |
| Supervised fine-tuning | Instruction, input, expected output, rationale or label | Task coverage, answer consistency, difficulty tiers | Label drift, short answers, templating |
| Preference / alignment | Two responses to one prompt, preference direction, rationale | Valid contrast, position debiasing, annotator agreement | Preferring longer answers, cultural bias |
| Evaluation / benchmark | Item, reference answer or scorer, difficulty, source | Discrimination, contamination check, reproducible scoring | Train-set leakage, scorer drift |
| RAG / knowledge base | Document, chunk, date, permission, citation anchor | Retrievable, fresh, correctly permissioned, citable to source | Stale, over-permissioned, chunks that break meaning |
| Multimodal | Image/audio/video, caption, alignment, licence | Resolution, duration, alignment accuracy, scene coverage | Likeness, voice, trademark, synthetic media |
2 · Rights are not one column: copyright, contract, privacy and likeness are separate
“Publicly accessible” does not mean “may be trained on, commercialised and redistributed”. Web content may be copyrighted, databases may carry compilation rights, platform terms may restrict crawling and redistribution, personal data is constrained by privacy rules, and real people and voices raise likeness and personality rights. Each layer needs its own check; one “CC” or “public” label cannot cover them.
This page gives a checking order, not a legal conclusion for any use. Licences and use remain with authorisation documents, contracts, platform terms and applicable law. When unsure, stop using the batch before training, not after.
| Rights layer | Question | Document to read | What does not substitute |
|---|---|---|---|
| Copyright | Is the text, image, audio or code protected; are copying, adaptation and commercial use allowed | Licence, authorisation, source page | “Publicly visible” or “credit given” |
| Database / compilation | Are bulk extraction, reorganisation and redistribution restricted | Platform terms, database licence | A licence for individual records |
| Contract / platform terms | Do the API, crawler, download, cache and redistribution terms allow it | Terms of service, API terms, signed contract | Technical accessibility |
| Personal data | Does it contain identity, contact, health, location or biometric data | Privacy notice, consent record, deletion mechanism | A verbal claim that it is anonymised |
| Likeness / voice / personality | Is a real face, voice, name or persona identifiable; use, duration, territory | Likeness or voice release, consent, withdrawal terms | Buying one photograph |
| Confidentiality / transfer | Are client data, internal documents and cross-border transfer allowed | NDA, transfer assessment | “Internal use first” |
3 · Provenance: every batch must trace to a version, a date and a licence
Provenance is not “the data came from the internet”. It needs at least a source URL or dataset identifier, retrieval time, HTTP status, licence snapshot, content hash, collector and parameters. Pages change, licences change and accounts disappear; without a snapshot, you cannot prove what was obtained six months later.
Store provenance separately from content: the data table holds content and hashes, the manifest holds source and licence, the log holds the collection process. Removing or replacing a record then does not require rewriting the table, and audits can filter problem batches by source, licence or date.
| Field | Why it is needed | If missing |
|---|---|---|
| Source URL / dataset ID | Return to the original page or version | Cannot recheck licence or content |
| Retrieval time and status | Distinguish normal pages, redirects, 404s and paywalls | Error pages become training text |
| Licence snapshot | Prove which terms applied then | Cannot explain after terms change |
| Consent / authorisation | Basis for real people, clients and internal data | Cannot prove the basis for use |
| Content hash | Deduplication, version comparison, deletion tracking | One edit makes location impossible |
| Collector and parameters | Reproduce the same batch | Different person or script yields different data |
| Deletion / withdrawal record | Remove from training sets, indexes and caches | Data remains after rights are withdrawn |
4 · Cleaning: define what to keep before how hard to filter
Cleaning is not “make the data clean”; it is “make the retained data answer the purpose”. Fix encoding, boilerplate, navigation, duplicates, garbled text and mixed languages first. Handle personal data, toxicity, adult content and privacy leaks according to purpose and rules. Long-tail languages and minority expression must not be wiped out by one quality score.
Every filter needs sampled evidence: how much was removed, which records, why and what it did to the target distribution. “Two terabytes after cleaning” means nothing without saying what was lost between three and two.
Encoding and format
What to do: Normalise UTF-8, line endings, strip HTML, extract PDF text
Evidence: Parse-failure rate, sampled text
Boilerplate and navigation
What to do: Remove headers, menus, ads and repeated notices
Evidence: Template hit rate, residual sample
Language identification
What to do: Label primary language and mixed-language ratio
Evidence: Confusion matrix, short-text audit
Personal data
What to do: Detect names, phones, emails, IDs, addresses, biometrics
Evidence: Recall, false-positive rate, redaction log
Deduplication
What to do: Exact hashes plus near-duplicate detection
Evidence: Duplicate rate, samples of removed clusters
Quality filtering
What to do: Length, symbol ratio, repetition, perplexity, classifier score
Evidence: Retention by threshold, distribution shift
Safety filtering
What to do: Handle toxicity, adult, illegal and leaked content by purpose
Evidence: Hit types, human review, appeal path
5 · Labelling: guideline, pilot, double annotation, adjudication, drift
Annotation quality is not “find smarter people”; it is “make two people reach the same judgement on the same item”. Write the guideline with boundary cases, counterexamples, required fields and forbidden inferences. Pilot 30–50 items, measure agreement and disputes, then double-annotate, adjudicate and audit. Scaling first only produces unexplainable labels.
Agreement metrics must fit the task: kappa or alpha for categories, ICC for continuous scales, Kendall’s tau for rankings. When agreement is low, revise the guideline and samples before blaming annotators. Keep a gold set and rerun it whenever annotators, model pre-labelling or guidelines change.
Guideline
Output: Boundary cases, counterexamples, fields, decision tree
Acceptance: A newcomer can label ten items independently
Pilot
Output: 30–50 items covering hard cases
Acceptance: Disagreement hotspots documented
Double annotation
Output: At least two independent labels per item
Acceptance: Agreement reaches the preset threshold
Adjudication
Output: A third person or rule resolves disputes
Acceptance: Rationale is traceable
Gold set
Output: Fixed, held out, boundary-heavy
Acceptance: Reruns after annotator or pre-label changes
Drift check
Output: Stratified audit by time, source and difficulty
Acceptance: Distribution drift alerts
6 · Splits and contamination: train, validation and test are not a random cut
A random split lets the same entity, template or near-duplicate text appear in both training and test. Group by entity, time, source or user first, then split within groups; check near-duplicates across sets; compare public benchmarks at n-gram and item level. Otherwise a higher score only proves the model has seen the test.
Lock the test set: lock the file, the scorer and the preprocessing. Looking at it after every tuning run turns it into a validation set. Keep a holdout that never participated in selection, even if it is smaller.
Group by entity
Use when: Multiple samples per person, product or document
Guard against: Same entity across sets
Split by time
Use when: News, dialogue, transactions, logs
Guard against: Future leaking into past, distribution shift
Split by source
Use when: Multiple sites, vendors or devices
Guard against: Source-specific templates mistaken for capability
Split by user
Use when: Recommendation, personalisation, dialogue
Guard against: Same user behaviour across sets
Near-duplicate check
Use when: Web, code, papers, lyrics
Guard against: Paraphrase, translation, template variants
Benchmark contamination
Use when: Using public benchmarks
Guard against: Items, answers or rationales in training
7 · Versions and reproduction: lock data, code, config and environment together
Storing only the “final data” does not reproduce. Keep data hashes and manifests, cleaning and labelling code, split config, random seeds, dependency versions, hardware environment, licence snapshots and a changelog. A dataset card states purpose, sources, fields, size, languages, time range, known biases, prohibited uses and contact.
Do not version by date alone. A short data hash plus config version distinguishes two batches on the same day; every rebuild produces a new hash and old versions stay read-only. Dataset cards and model cards should reference each other, or a model incident cannot be traced back to training data.
Data content
Record: Per-file SHA-256 plus manifest hash
Reproduction use: Confirm the same batch
Cleaning / labelling code
Record: Git commit plus command
Reproduction use: Rerun the same processing
Split config
Record: Entity/time fields, ratios, seed
Reproduction use: Rebuild the same train/test sets
Dependencies and environment
Record: Lockfile, CUDA/driver, hardware
Reproduction use: Explain speed and numeric differences
Licence snapshot
Record: Terms text, date, source
Reproduction use: Prove the basis at the time
Changelog
Record: Adds, removes, edits, reason, impact
Reproduction use: Audit and rollback
Dataset card
Record: Purpose, sources, fields, biases, prohibited uses
Reproduction use: Boundary note for users
8 · Privacy and deletion: minimise first, then discuss deletion
Personal data is not just names and phone numbers. Location traces, device IDs, chat context, faces, voiceprints, medical records and support logs can all identify someone. Minimise first: do not collect, store or transfer fields you do not need; for what remains, redact, restrict access, encrypt and set retention.
Deletion must propagate to training sets, indexes, caches, backups and derived data. There is no general guarantee that model weights “forget” a record; what you can do is stop further use, record provenance, remove it from retrieval, remove it from fine-tuning data and state the limit in the model card. Do not treat one retraining run as proof of deletion.
- Minimise by field: do not collect, store or send fields the purpose does not need.
- Handle direct and quasi-identifiers separately: names, phones, IDs, device IDs, location and time combinations can re-identify.
- Separate access: annotation, training, evaluation and audit see different scopes; least privilege by default.
- Put retention and deletion into contracts and a runbook; do not rely on someone remembering to delete.
- State in the dataset and model cards that full forgetting is not guaranteed; separate retrieval-layer and fine-tuning-layer deletion paths.
9 · Cost: price usable examples, not downloaded volume
The most underestimated data costs are labour and rework. Download and storage are cheap; cleaning, labelling, QA, legal review and rework are not. A batch cut from three terabytes to two may yield only a few hundred thousand usable records. Quote and schedule per accepted usable example, with annotation rounds, rework rate and review time written in.
Split cost into one-off and ongoing: one-off covers collection, cleaning, labelling and evaluation-set construction; ongoing covers refresh, deduplication, drift monitoring, deletion requests and licence review. Counting only the one-off leaves maintenance to surprise you after launch.
Acquisition / licensing
Unit: Batch / contract
Why it runs away: Scattered sources, term-by-term negotiation
Control: Source list and priority first
Storage / transfer
Unit: GB per month
Why it runs away: Keeping raw, intermediate and derived copies
Control: Tiered storage and retention
Cleaning
Unit: Hours per 10k records
Why it runs away: Rules change repeatedly without sampling
Control: Pilot on a small batch before scaling
Labelling
Unit: Items per round
Why it runs away: Unclear guideline, double annotation becomes many
Control: Pilot and agreement threshold
QA
Unit: Audit rate
Why it runs away: Totals checked without stratification
Control: Stratify by source, difficulty and time
Rework
Unit: Rounds per batch
Why it runs away: Acceptance criteria change late
Control: Acceptance table plus change order
Legal / compliance
Unit: Review per batch
Why it runs away: Only after an incident
Control: Check by rights layer before launch
10 · Failure branches: stop the batch, locate the cause, do not train first
Once a data problem enters training, the fix cost multiplies. When a licence is unclear, provenance is broken, labels drift, test data leaks or personal data appears, isolate the batch first, then locate whether the cause is collection, cleaning, labelling, splitting or versioning. Do not trade a temporary schedule gain for “train one version and see”.
Unclear licence
Check first: Source, terms snapshot, scope
Likely cause: URL saved without terms
Fix: Stop the batch; add authorisation or replace
Many duplicates
Check first: Exact/near-duplicate rate, source concentration
Likely cause: Syndication, template copying
Fix: Deduplicate clusters, keep representatives
Label drift
Check first: Guideline version, annotator, time
Likely cause: Guideline changed without relabelling
Fix: Rerun gold set, rework under new guideline
Suspiciously high score
Check first: Train/test overlap, near-duplicates, benchmark contamination
Likely cause: Random split or leaked items
Fix: Rebuild grouped splits, decontaminate, retest
Personal data present
Check first: Fields, detector recall, human audit
Likely cause: Regex-only redaction
Fix: Isolate, redact, re-audit, log deletion
Severe class imbalance
Check first: Distribution by source and difficulty
Likely cause: Cleaning removed the minority class
Fix: Stratify, resample or reweight
Source page gone
Check first: Snapshot, hash, mirror
Likely cause: Only the URL was stored
Fix: Check the snapshot; remove if unverifiable
11 · A minimum path: from purpose sentence to reproducible dataset card
This path fits a batch intended for fine-tuning, evaluation or RAG. Each step leaves evidence before the next begins.
- Write the purpose sentence: input, output, judgement, use case and what it will not do.
- List sources and rights: source, terms, authorisation, consent, territory, duration and prohibited uses.
- Build provenance: URL/ID, retrieval time, status, licence snapshot, hash and collection parameters.
- Pilot cleaning: encoding, boilerplate, language, PII, deduplication, quality and safety filtering; record retention.
- Write the labelling guideline and pilot 30–50 items: boundary cases, counterexamples, agreement, disputes.
- Annotate and adjudicate: double annotation, gold set, audit, drift log.
- Grouped splits and contamination checks: entity/time/source groups, near-duplicate and benchmark comparison.
- Lock versions: data hash, code, config, seed, environment, licence snapshot, changelog.
- Write the dataset card and deliver: purpose, sources, fields, size, biases, prohibited uses and deletion path.
- Monitor after launch: duplicate rate, distribution drift, source failure, deletion requests, licence changes.
Sources and further reading
These links are for checking facts, licences and official scope. External pages may change; cite the original text and check date.
- Datasheets for DatasetsMotivation, composition, collection, processing, uses and maintenance that a dataset should document.
- Model Cards for Model ReportingHow model cards record intended use, performance, limitations and ethical considerations; cross-reference with dataset cards.
- NIST AI Risk Management FrameworkA framework for data governance, risk identification and evidence; not a compliance conclusion for a sector.
- Common Crawl · Terms of UseTerms boundaries for crawling and using web corpora; read before collection.
- Creative Commons · LicencesAttribution, commercial use, adaptation and redistribution conditions across CC licences.
- NIST SP 800-122 · PII guideReference for identifying, classifying and protecting personally identifiable information.
- Data Statements for NLPRecording speakers, language varieties, collection context and bias for language data.
- Deduplicating Training Data Makes Language Models BetterHow training-data deduplication affects memorisation, leakage and training efficiency.
Next
If you get stuck while following it, go back to the matching route instead of rereading the whole guide.