Concepts / Dataset Engineering: Curating, Generating, and Annotating Data

Dataset Engineering: Curating, Generating, and Annotating Data

Both jobs involve putting labels on data, but the work they demand is very different.

  • Programming

Predicting Which Labeling Job Is Harder

Imagine someone asks you to prepare training examples for a system. In one task, each example is an email and needs a single label. In another task, each example is a request to write a long essay. Both jobs involve putting labels on data, but the work they demand is very different. Dataset engineering is the discipline that covers how data is curated, generated, and annotated so that an AI system can learn from it. This article follows how the labeling problem changes as the task moves from a short menu of answers to an open-ended one.

What do you think happens?

Which of these two jobs would take more effort to label well: labeling emails as spam or not spam, or labeling requests to write a long essay? Commit to an answer before reading on.

  • Labeling the emails as spam or not spam

  • Labeling the essay requests

  • Both take about the same effort

Reveal answer
Answer:

Labeling the essay requests takes more effort to label well.

The source compares the two directly: it is easier to determine whether an email is spam than to write an essay. Spam labeling picks one value from a short, fully known menu, while judging an essay depends on many factors. The rest of this article explains why that gap exists and what it means for dataset work.

Close-Ended and Open-Ended Outputs

Definition

A close-ended query is one whose outputs are predefined. An open-ended query is one whose outputs are not predefined, so there is no short fixed list of acceptable answers to choose from.

The clearest example of a close-ended task is spam classification. The model has only two possible outputs, spam and not spam, so the full label set is known before any data is collected. Most traditional machine learning use cases fall on this close-ended side. Because the answer space is small and fixed, the question of what the correct label is has a straightforward answer for each example.

Foundation models change this picture. Their outputs are open-ended, so they are not limited to a short list of values. A request to write an essay can be answered in countless ways, and many of those answers may be acceptable. This means the question of what counts as a correct label becomes much less obvious. Before you can label data, you have to know what the set of possible correct outputs looks like, and for open-ended tasks that set is not a short menu.

SpamEssay response Amay be validNot spamEssay response Bmay be validEssay response Cmay be valid
For a close-ended task, the correct label is picked from a short predefined menu. For an open-ended task, many different responses can be valid, so there is no fixed menu to pick from.

Read the diagram as a question about the output space. On the close-ended side, the labeler is choosing one value from a known set of two. On the open-ended side, the labeler is facing a set of possible responses with no fixed boundary, and the diagram shows several of them as candidates. The difference is not about how many examples there are. It is about how many outputs count as correct.

Why Annotation Gets Harder

Annotation means deciding what the correct label is for an example. The source points out that this decision is what makes annotation hard. For a close-ended task, the decision is a selection from a short menu. Two annotators who understand the task will usually land on the same choice, because the options are narrow and the criteria are clear.

For an open-ended task, the annotator must produce or judge something whose quality depends on many factors. There is no single menu entry to select. The annotator has to weigh several qualities of a response, and the decision is far less constrained. This is the reason the source concludes that data annotation is a much bigger challenge for AI engineering.

Worked example

Labeling a Batch of Close-Ended and Open-Ended Examples

An engineer has two batches of examples. Batch A contains emails that need a spam or not-spam label. Batch B contains requests to write essays, where each annotator must decide whether a response is a good answer. The engineer wants to know which batch is likely to produce more disagreement between annotators.

  1. 1
    Identify the output space for Batch A

    Each email can only be labeled spam or not spam. The label set is fully known in advance, so the annotator is choosing from two values.

  2. 2
    Identify the output space for Batch B

    Each essay request could be answered in many different ways, and many of those answers may be acceptable. There is no predefined list of correct outputs to select from.

  3. 3
    Compare the decisions the annotators must make

    In Batch A, two informed annotators will usually pick the same label. In Batch B, each annotator must judge quality across many factors, so their judgments can diverge more.

  4. 4
    Conclude which batch needs more annotation effort

    Batch B is harder to annotate consistently, which matches the source's claim that open-ended annotation is much harder than close-ended annotation.

Result

Batch B, the open-ended essay requests, is more likely to produce disagreement and needs more careful annotation effort. This example is an illustration built for this article and is not taken from the source.

Traditional ML Data Versus Foundation Model 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.

AspectTraditional ML engineeringFoundation model engineering
Typical data formTabular data in rows and columnsUnstructured data such as free-form text
StructureA defined structure with fieldsNo fixed grid of fields
Typical task typeMostly close-ended, such as spam classificationOpen-ended outputs
Labeling difficultyUsually a selection from a short menuJudging quality across many factors

Contrast between the two engineering settings, as described in the source

Because unstructured data has no built-in schema, the steps used to prepare it look different. Tabular data already tells you where each value lives. Free-form text does not, so extra preparation steps are needed before a model can use it well. This is the reason AI engineering adds data manipulation work on top of what traditional ML engineering already does.

Data Manipulation in AI Engineering

In AI engineering, data manipulation is described as being about four activities: deduplication, tokenization, context retrieval, and quality control. These four activities form one umbrella category. The diagram below shows how they relate to that single idea.

Data manipulationDeduplicationRemoving sensitiveinformationTokenizationRemoving toxic dataContext retrievalQuality controlincludesincludesincludesincludesincludesincludes
Data manipulation in AI engineering groups four activities. Quality control has its own specific responsibilities: removing sensitive information and removing toxic data. The map does not claim a fixed order among the four activities.

Read the map as a list of responsibilities rather than a pipeline. Each of the four activities is a distinct kind of work, and the subsections below take them one at a time.

Mistakes Beginners Make With Open-Ended Labels

  • Common mistake

    Assuming every task can be labeled with a short fixed menu of answers

    What it looks like

    Treating essay requests as if each one had a single correct label from a predefined list.

    Why it fails

    The source notes that open-ended queries do not have predefined outputs, so the set of correct responses is not a short list.

    Do this instead

    First check whether the output space is predefined. If it is not, plan for guidelines that describe how to judge quality.

  • Common mistake

    Expecting annotators to agree as easily on open-ended tasks as on close-ended ones

    Why it fails

    A close-ended annotator selects from a short menu, while an open-ended annotator must judge quality across many factors, which is far less constrained.

    Do this instead

    Expect more disagreement on open-ended work and budget more effort for annotation.

  • Common mistake

    Treating foundation model data the same way as tabular data

    Why it fails

    Traditional ML engineering works more with tabular data, while foundation models work with unstructured data that has no fixed grid of fields.

    Do this instead

    Add preparation steps such as tokenization and context retrieval that suit unstructured text.

  • Common mistake

    Forgetting that quality control includes removing sensitive and toxic data, not only fixing wrong labels

Sorting Tasks by Output Space

EASY

For each task below, decide whether it is close-ended or open-ended, and state which labeling job would likely need more annotation effort: (a) labeling a message as urgent or not urgent, (b) writing a short story about a given theme, (c) deciding whether a sentence is written in English or another language.

Hints
  • Ask whether the outputs are predefined and short in number.
  • Ask whether many different responses could be correct.

Key Takeaways

  • Close-ended queries have predefined outputs, such as spam or not spam, while open-ended queries do not have predefined outputs.
  • Annotating open-ended queries is much harder than annotating close-ended ones, because the annotator must judge quality across many factors instead of selecting from a short menu.
  • Traditional ML engineering works more with tabular data, while foundation models work with unstructured data, which changes how data must be prepared.
  • AI engineering data manipulation covers deduplication, tokenization, context retrieval, and quality control, including removing sensitive information and toxic data.

Related concepts

More concepts starting with D