Data Manipulation in AI Engineering
In AI engineering, data manipulation is described as four activities: deduplication, tokenization, context retrieval, and quality control.
Two Labeling Jobs Compared
Imagine you are building a system and someone asks you to prepare training examples for it. For one task, each example is an email that needs a single label. For another task, each example is a request to write a long essay. Both jobs involve putting human judgment into data, but they do not feel equally hard. This article explains why, and it uses that difference to introduce the data work that AI engineering adds on top of traditional machine learning.
What do you think happens?
Which of these two jobs would take more effort to label well, labeling emails or labeling essay requests?
Reveal answer
Labeling the essay requests takes more effort to label well.
Deciding whether an email is spam is a choice from a short menu, and two annotators who understand the task will usually agree. Judging an essay depends on many factors, so the annotator's decision is far less constrained.
Close-Ended Tasks and Fixed Labels
A close-ended query is one whose outputs are predefined. The possible answers form a known list before any data is collected.
The clearest illustration is spam classification. The model has only two possible outputs, spam and not spam, so the label set is fully known in advance. Most traditional machine learning use cases fall on this close-ended side. Because the answer space is short and fixed, the labeling task reduces to choosing one item from a small menu.
Open-Ended Tasks Without Predefined Outputs
Foundation models change this picture because they are open-ended. Their outputs are not limited to a short list of values. A request to write an essay can be answered in countless ways, and no fixed list of correct answers exists. This means the question of what counts as a correct label becomes much less obvious.
The comparison shows the structural difference. A close-ended task has a short, fixed set of acceptable labels, so the labeler's job is to pick one. An open-ended task has no such set, so the labeler's job becomes judging whether a response is good, which is a different kind of decision.
Why Annotators Diverge on Open-Ended Queries
Annotation requires an annotator to decide what the correct label is. For a close-ended task, that decision is a selection from a short menu, and two annotators who understand the task will usually land on the same choice. For an open-ended task, the annotator must produce or judge something whose quality depends on many factors, so the decision is far less constrained. Two careful annotators can reasonably reach different judgments, which is why the source concludes that data annotation is a much bigger challenge for AI engineering.
Labeling an essay request
An annotator is asked to label whether a model's response to a request for a long essay is acceptable.
- 1Read the request
The request asks for a long essay on an open-ended topic, so many different essays would satisfy it.
- 2Check for a fixed answer
There is no short list of predefined outputs to choose from, so the annotator cannot simply select a label.
- 3Judge against many factors
The annotator must weigh qualities such as relevance, organization, and completeness, each of which involves judgment.
- 4Compare with another annotator
A second annotator may weigh those factors differently and reach a different verdict, and both verdicts may be defensible.
The label is hard to make consistent because the decision depends on judgment rather than on selecting from a known menu.
Tabular Versus Unstructured Data
The source identifies a second difference between the two engineering settings: the kind of data each one works with. Traditional ML engineering works more with tabular data, meaning data organized into rows and columns with a defined structure. Foundation models work with unstructured data, such as free-form text and other content that does not arrive in a fixed grid of fields.
Because unstructured data has no built-in schema, the steps used to prepare it look different. A table already tells you which column holds which field. Free-form text does not, so the data work has to be designed for content whose structure is not given in advance. This is the reason AI engineering adds its own set of data manipulation activities.
The Four Data Manipulation Activities
In AI engineering, data manipulation is described as four activities: deduplication, tokenization, context retrieval, and quality control. The map below shows how these pieces relate to the single umbrella idea. It shows the four activities as parts of one category and does not claim a fixed order among them.
Deduplication Before and After
To see what deduplication changes, consider a small illustrative dataset of support records. Two records contain almost the same text, differing only by punctuation. Removing the near-duplicate leaves a dataset where each distinct record appears once.
In the before state, the password reminder appears twice. In the after state, it appears once and the refund summary is untouched. The point is that deduplication changes the dataset's contents while leaving the distinct information in place.
Common Mistakes When Reasoning About Labels
Common mistake Assuming every AI labeling task is as easy as spam classification
What it looks likeTreating a request for an essay the same way as an email that needs one label
Why it failsSpam classification has a fixed set of two outputs, but open-ended outputs have no predefined list, so the labeling decision is far less constrained.
Do this insteadAsk first whether the outputs are predefined. If they are not, plan for more effort and for disagreement between annotators.
Common mistake Thinking that a disagreement between annotators means one of them is simply wrong
What it looks likeTwo annotators judge the same essay response differently and one label is discarded
Why it failsOpen-ended quality depends on many factors, so two careful judgments can both be defensible.
Do this insteadTreat divergent labels as a signal about the task's ambiguity and design the labeling process around it.
Common mistake Treating deduplication, tokenization, context retrieval, and quality control as a fixed sequence when the source does not claim an order
Quality Control Beyond Accuracy
Because quality control has these specific responsibilities, the quality question for an open-ended dataset is wider than whether an annotator picked the right option. It also asks whether the data should be in the dataset at all.
Practice: Sorting Labeling Tasks
For each of these tasks, decide whether it is close-ended or open-ended, and explain how that choice affects how hard it is to label consistently: (1) sorting an email as spam or not spam, (2) writing a long essay in response to a prompt, (3) deciding whether a sentence contains sensitive information.
Hints
- Ask whether the possible outputs are a short, predefined list.
- Close-ended tasks usually have a fixed label set, so annotators usually select from a menu.
- Task 3 is about the quality control activity, which the source names as including removal of sensitive information.
Key Takeaways
- Close-ended queries have predefined outputs, such as spam or not spam, so their labels can be selected from a short, known menu.
- Open-ended queries have no predefined outputs, so annotating them is much harder and annotators' judgments can diverge.
- Traditional ML engineering works more with tabular data, while foundation models work with unstructured data, which changes the preparation steps.
- AI engineering data manipulation covers deduplication, tokenization, context retrieval, and quality control, including removing sensitive information and toxic data.