Concepts / Curating Data for Model Training

Curating Data for Model Training

The goal of a task is fixed, but the best sequence of steps depends on the performer. Training data should reflect the steps that suit the model, not merely the steps a human happened to take.

  • Programming

Starting From a Simple Question

Imagine you want a model to find the cheapest train ticket between two cities. Before any training begins, someone has to decide what the model should learn to do. A person would typically open a browser, type the route into a search bar, and click through the results one by one. A model could instead be trained to send a single request to a search interface that returns the results directly. Both approaches reach the same goal, so the training data you collect determines which path the model learns.

This article is about that choice. A model's tool use ability can be improved by showing it examples of tool use, and the way those examples are gathered and cleaned shapes what the model learns. The sections below follow one idea from start to finish: training data is not automatically good because it came from a person doing the job, and it is not finished until it has been checked against three criteria.

The Appeal of Recording Human Work

A natural first idea for teaching a model to use tools is to watch people do the job and record what they do. If a person can search the web, book a room, or run a spreadsheet calculation, a faithful record of that person's steps seems like the best possible training material. The appeal is easy to understand: the human already knows how to finish the task, so copying the human looks like the shortest route to a capable model.

The source does not say this belief is entirely wrong. Its warning is narrower: treating human behavior as the ideal target is the mistake to avoid. Human steps are a useful reference point, but they are not the same thing as the steps a model should take.

Why Efficiency Depends on Who Acts

The source makes a direct claim: human annotations might not be ideal for AI agents. The reason is that the efficiency of an action depends on who performs it. A human may prefer a visual web interface, because that is how a person sees and interacts with a page. A model can often call an API directly, which means it does not need to click through a page at all. Those two preferences produce very different sequences of steps for the same goal.

This means a record of human steps may describe a route the model should never take. The ticket example makes this concrete. The human routine of opening a browser and clicking result by result is efficient for a person working with a screen. For a model that can send a request to a search interface, the same routine adds steps that serve no purpose for it.

Key point

The goal of a task is fixed, but the best sequence of steps depends on the performer. Training data should reflect the steps that suit the model, not merely the steps a human happened to take.

Where Expert Knowledge Fits

This does not mean human expertise is useless. The source recommends using domain experts to write tool use data. In this arrangement, each prompt is a task that needs tools, and each response is the set of actions that completes it. Experts know what the tasks are and which tools they require. The caution is about the form of the demonstration, not the value of the knowledge behind it.

Experts can also leave steps out when they are asked to explain their work. They may forget a step, or judge it unimportant even when it matters for the outcome. For this reason the source says it is often necessary to observe how humans perform these tasks in order to ensure accuracy. Observation catches what the explanation omits, while expertise supplies the tasks and the tools that each task calls for.

Adjusting a Raw Human Demonstration

A raw demonstration usually contains more than the agent needs. It may include hesitations, detours, and steps that exist only because a person was reading a screen. Before the demonstration is used for training, it should be checked and cleaned so that what remains is the sequence the agent should actually learn. The diagram below contrasts the two versions of the same ticket search.

Open browserSend one searchrequestType route intosearch barReceive resultsClick result oneClick result twoRead prices by eyethenthenthenthenthen
What changes between the raw human demonstration of the ticket search and the cleaned version the agent should be trained on?

In the cleaned version, the browsing steps are gone because the agent reaches the same results through a direct request. The goal is unchanged. Only the path the agent is trained to follow has been replaced with one suited to the performer. This is the kind of adjustment the source has in mind when it says human demonstrations may need to be checked before they are useful for an AI agent.

Single-Turn and Multi-Turn Data

Before collecting any data, you must decide how the interaction should be structured. The source asks you to consider whether your application needs single-turn data, multi-turn data, or both. The distinction depends on how many exchanges a task requires before it is finished. A task that is completed by one reply is single-turn. A task that takes several exchanges, or several messages within one reply, is multi-turn.

FeatureSingle-turn dataMulti-turn data
Exchanges neededOne exchange finishes the taskSeveral exchanges finish the task
RhythmUser speaks, AI replies once, turns alternateAI may send several messages within a single turn
DestinationsEvery AI message goes to the userMessages may be directed to different destinations
Typical useSimple question and answerTool use, such as sending code to an interpreter and explaining to the user

Single-turn and multi-turn data differ in how many messages a task needs and where those messages go.

Ordinary conversation data assumes a simple rhythm. The user speaks, the AI replies with one message, and the turns alternate. Tool use breaks that rhythm. The AI may need to produce several messages within a single turn, and each message may be directed to a different destination. The source's example is an AI that sends one message to a code interpreter, which runs the code, and another message to the user to explain what it is doing.

Following One Tool-Use Exchange

Follow a single exchange in order. The user sends a request. The AI model sends a message to the code interpreter, which runs the code and returns a result. The AI then sends a second message to the user to explain what happened. Each message feeds the next, and the destination of every message is part of what the model must learn.

Usersends the requestAI modelone turn, several messagesCode interpreterruns the code1. request2. code message3. result4. explanation
In what order do the user message, the assistant's tool call, the tool result, and the final assistant reply appear, and how does each message feed the next?

Notice that the AI model appears twice in the middle of the sequence. Its message to the interpreter and its message to the user come from the same AI turn. A dataset that records only the user and the AI as two parties would hide the fact that the AI's output had two different destinations.

The Multi-Message Chat Format

