Quality Control for Training Data
Dataset engineering covers curating, generating, and annotating the data used to train and adapt AI models.
Why Training Data Sets the Ceiling
A model can only learn from the examples it is shown. The quality and shape of those examples set a ceiling on what the model can do. Dataset engineering is the discipline that handles this material. It asks where training and adaptation data will come from, how that data should be prepared, and how each example gets its label or target. Before you can reason about a model's behavior, you need to know what went into it.
What do you think happens?
Which is easier to annotate: a message that must be labeled spam or not spam, or a free-form essay that must be judged?
Reveal answer
The spam label
A spam label is chosen from a short, fixed list, so two careful annotators will usually agree. An essay has to be judged on many dimensions at once, such as accuracy, completeness, tone, and appropriateness. The sections below explain this difference.
Curating, Generating, and Annotating
Dataset engineering covers three core activities. They often appear together in one project, so it helps to see how they connect before looking at each one separately.
Curating means selecting and organizing data that already exists so that it is suitable for the task.
Generating means producing new data when suitable examples do not exist in sufficient quantity.
Annotating means attaching labels, targets, or judgments to data so that a model or an evaluator can learn from it.
The diagram shows that all three activities lead toward the same destination: the data a model uses to learn or adapt. Curating decides which existing material is worth keeping, generating fills gaps where examples are missing, and annotating turns raw examples into examples with a target the model can learn from.
Tracing One Collection Through the Three Activities
Preparing Return-Policy Training Data
A team wants a model that answers customer questions about product returns. It has 200 existing support emails, but only a few of them ask about exchanges. Use curating, generating, and annotating to prepare the training data.
- 1Curate the existing emails
Select the emails that concern returns and exchanges, and organize them by topic so the collection suits the task. Suppose 160 remain after removing unrelated messages.
- 2Generate the missing examples
Exchange questions are underrepresented, so the team writes additional variants of exchange questions. Generating is used here because suitable examples do not exist in sufficient quantity.
- 3Annotate every example
Each example receives a target, such as the correct policy category or a reference answer. Annotating attaches the judgment the model needs to learn from the example.
The team now has one collection that combines curated originals, generated variants, and annotations, ready for the processes described in later sections.
Close-Ended and Open-Ended Tasks
The difference that drives most of the extra work in AI engineering is the shape of the answer a task allows. A close-ended task chooses from predefined values. In traditional machine learning, most use cases are close-ended. Spam classification is the standard illustration: the output is either spam or not spam, and nothing else is possible.
Foundation models are open-ended. Their outputs are not restricted to a list fixed in advance, so a response might be a paragraph, a summary, or a piece of code. The number of acceptable answers is no longer small and fixed, which changes what the data work must handle.
Why Open-Ended Annotation Is Harder
The source makes a direct comparison: judging whether an email is spam is much easier than writing an essay. The same asymmetry appears in annotation. Labeling a close-ended example means choosing from a short list, and two careful annotators will usually agree.
Annotating an open-ended example means deciding whether a free-form answer is good. That judgment involves many dimensions at once, such as accuracy, completeness, tone, and appropriateness. An annotator must weigh several qualities together rather than pick one value from a list, which is why annotating open-ended queries is described as a much bigger challenge for AI engineering.
Structured Tables Versus Unstructured Data
A second difference concerns the form the data takes. Traditional machine learning engineering works more often with tabular data, organized into rows and columns with a defined set of fields. Foundation models work with unstructured data such as raw text, images, or audio, where there is no fixed grid of fields to rely on. AI engineering works more with unstructured data than the tabular data typical of traditional machine learning.
| Aspect | Traditional machine learning | AI engineering with foundation models |
|---|---|---|
| Typical task | Close-ended, choosing among predefined values | Open-ended, with outputs not fixed in advance |
| Example output | Spam or not spam | A paragraph, a summary, or a piece of code |
| Data form | Tabular, rows and columns with defined fields | Unstructured, such as raw text, images, or audio |
| Preparation | Works within a fixed grid of fields | Requires different tools and different checks |
| Annotation difficulty | Usually a short choice, with high agreement | Judgment across many dimensions, much harder |
How the output type and data format differ between the two fields
Four Data Manipulation Processes
Data manipulation covers the processes that turn collected data into something a model can use well. The central work in AI engineering is deduplication, tokenization, context retrieval, and quality control. Each addresses a different kind of problem, so it helps to hold them as separate concerns even though they all serve the same purpose: making collected data usable and trustworthy for a model.
Deduplication removes repeated or near-identical training examples from the collection.
Tokenization converts text into the token units that the model reads.
Context retrieval brings in related material for a record. This article names it as one of the four core processes without going into its mechanics.
Quality control checks the data for problems and removes sensitive information and toxic data.
Tracing a Record Through the Pipeline
Follow one scraped customer chat record through the processes. The record starts as raw text, and each step changes what the collection holds. The walkthrough uses the illustrative order from the diagram, since the source does not require one fixed sequence.
One Chat Record Moving Through Data Manipulation
The collection contains two identical copies of a chat in which a customer asks about a late delivery. One copy includes the customer's full home address, and the agent's reply contains an insulting phrase. Trace how the processes treat this record.
- 1Deduplication
The two identical copies are reduced to one. Keeping both would give the model the same example twice.
- 2Tokenization
The remaining text is converted into the token units the model reads, so the record is in the form the model processes.
- 3Context retrieval
Related material for the delivery question is brought in alongside the record, as the process requires.
- 4Quality control
The home address is sensitive information and is removed. The insulting phrase is toxic and is removed as well. Both removals protect users and the model's later behavior.
One cleaned, tokenized record remains in the collection, with no duplicate copy and no sensitive or toxic content.
The table below shows the effect of deduplication alone on a small collection. Only the exact repeats are removed, and each distinct record stays.
| Record | Before deduplication | After deduplication |
|---|---|---|
| Chat A, delivery question | Present, copy 1 | Kept once |
| Chat A, delivery question | Present, copy 2 | Removed as a repeat |
| Chat B, refund question | Present | Kept |
| Chat C, exchange question | Present, copy 1 | Kept once |
| Chat C, exchange question | Present, copy 2 | Removed as a repeat |
A small collection before and after deduplication, with repeated copies removed and distinct records kept
Quality Control and Sensitive Data
Quality control is broader than the other three processes, because it explicitly includes removing sensitive information and removing toxic data. Those removals protect users and the model's later behavior, which is why they belong in the same family of work as the other steps.
Mistakes Beginners Make
Common mistake Assuming annotating open-ended outputs is as easy as annotating spam labels
What it looks likeLabeling a free-form answer as good or bad with no further criteria
Why it failsOpen-ended judgments involve many dimensions at once, such as accuracy, completeness, tone, and appropriateness, so agreement is much harder to reach.
Do this insteadDefine the dimensions the annotators should judge before labeling begins.
Common mistake Treating unstructured data like a table
What it looks likeApplying row-and-column checks to raw chat text or audio
Why it failsUnstructured data has no fixed grid of fields, so it requires different tools and different checks.
Do this insteadChoose tools and checks that suit raw text, images, or audio.
Common mistake Assuming curation alone is enough
What it looks likeUsing only the existing emails when exchange questions are rare
Why it failsCurating selects existing data. Generating is the activity used when suitable examples do not exist in sufficient quantity.
Do this insteadCheck coverage after curating, and generate additional examples where gaps remain.
Common mistake Keeping repeated copies because they look valid
What it looks likeKeeping two identical chat records in the collection
Why it failsRepeated examples are exactly what deduplication targets, and keeping them adds no new information.
Do this insteadDeduplicate so that each repeated or near-identical example is kept only once.
Common mistake Believing quality control only checks formatting, when it also removes sensitive and toxic data
Practice: Plan the Processes
A team has 1,000 scraped product reviews. Many are near-identical copies, some mention customer names, and a few contain insults. The team also needs each review labeled as positive or negative. Which processes apply to this collection, which activity does the labeling belong to, and in what order would you run the steps? Explain why the labeling task is simpler than annotating open-ended answers.
Hints
- Look for the activity that attaches a judgment to each example and decide whether it is close-ended.
- Repeated copies point to deduplication, and names and insults point to quality control.
- The source does not fix a required order, so justify whatever sequence you choose.
Key Takeaways
- 1Dataset engineering covers curating existing data, generating new data when examples are scarce, and annotating data with labels, targets, or judgments.
- 2Close-ended tasks choose from predefined values, while open-ended foundation model tasks do not, which makes annotating open-ended queries much harder.
- 3AI engineering works more with unstructured data than the tabular data typical of traditional machine learning.
- 4Data manipulation centers on deduplication, tokenization, context retrieval, and quality control, which includes removing sensitive and toxic data. The source does not fix their order.
At a glance
- Dataset engineering covers curating, generating, and annotating the data used to train and adapt AI models.
- Close-ended tasks choose from predefined values, while open-ended foundation model tasks produce outputs not fixed in advance, which makes annotating open-ended queries much harder.
- AI engineering works with unstructured data such as text, images, and audio, unlike the tabular data typical of traditional machine learning.
- Data manipulation centers on deduplication, tokenization, context retrieval, and quality control, and quality control includes removing sensitive and toxic data.