Cognigy Intent Hierarchies
Cognigy.AI is an extensive platform that allows users to not just build the training data to drive an NLU bot, but to create an assistant made up of multiple “Flows” that take a user through a journey and handle various tasks, depending on what that user requests.
One particularly useful feature which straddles both the flow and intent components of a Cognigy chatbot, is the ability to create and utilize “intent hierarchies”, which we will describe in this blog.
Designing intents with hierarchies
For this demonstration we will be building upon the example HR Services chatbot that Cognigy provide themselves for demo purposes, and adding a new intent called Benefits, which handles questions about workplace perks and other employee benefits.
You may start with a single Benefits intent that handles both general questions about workplace benefits, for example, “what workplace benefits am I entitled to?”. But as you scale up your bot and allow it to carry out more advanced tasks for users, you could end up with a wide array of increasingly specific subjects, and the Benefits intent growing large and varied in its training data. For example, the following questions could all be considered part of a Benefits intent, but also have their own distinct subject within that theme:
- “Can I sign up for employee health insurance?”
- “Buying a bicycle with my salary”
- “Are there wage sacrifice options to help cover childcare costs?”
The chatbot builders could end up needing to use several entities (“Lexicons” in Cognigy’s case) within that one intent just to help direct the users down many different fulfilment paths. The volume of training data could also grow very large just for this specific intent.
This isn’t just difficult for chatbot builders to manage for an administrative point of view; oversized intents can cause an imbalance in NLU classification, with the large numbers of “noise” words/phrases in the training data (like “the”, “I”, “Can you” etc.) resulting in large intents becoming more likely to trigger false positives. So, utterances meant to go to other intents could end up being incorrectly classified to Benefits instead.
It is already standard chatbot-building practice to recommend breaking down large intents with broad subject matter intents into sub-intents. You can use Cognigy’s intent hierarchies system to do this explicitly for up to 3 levels within your intent structure – see fig. 1.
Figure 1: A level 1 Benefits intent broken down into level 2 Family, Health, Holiday, Other and several level 3 sub-categories
If desired, you can simply use the intent hierarchy for logical structuring, then you can make all intent levels active in the required flows and stop there. However intent hierarchies become particularly powerful when you add the “Inherit Example Sentences from Child Intents” feature, shown in fig. 2.
Figure 2: The Benefits-Health level 2 intent with its training data and inheriting from child intents enabled
By enabling “Inherit Example Sentences from Child Intents” on the Benefits and Benefits-Health intents, all training data in the level 3 -Cycle, -Gym and -Insurance sub-intents will be considered part of the larger Benefits-Health intent, and in turn all level 2 intents (-Family, -Health, etc.) will be considered part of the umbrella Benefits intent as well.
You can also set your intent lookups in a Cognigy flow to only search for intents down to a certain level. A handy way to utilise this is with finding what broad subject a user needs help with, and then moving them to an appropriate flow to narrow down the details.
Using Intent Levels to Control Conversation Flow
Perhaps a user has a question about their employee health benefits. When they’re in the starter flow, you can set the intent lookup node to only operate at level 1, meaning the bot will only return the Benefits super-intent, and then, regardless of whether the user asked about health benefits, vouchers or a more general query under the “Benefits” subject, they will be directed to the separate “Benefits” flow. That way you don’t need to have lookups for every single sub-intent in the start flow – see figs. 3 & 4.
Figure 3: Declaring an intent lookup node should only search down to level 1 intent hierarchies – so only Benefits could be selected in this case.
Figure 4: The resulting bot interaction and the returned intent only showing level 1 in the response json
Then, once the user is in the “Benefits” flow, the intent lookup node can instead be set to levels 2 or 3, allowing the user to ask more specific questions about health benefits, or even specific types of health-related benefits, if up to level 3 is enabled, see fig. 5.
Figure 5: The subsequent bot interaction and the returned intent showing up to level 3 in the response json
Flows in Cognigy are best used for directing users on journeys where you filter down to their needs to put them on the correct path to fulfilment or the information they need. Intent hierarchies are very useful for this approach, allowing you to define both a broad subject matter, and more specific subjects within them. Still, it should be noted there remains a risk of confusion between higher-level and lower-level intents if their training data is very similar, and for that reason you should make sure to thoroughly test a variety of utterances on each flow and level-configuration that your hierarchical intents are used in.
QBox is now available to test your Cognigy chatbot models, allowing you to analyse your training data and help make improvements to performance. To find out more, visit QBox.ai.