To handle this structure, the Llama 3 authors (Dubey et al., 2024) designed a multi-message chat format. It has two main parts. Message headers specify the source and destination of each message. Special termination tokens mark where the human and AI turns begin and end. Together these let training data express which message goes where, which a plain alternating transcript cannot show.

Mistakes Teams Make With Training Data

  • Common mistake

    Copying human steps exactly because they came from a real person

    What it looks like

    Keeping the browse-type-click routine in the ticket-search data when the agent can send a direct request

    Why it fails

    A step that is efficient for a human may be inefficient for a model, so a faithful record can teach a route the model should never take

    Do this instead

    Check each demonstration and clean it so the remaining steps suit the agent

  • Common mistake

    Trusting the expert's written explanation alone

    Why it fails

    Experts may forget steps or judge them unimportant even when they affect the outcome

    Do this instead

    Observe how humans perform the task to confirm the explanation is accurate

  • Common mistake

    Storing a multi-message AI turn as one message

    Why it fails

    The destination of each message is lost, and the model cannot learn which message goes where

    Do this instead

    Use the multi-message chat format with message headers and termination tokens

  • Common mistake

    Only adding new examples and never removing bad ones

    Why it fails

    Curation works in two directions, and existing bad examples keep teaching the bad behavior

    Do this instead

    Remove examples that teach unwanted behavior as well as creating examples that teach the new behavior

Curation Adds and Removes

Curation is often pictured as adding material, but the source defines it in two directions. Data curation means creating new data to help a model learn new behaviors, and removing existing data to help a model unlearn bad behaviors. Removal matters as much as creation.

The source gives a concrete case. Imagine a chatbot that users complain is arrogant. When asked to verify whether a statement is factually correct, it confirms the fact and then produces an unsolicited rewrite of the statement. Investigating the training data reveals several annotations that include unsolicited suggestions. The fix has two parts: request removal of those examples from the training data, and request new examples that demonstrate fact-checking without unsolicited rewriting.

Three Criteria for Judging a Dataset

At a high level, data curation follows three criteria: data quality, data coverage, and data quantity. Each application may need data with different characteristics, and different training phases may need different data mixes, but these three criteria apply throughout. The diagram shows how the three criteria all judge the same training decision.

Data curationData qualityare the examples goodData coverageis the right mix presentTraining decisionData quantityis there enoughjudged byjudged byjudged byall three must passall three must passall three must pass
How do data quality, data coverage, and data quantity relate to each other, and how does a training-data decision get evaluated against all three?

The three criteria are separate questions, so a dataset can succeed on one and fail on another. A large collection of spoiled examples has quantity but not quality. A small set that contains only one kind of interaction may have quality but poor coverage. A good training decision has to hold up on all three at once.

In the real world

The source offers a cooking analogy. Think of model training as cooking, where the data fed into the model are the ingredients. Data quality is the quality of the ingredients, since a meal cannot be good if the ingredients are spoiled. Data coverage is the right mix of ingredients, such as not using too much or too little sugar. Data quantity is how many ingredients you should have.

Applying the Criteria to the Chatbot Case

Worked example

Judging a fix for the arrogant chatbot

Users say the chatbot is arrogant. It confirms a fact and then adds an unsolicited rewrite of the statement. Should the team only add new examples of fact-checking, or should it also remove existing examples? Evaluate the decision against the three criteria.

  1. 1
    Check quality

    Several existing annotations include unsolicited suggestions. Those examples are of poor quality for this behavior, so they should be removed from the training data.

  2. 2
    Check coverage

    The data must include examples that demonstrate fact-checking without unsolicited rewriting. Without them, the model has no clear example of the behavior the team wants.

  3. 3
    Check quantity

    Enough new examples must be added to teach the behavior, but adding them alone is not sufficient, because the bad examples would keep teaching the unwanted rewrite.

  4. 4
    Decide

    The fix needs both removal and addition. Removing the bad examples and adding good ones together addresses quality, coverage, and quantity at once.

Result

The correct decision is to remove the annotations containing unsolicited suggestions and to request new examples of fact-checking without rewriting. Adding examples alone would leave the bad behavior in the data.

Judging a New Training Decision

MEDIUM

A team building a model to use a calendar tool collects 5,000 examples written by a scheduling expert. Nearly all of them book one meeting with a single attendee. Using the three criteria of data quality, data coverage, and data quantity, decide whether the dataset is ready for training, and say which criterion it fails.

Hints
  • Ask first whether the examples are good, then whether they represent the range of tasks the model needs, and only then whether there are enough of them.
  • Think about the difference between having many examples and having examples of many kinds of interaction.
  • Consider whether the expert's examples would show multi-message tool use if the calendar tool returns a result the model must explain.

Key Takeaways

  1. 1
    A model's tool use ability can be improved by showing it tool use examples, typically written with domain experts who know which tasks need which tools.
  2. 2
    Human demonstrations may need checking and cleaning, because what is efficient for a person may not be efficient for a model.
  3. 3
    Tool use often needs multi-message chat data, where message headers and termination tokens show which message goes where.
  4. 4
    Curation both creates new data and removes bad data, and it is judged by data quality, data coverage, and data quantity.

At a glance

  • A model's tool use ability can be improved by showing it tool use examples, typically written with domain experts who know which tasks need which tools.
  • Human demonstrations may need checking and cleaning, because what is efficient for a person may not be efficient for a model.
  • Tool use often needs multi-message chat data, where message headers and termination tokens show which message goes where.
  • Curation both creates new data and removes bad data, and it is judged by data quality, data coverage, and data quantity.

Related concepts

More concepts starting with C