Concepts / Single-Turn and Multi-Turn Training Data

Single-Turn and Multi-Turn Training Data

Think of model training as cooking, where the data fed into the model are the ingredients.

  • Programming

Copying a Person's Steps

Suppose you want an AI model to use tools, such as a web search, a booking system, or a spreadsheet calculation. A natural first idea is to watch people do the job, record what they do, and use that record as training material. If a person can find a train route, the reasoning goes, then a faithful record of that person's steps should be the best teaching material available. This idea is not entirely wrong, but treating human behavior as the ideal target is the mistake this article is about.

A model's tool use ability can be improved by showing it tool use examples. Those examples are typically written with domain experts, who know which tasks need which tools. What the examples look like, and where their steps come from, shapes what the model learns.

What do you think happens?

Suppose you want a model to find the cheapest train ticket between two cities. A person would typically open a browser, type the route into a search bar, and click through the results one by one. Which approach should the model be trained to use: copying this click-by-click routine, or sending a single request to a search interface that returns the results directly?

  • Copy the click-by-click routine a person uses

  • Send a single request to a search interface that returns results directly

Reveal answer
Answer:

Send a single request to a search interface that returns the results directly.

A human may prefer a visual web interface, while a model can often call an API directly. Efficiency depends on who performs the action, so a record of human clicks may describe a route the model should never take.

Why Human Steps Need Adjustment

Human annotations are not automatically ideal for AI agents. What is efficient for a human may not be efficient for a model. The efficiency of an action depends on who performs it, and a human and a model often have very different means of doing the same task. A human may prefer a visual web interface, while a model can often call an API directly. Those two preferences produce very different sequences of steps for the same goal.

Open browserSingle search requestType route in searchbarResults returneddirectlyClick results one byonethenthenthen
How does a raw human demonstration of the train ticket task change after adjustment so that it fits what the agent can actually do and see?

Adjustment changes the form of the demonstration, not the knowledge behind it. The diagram above is a generated illustration of the idea: the human's browser routine is replaced by a single request that the agent can make and that returns usable results.

Domain experts remain valuable. The recommended approach is to have experts write tool use data, where 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 applies to the form of the demonstration.

Experts can also leave steps out when they explain their work. They may forget a step, or judge it unimportant even when it changes the outcome. For this reason it is often necessary to observe how humans perform these tasks in order to ensure accuracy. Observation catches what the explanation omits.

Single-Turn and Multi-Turn Structure

Before collecting data, you must decide how the interaction should be structured. Whether an application needs single-turn data, multi-turn data, or both depends on how many exchanges a task requires before it is finished.

Ordinary conversation data follows 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. In one example, an AI sends one message to a code interpreter, which runs the code, and another message to the user explaining what it is doing.

User messageUser messageOne AI replyAI message to tooldestination: toolAI message to userdestination: userMessage headerssource and destinationalternatesame AI turnsame AI turn
How does a single-turn example differ in structure from a multi-turn example, and what gets added across the conversation?

The comparison above shows what changes. A single-turn example pairs one user message with one AI reply. A multi-turn example can contain several AI messages inside one turn, and the destination of each message must be recorded. The extra structure is what lets training data show that one AI turn sent a message to a tool and a different message to the user.

Tracing One Tool Call in a Chat

Follow a single exchange from start to finish. The order of messages matters, because each message is sent to a specific destination. The sequence below traces a tool call. The user asks a question, the model sends code to a tool, the tool returns a result, and the model then answers the user using that result.

UserModelCode interpreter1. Question2. Code message3. Result returned4. Answer using result
In what order do the user, model, tool, and model messages appear when the model calls a tool and then uses the result to answer?

Notice that mess 2 and 4 come from the same AI turn, yet they travel to different places. A training pipeline that stores each turn as one undivided message would lose the destination information the model needs to learn. A plain alternating transcript cannot show which message goes where.

How the Llama 3 Chat Format Records Destinations

To handle multi-message turns, 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.

  • Message headers: record the source and destination of each message inside a turn
  • Termination tokens: mark where a human turn or an AI turn begins and ends
  • Together: allow one AI turn to contain several messages sent to different destinations

Curation Adds and Removes Data

Curation is often pictured as adding material, but data curation works in two directions. It 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.

Worked example

A Chatbot That Seems Arrogant

Users complain that a chatbot 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. What should be done to the training data?

  1. 1
    Investigate the training data

    Investigation reveals several annotations that include unsolicited suggestions. These examples teach the behavior users dislike.

  2. 2
    Request removal

    The examples with unsolicited rewrites should be removed from the training data, because they teach a bad behavior.

  3. 3
    Request new examples

    New examples should demonstrate fact-checking without unsolicited rewriting, so the model learns the desired behavior.

Result

The fix has two parts: remove the examples that teach the bad behavior, and add examples that teach the good one.

Three Criteria for Curating 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 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.

CriterionQuestion it answersCooking analogyWhat failure looks like
Data qualityAre the examples good?Ingredients are not spoiledA large collection of spoiled examples
Data coverageDo the examples cover the right range of interactions?The right mix, neither too much nor too little sugarA small set with only one kind of interaction
Data quantityAre there enough examples?How many ingredients you haveToo few examples to teach the behavior

The three curation criteria as separate questions

Mistakes Beginners Make with Training Data

  • Common mistake

    Treating a recorded human routine as the ideal target for the model

    What it looks like

    Training the model to click through search results one by one, the way a person does in a browser

    Why it fails

    Efficiency depends on who performs the action, and a model can often call an API directly

    Do this instead

    Adjust the demonstration so it fits what the agent can actually do and see

  • Common mistake

    Trusting an expert's explanation as a complete record of their steps

    What it looks like

    An expert forgets a step, or judges it unimportant when it actually changes the outcome

    Why it fails

    Explanations can omit steps that matter for the result

    Do this instead

    Observe how humans perform the task to ensure accuracy

  • Common mistake

    Storing a multi-message AI turn as one undivided message

    What it looks like

    Keeping one AI message that contains both the code for a tool and an explanation for the user

    Why it fails

    The destination of each message is lost, so the model cannot learn where each message should go

    Do this instead

    Use message headers and termination tokens to record source and destination

  • Common mistake

    Thinking curation only means adding data

    What it looks like

    Keeping every existing annotation, including ones with unsolicited rewrites

    Why it fails

    Existing data can teach bad behaviors that the model then learns

    Do this instead

    Remove examples that teach bad behaviors and create examples that teach good ones

  • Common mistake

    Judging a dataset by its size alone, ignoring quality and coverage

Deciding on a Training Set

MEDIUM

A team wants a model that can look up flight prices and then explain the result to the user. Their draft dataset has 5,000 examples, but all of them are single-turn question and answer pairs with no tool calls, and several examples were written from a recording of a person clicking through a booking website. Using the three criteria of quality, coverage, and quantity, which problems should the team fix first, and what changes would you request?

Hints
  • Ask whether the dataset has the right structure for tool use, which relates to single-turn versus multi-turn data
  • Ask whether the recorded clicks are the efficient route for a model, which relates to data quality
  • Consider whether a large number of examples can make up for missing tool-use interactions

Summary of Training Data Decisions

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 adjustment, because what is efficient for a person may not be efficient for a model, and experts may leave out steps when they explain their work.
  • Tool use often needs multi-message chat data, where one AI turn sends messages to different destinations, recorded with message headers and termination tokens such as those in the Llama 3 multi-message chat format.
  • Curation creates new data to teach new behaviors and removes existing data that teaches bad ones, and it is judged by three separate criteria: data quality, data coverage, and data quantity.

Related concepts

More concepts starting with S