Training, Testing, and Publishing Your Model
Start course

This course focuses on how to use the LUIS (Language Understanding Intelligent Service) portal to create new LUIS models, how to enrich them with intents, entities, and utterances, and how to train and apply apps. 

Not only will you get theoretical knowledge of LUIS and its components, but you'll also follow along with demonstrations from the LUIS portal to get a practical understanding of how to use the service.

Learning Objectives

  • Obtain a general understanding of what LUIS is and how to interact with it
  • Create LUIS resources
  • Learn about utterances, intents, and entities and how they are used in language understanding at a practical level
  • Learn how to test, train, and publish your LUIS models

Intended Audience

This course is made for developers or architects who would like to know more about how to use the Language Understanding Intelligent Service, LUIS, to improve their chatbot development and experience.


To get the most out of this course, you should have some Azure experience, particularly surrounding subscription and resource groups as well as chatbots and language services. Some developer experience, including familiarity with terms such as REST API and SDKs, would also be beneficial.


Finally, it's time to train, test, and start using our LUIS model. The next thing we need to do is to train our LUIS model. This is the process of teaching your LUIS app to perform natural language understanding, based on the intents, entities, and utterances that we have created, as well as any prebuilt domain that we have added.

Remember that, as LUIS works with Active Learning, the training process is iterative. You might do an initial training to be able to publish your model, but you also need to periodically retrain that to reflect the new utterances sent by the users. There's a constant cycle of updating, retraining, and testing again. Remember that, as this has an associated cost, you do not need to retrain after every single change, just make sure you do it periodically enough.

We have mentioned that before, but you won't be able to train your model if an intent has zero utterances, so make sure you add at least one utterance to every intent. Ideally, though, make sure that you have at least 15 sentences per intent, for optimal prediction performance. Keep in mind that the training process is relatively fast, but not always immediate. In some situations, it might get queued and take a few minutes; If you want to know a bit more about the training process, this link is the Microsoft Docs article related to training LUIS apps.

After training our LUIS app, it's time to test it. The LUIS portal has a really handy interface that allows you to test the model interactively, like if you're using a chat bot, by clicking on the Test button; To test a new utterance, just type it in the chat window and press Enter. LUIS will return the utterance, its top intent, and the confidence level of that intent.

The interface also has an inspect link with many much more details, including the intents and entities detected, the confidence level of each one of them, the type of entities found, and optionally the sentiment of the text, if you have enabled sentiment detection. More on that later in this video.

This interface also allows you to add your test utterance to the model, and you can even see the raw JSON output that was returned. Also, you can also compare the results of your currently trained model with the results of your published model. For example, if you have just trained the model but didn't publish it yet, you might want to see if the new training improved the accuracy of your LUIS app before you push that to production. Keep in mind that, because this testing runs against your live service, there will be an associated cost. However, as LUIS is a really cheap service, this shouldn't be something to worry much about.

Finally, as much as I absolutely love the chat interface for testing utterances, I must admit that it's not very practical if you want to test dozens of sentences. Therefore, LUIS also offers an option to perform batch testing, which allows you to upload a JSON file with up to 1000 utterances at once.

The final step before going to production is to publish your model. Publishing is what will make your LUIS app available as an HTTP endpoint and, therefore, ready to accept new requests. LUIS allows you to have two publishing slots, staging and production so that you can optionally implement a phased rollout of your app. When you're publishing the app, just tell which endpoint you're deploying it to.

When publishing, there are two options to connect LUIS to other cognitive services. The first one is Sentiment Analysis, which is part of Text Analytics. This is a quite handy option for chatbots, as it will allow you to detect sentiment in your users' responses. For example, if you notice that your customer is getting upset, you can implement some code logic to escalate the conversation to a human operator. This is a best practice for chatbots, and recommended by Microsoft.

The sentiment score will range from 0 to 1, where 1 means that the customer is very happy. And the best part, you donut even have to provide a Text Analytics key, and there's no charge for using this option; The other option is Speech Priming. If your bot works not only through text, but through voice as well, this allows LUIS to perform both language understanding and speech conversion at one go, instead of having to rely on an external speech service as you won't have to call two endpoints, therefore improving the user experience for your chat bot customers.

In case you want to know a bit more about the publishing process, this link is the official unit on Microsoft Learn for the exam, on training, testing, and publishing a LUIS app. It also shows how to perform these steps with either C# or Python code. Also, the second link is the Microsoft Docs page for publishing resources.

Let's now jump to a demo and see how we can wrap up our LUIS app and make it available through an endpoint.

About the Author

Emilio Melo has been involved in IT projects in over 15 countries, with roles ranging across support, consultancy, teaching, project and department management, and sales—mostly focused on Microsoft software. After 15 years of on-premises experience in infrastructure, data, and collaboration, he became fascinated by Cloud technologies and the incredible transformation potential it brings. His passion outside work is to travel and discover the wonderful things this world has to offer.