Understand what good utterances are for your LUIS app

Utterances are input from the user that your app needs to interpret. To train LUIS to extract intents and entities from them, it's important to capture a variety of different example utterances for each intent. Active learning, or the process of continuing to train on new utterances, is essential to machine-learned intelligence that LUIS provides.

Collect utterances that you think users will enter. Include utterances, which mean the same thing but are constructed in a variety of different ways:

  • Utterance length - short, medium, and long for your client-application
  • Word and phrase length
  • Word placement - entity at beginning, middle, and end of utterance
  • Grammar
  • Pluralization
  • Stemming
  • Noun and verb choice
  • Punctuation - a good variety using correct, incorrect, and no grammar

How to choose varied utterances

When you first get started by adding example utterances to your LUIS model, here are some principles to keep in mind.

Utterances aren't always well formed

It may be a sentence, like "Book a ticket to Paris for me", or a fragment of a sentence, like "Booking" or "Paris flight." Users often make spelling mistakes. When planning your app, consider whether or not you use [Bing Spell Check][(luis-tutorial-bing-spellcheck) to correct user input before passing it to LUIS.

If you do not spell check user utterances, you should train LUIS on utterances that include typos and misspellings.

Use the representative language of the user

When choosing utterances, be aware that what you think is a common term or phrase might not be correct for the typical user of your client application. They may not have domain experience. Be careful when using terms or phrases that a user would only say if they were an expert.

Choose varied terminology as well as phrasing

You will find that even if you make efforts to create varied sentence patterns, you will still repeat some vocabulary.

Take these example utterances:

Example utterances
how do I get a computer?
Where do I get a computer?
I want to get a computer, how do I go about it?
When can I have a computer?

The core term here, "computer", isn't varied. Use alternatives such as desktop computer, laptop, workstation, or even just machine. LUIS intelligently infers synonyms from context, but when you create utterances for training, it's still better to vary them.

Example utterances in each intent

Each intent needs to have example utterances, at least 15. If you have an intent that does not have any example utterances, you will not be able to train LUIS. If you have an intent with one or very few example utterances, LUIS will not accurately predict the intent.

Add small groups of 15 utterances for each authoring iteration

In each iteration of the model, do not add a large quantity of utterances. Add utterances in quantities of 15. Train, publish, and test again.

LUIS builds effective models with utterances that are carefully selected by the LUIS model author. Adding too many utterances isn't valuable because it introduces confusion.

It is better to start with a few utterances, then review endpoint utterances for correct intent prediction and entity extraction.

Punctuation marks

LUIS doesn't ignore punctuation marks, by default, because some client applications may place significance on these marks. Make sure your example utterances use both punctuation and no punctuation in order for both styles to return the same relative scores. If punctuation has no specific meaning in your client application, consider ignoring punctuation by using patterns.

Ignoring words and punctuation

If you want to ignore specific words or punctuation in the example utterance, use a pattern with the ignore syntax.

Training utterances

Training is generally non-deterministic: the utterance prediction could vary slightly across versions or apps. You can remove non-deterministic training by updating the version settings API with the UseAllTrainingData name/value pair to use all training data.

Testing utterances

Developers should start testing their LUIS application with real traffic by sending utterances to the prediction endpoint URL. These utterances are used to improve the performance of the intents and entities with Review utterances. Tests submitted with the LUIS website testing pane are not sent through the endpoint, and so do not contribute to active learning.

Review utterances

After your model is trained, published, and receiving endpoint queries, review the utterances suggested by LUIS. LUIS selects endpoint utterances that have low scores for either the intent or entity.

Best practices

Review best practices and apply them as part of your regular authoring cycle.

Next steps

See Add example utterances for information on training a LUIS app to understand user utterances.