Conversational AI is all about enabling a machine to have natural conversations with users. The key for a conversational VA to understand human interactions lies in its ability to identify the intention of the user (Intent Detection), extract useful information from their utterance (Entity Extraction), and map them to relevant actions or tasks (Dialog Task execution). The crucial idea here is understanding the natural language.understanding the natural language.
NLP is the science of deducing the intention and related information from natural conversations. The conversation flow in Kore.ai virtual assistants passes through various NLU engines and conversation engines before deciding upon action and response.
This document aims at providing an overview of the NLP flow within a Kore.ai virtual assistant and how you, as a developer, can leverage its features for an efficient and accurate VA response thus improving the user experience.
The Kore.ai X Platform employs a multi-pronged approach to natural language, which combines the following three models for optimal outcomes:
- Fundamental Meaning: A computational linguistics approach that is built on ChatScript. The model analyzes the structure of a user’s utterance to identify each word by meaning, position, conjugation, capitalization, plurality, and other factors.
- Custom Machine Learning (ML): Kore.ai uses state-of-the-art NLP algorithms and models for machine learning.
- Ontology-based Knowledge Graph Engine (KG): Kore.ai Knowledge Graph helps you turn your static FAQ text into an intelligent and personalized conversational experience.
With its three-fold approach, the Kore.ai XO Platform enables you to accelerate the NLU performance of the virtual assistant and achieve optimal NLU accuracy with relatively less training data. It automatically enables the NLP capabilities to all built-in and custom VAs, and powers the way they communicate, understand, and respond to a user request.
Kore.ai NLP Building Blocks
When a virtual assistant built on the Kore.ai XO Platform receives a user utterance, it is processed to identify the user intent, extract any additional information, and then answer the user via a task execution. NLP is mostly concerned with the first two – intent detection and entity extraction.
Steps in a conversation flow:
- The user utterance goes through a series of NLU engines for entity extraction and intent detection. The various NLU engines provided by the Kore.ai XO Platform are as follows:
- Fundamental Meaning Engine which breaks up the utterances based on the grammar constructs;
- Machine Learning Engine which classifies individual words in the utterance example-based auto-learning training process;
- Knowledge Collection Engine which mostly deals with FAQ type user queries, it can also be configured to trigger tasks in response to the user query;
- Traits Engine which is a multiclass classifier and can identify multiple categories in user utterances thus aiding in refining user intent detection;
- Small Talk Engine which adds human flavor to the conversations;
- Ranking and Resolver to score the results from the above engines and rank them according to the set business rules.
- You can extend the above out-of-the-box NLU functionality to use your own NLU engine. You can install the Bot Kit SDK and easily integrate the virtual assistant with any 3rd party NLP engines. The output from the 3rd party NLP engine complements the outputs from the Kore.ai NLU engines thus adding to the efficiency and accuracy of the engine.
- The winning intent along with the entities extracted then passes through the conversation engine for the actual task execution. This engine maintains the state or context of the conversation with information like user details, the previous intents requested by the user, and any other information as tagged by the business rules which would aid in providing a near-human conversation experience. The conversation engine uses this state information along with the following conditions to accept or reject the intent identified by the NLU engines
- Pre-conditions – if an intent has a set of predefined conditions configured and if any of these conditions are not satisfied the winning intent is then rejected. For example, bill payment intent should have the payee details available.
- Negative patterns – to capture the presence of a pattern that should not identify a particular intent. For example “I lost my card, how do I apply for a new card” should, instead of triggering “Apply Card” intent, attempt to disable the current card and report fraudulent activity due to the presence of the phrase “lost my card”
- Event handling – events defined for a welcome message, sentiment analysis, etc
- Other conditions like Interruption settings (to handle situations where another intent is identified during the course of an ongoing task) or Sentiment Analysis settings (user sounds angry and hence should be transferred to an agent) are crucial for the action to be taken.
- A response is generated and presented to the user based on the channel of interaction. The response could be a success message, information as requested by the user, or prompt for missing information.
In the previous section, we have seen the NLP process of the Kore.ai virtual assistant, but it needs some training on your part to ensure that the process proceeds as per your requirements. So, how do you train a fully functional VA to achieve the best results? How do you make maximum use of the features above?
We will see some basic guidelines for NLP training in this section, before going into the details of each of the NLU engines.
The first step in NLP training would be to define the scope of the VA, narrowing down the problem the Virtual Assistant will need to solve helps in configuring the various training nuances. This involves brainstorming sessions with various stakeholders like SMEs/BAs, Conversation Experience Designers, VA Developers, NLP Analysts/Data Engineers, NLP Trainers, and Testers.
Following are the basic guidelines suggested while scoping the VA:
- Start with a problem to solve – get a clear idea of what the VA is supposed to accomplish. Talk to the business analyst and the VA developers to understand the requirements and the actual functionality of the Virtual Assistant.
- Create a list of Intents for the use cases – this would streamline the entire process
- For each intent, identify the key results that the VA is aiming to accomplish
- The focus should be on the needs of the user, not the platform requirements
- Detail out example conversations – both utterances and responses
- What is the ideal Person in the room result
- Think through edge cases, follow-ups, and clarifying questions
- You can leverage the Storyboard feature of the platform if it has not been already used for the VA development phase
- Braistorm what an end user might ask as a part of achieving the actions – these would be the alternate utterances for every intent. Try to include idiomatic and slang usage also.
We have seen above that the Kore.ai platform offers three main engines for NLU
- Machine Learning (ML)
- Fundamental Meaning (FM)
- Knowledge Collection (KG)
When do you use each engine? Each of these engines has settings and configurations. These are dealt with in detail elsewhere in the documentation.(see here for details). Here we will list out broad guidelines as to which engine to use when.
Machine Learning Engine
ML is the recommended engine for training a VA. The reason for this is its flexibility and auto-learn feature. Given a few examples, the engine learns and is capable of understanding similar new utterances. The training utterances need not be full sentences, as the ML can learn from phrases too.
If you have a large corpus for each intent that you are planning to implement, then use Machine Learning. Even if you don’t have a corpus it would be a good idea to develop one. In the long run, it is better to spend time building a large corpus and use ML rather than going for the other less time-consuming, easier options.
Definition of a large corpus could differ depending on the intents. For example, if the intents are very different from each other and can be understood using their sample data like “Get Balance” and “Transfer Funds“, then a corpus of 200-300 for each intent is sufficient. However, if intents are closer to each other like “Pay Bills” and “Transfer Funds” (they usually start with a very similar utterance “I want to pay….”), then the corpus should be in 1000s.
Similarly, if you are planning to use Deep Neural Networks, you need a higher number of samples for better predictions of both True Positives and True Negatives, as these networks are data-hungry.
Knowledge Collection Engine
If your intents are more query-like in nature than transactional tasks or if the content is in documents and you want the VA to answer user queries from documents, then use Knowledge Collection. Knowledge Collection can also be used to trigger dialog tasks in response to user queries thus working as a double-edged sword.
If you have a lot of Intents but do not have time to prepare alternate utterances, but you are able to manually annotate some important terms, use Knowledge Collection. It is advisable to spend some time building a corpus and going for ML since annotation in KG works in a similar way to ML’s auto-learning process.
Fundamental Meaning Engine
If you have cases where users use idiomatic sentences or command-like sentences or if you are not too strict and can live with some false positives then use the Fundamental Meaning (FM) engine.