Training

When your agent is trained, Dialogflow uses your training data to build a machine learning model specifically for your agent. You normally provide training data by directly entering training phrases to intents. You can also use the Training Tool to analyze, import, and export actual conversation data, and to improve your training data.

Execute training

By default, training is executed automatically every time you save your agent. After saving your agent, dialog windows appear that indicate training status. You should always wait until training completes before testing your agent.

If your agent has more than 780 intents, or if you have disabled the automatic training setting, you must manually execute training:

  1. Go to the Dialogflow Console.
  2. Select your agent near the top of the left sidebar menu.
  3. Click the settings settings button next to the agent name.
  4. Click the ML Settings tab.
  5. Click the Train button at the bottom of the page.

To execute training with the API, call the train method on the Agent type.

Training Tool

The Training Tool is used to review conversations your agent has had with end-users and to improve your training data. Using the tool, you can:

  • Review actual conversations and the intents that were matched for each conversational turn.
  • Add the end-user expressions from these conversations to the training phrases of the originally matched intents, different intents, or fallback intents.
  • Import conversation data you have prepared or captured from actual conversations.

The tool uses agent history data to load conversations, so logging must be enabled to use the tool. The Training Tool only shows end-user expressions. To view both agent and end-user conversation data, see the more complete agent history.

To open the Training Tool:

  1. Go to the Dialogflow Console.
  2. Select your agent near the top of the left sidebar menu.
  3. Click Training in the left sidebar menu.

Conversation list

When you open the tool, it shows the conversation list. This is a list of recent conversations in reverse chronological order. Each row in the list provides a summary of a conversation.

Conversation list screenshot

The following table describes each of the UI elements:

UI Element Description
Conversation The first end-user expression in the conversation.
Requests The number of conversational turns in the conversation.
No match The number of conversational turns for which no intent was matched.
Date The date that the conversation occurred or was imported.
refresh When a conversation is used to update training data (as described below), the status indicator for the row shows a green checkmark.

Training view

When you click a row in the conversation list, it opens the conversation in training view. The training view shows a list of conversational turns and provides controls to add this data to your training data.

When you edit the displayed data or click a task button on the right, you create training data update tasks that get queued for saving. Once you are done creating tasks, click the Approve button to execute all queued tasks and update your agent's model.

Training view screenshot

The following table describes each of the UI elements:

UI Element Description
Date The date that the conversation occurred or was imported.
Requests The number of rows for the conversation.
No Match The number of rows for which no intent was matched.
User Says The end-user expression for the row.
Intent The intent matched for this row when the conversation occurred. You can click the link to change the associated intent to a new or existing intent.
check Queues a task to add the end-user expression for the row as a training phrase to the currently selected intent. The icon turns green when a task is queued.
block Queues a task to add the end-user expression for the row as a training phrase to the default fallback intent. This creates a negative example. The icon turns orange when a task is queued.
delete Queues a task to delete the row. The icon turns red when a task is queued.
Approve Executes queued tasks for all rows.

Annotations

When looking at a conversation in training view, end-user expressions show matched entities as highlighted annotations. To add or edit an annotation:

  1. Click an annotation or select the words you want to annotate.
  2. Choose an existing entity from the menu.

Annotation screenshot

Import conversations

You can import conversation data files you have prepared or captured to the Training Tool. Importing conversations can be used to improve an existing agent. To upload a conversation, click the Upload button at the top of the page. Then, you can analyze this data for adding to training data as described above.

The following describes the file content format, its limitations, and the results:

  • Each uploaded file results in a single conversation in the Training Tool.
  • Requests are not sent to the detect intent API, therefore, no contexts are activated and no intents are matched.
  • A single text file or a zip archive that can contain up to 10 text files.
  • One upload cannot exceed 3 MB.
  • The files should only contain end-user expressions delimited by newlines.
  • Ideally, files should only include data that is useful as training phrases.
  • The order of the end-user expressions is not important.

Here is an example file:

I want information about my account.
What is my checking account balance?
How do I transfer money to my savings account?

Export conversations

You can export conversations from the conversation list. To export:

  1. Click the option more_vert button at the top of the page.
  2. Select Sample.
  3. Enter the number of samples desired.
  4. Click Extract.

Best practices

Use the Training Tool at various stages of development

Use the Training Tool at various stages of agent development, and refine your training data at each stage:

  • Before your agent is released to production, test it with a small group of users.
  • Shortly after your agent is released to production, examine if real conversations are behaving as expected.
  • Whenever significant changes are made to your agent, check that the new changes are behaving as expected.
  • Run the tool periodically for production agents, to perform regular analysis.

Import quality data

The following can often be useful sources of data:

  • Logs of conversations with human customer service agents.
  • Online customer support conversations (email, forums, FAQs).
  • Customer questions on social media.

You should avoid the following types of data:

  • Long-form, non-conversational end-user expressions.
  • End-user expressions that are not relevant to any of the intents in your agent.
  • Logs of things not said by end-users (for example, responses from customer service agents).