Photo by MIO ITO on Unsplash

20 Elements Differentiating Cognigy’s Approach To NLU

With Cognigy, The Whole Is Greater Than The Sum Of Its Parts

Cobus Greyling
13 min readMar 7, 2022

--

Introduction

The whole is greater than the sum of its parts” ~ Aristotle, a philosopher in Ancient Greece.

This is very much the case with Cognigy, the whole of the Cognigy Conversational AI ecosystem is much greater than the sum of the multiple components constituting the Cognigy product.

Their secret is orchestration…many elements constituting the Cognigy framework is not unique in of itself. But few environments orchestrate these elements as well as Cognigy.

Another key to Cognigy’s success is being counter intuitive. They are not attempting to deprecate one leg or specific element of traditional chatbot architecture. But rather merging or blurring the lines between flows, entities, intents and customer responses.

This whole created by the Cognigy yields a gestalt of a solution. More of the whole to follow…

One can say that traditionally chatbots or conversational AI agents, are constituted by a four pillar architecture.

This architecture is very much universal across commercial chatbot platforms; being:

  • Intents
  • Entities
  • Bot Responses (aka Script / Bot Dialog)
  • Sate Machine (Dialog) Management
The “traditionalfour pillars of Conversational AI Platforms.

The challenge here, is that the only AI/Machine Learning portion is the NLU model. Where a word or a natural language phrase is entered by the user; and subsequently the model returns a scoring based on pre-defined intents and entities. And the relevant intent and entities.

In turn the intent and entities are linked to a specific flow or dialog node in the flow, via a condition set for that node. This condition is a logic gate based in an intent, an entity, or combination of entities, other variables etc.

So this is a straight laced and rigid setup which is hard to manage and a far cry from Artificial Intelligence in general, and Conversational AI in specific.

There have been two approaches to solving this rigidness in chatbots.

The first being is to deprecate part of the NLU functionality.

The second and perhaps more prevalent, the deprecation of the hardcoded rule-based dialog state management.

The Cognigy Approach

Cognigy as taken the approach to not deprecate the call-flow in any way. Or deprecate the NLU component in any way. But rather augment both to solve for this rigidity and rule-based approach.

In the market in general there, is a merging of Intents and Entities. Where entities are assigned or allocated to specific intents. This makes for a more predictable model. Cognigy takes this principle a step further by linking NLU elements (intents and entities) to specific dialog flows, or portions of flows.

Lexicons can be seen as groupings of domain-specific Key phrases (Entities) that are in turn linked to a Flow.

The elements constituting a chatbot in Cognigy are: Intents, Flows Attached to the Intents, Attached Lexicons, States & Slot Fillers.

The elements constituting a chatbot in Cognigy are: Intents, Flows Attached to the Intents, Attached Lexicons, States & Slot Fillers.

For this story, we’ll focus on the Cognigy approach to NLU.

Cognigy in general has a balanced approach. Considering the mix they have between machine learning models for NLU, but also configurations, rules and key words.

Another example is having a graphic design canvas approach to dialog development, underpinned with a strong scripting framework.

Cognigy added flexibility & innovation to their NLU component in the following ways:

  1. Specific flows of the conversation is linked to specific intents. And within these intents specific entities are linked. This close association of NLU and Dialog Flow Sections allow for enhanced accuracy and improved management.
  2. Hierarchical Intents. In other words nested intents or sub-intents.
  3. Rule based intents. Intents can be triggered by by rules and key words.
  4. Conditional intents, Only trigger intent X if condition Y is true.
  5. Intents can be enabled or disabled based on the conversation state.
  6. Reverse invocation; with the entity triggering the intent.
  7. Intents can be blacklisted or whitelisted. Hence legs of a journey can be switched off.
  8. Confirmation can be added to an intent.
  9. Confirmation & Confidence Thresholds can be set per intent.
  10. Disambiguation can be set for intents.
  11. Digression is enabled by merging intents of flows
  12. NLU API for 3rd party NLU use.
  13. Advanced, out-of-the-box, compound system entities.
  14. Context Management supports NLU.
  15. Entities. Lexicons can be seen as groupings of domain-specific Keyphrases (Entities) that are in turn linked to a Flow. Entities are referred to as slots, and defined in the lexicon editor. The Slots can then in turn be linked to intents.
  16. Intents Conditions
  17. Intent Entry Points can be defined in different stages of the flow.
  18. Quick build options.
  19. Augmented Information on each dialog.
  20. NLU Mediation Layer.

As mentioned before, some of these elements are surely implemented in other frameworks. Or similar ideas, at least.

But, the complete solution put forward by Cognigy is surely unique; again, one could argue in this case, the whole is greater than the sum of the features.

1. Linking Flows & NLU

The Flow attachment feature removes the need to duplicate functionality across Cognigy AI agent Flows. Flows can simply be Attached to each other, in order to recognize the intents built in other locations.

Flow functionality is shared between Flows by making their Intents available in the other Flow. If the Intent of the attached Flow is scored highest, the attached Flow is executed instead of the main Flow.

This principle is implemented in Microsoft Composer, where the NLU model is dispersed and segmented according to dialogs. Hence the NLU model is not centrally managed. However, the Microsoft Composer implementation is not as clean as the Cognigy implementation.

The Lookup node can be used for Intent lookup. The Intent hierarchy level on which Intents are found can be set. By default, the Intent on the most detailed level is matched.

The Lookup dialog node allows for Intent lookups within the conversation, with the intent level defined and a case based branch per intent name.

The Lookup dialog node allows for Intent lookups within the conversation, with the intent level defined and a case based branch per intent name.

I foresee a scenarios where a main intent will take a user to a flow, and sub-intent can be used to steer the conversation.

2. Nested Intents

The main activity in the chatbot marketplace around intents and entities are:

So far, I have come across two implementations of nested intents or intent levels or child intents; HumanFirst and Cognigy.

The intent Balances (red) has three sub-intents (green), and third level intent (yellow).

As seen above, The intent Balances (red) has three sub-intents (green), and third level intents (yellow).

On the utterance: “savings balance for my own account”, the NLU returns:

"intentLevel": {
"level1": "Balances",
"level2": "Personal Accounts",
"level3": "Savings"
}

You can see the advantage of nested intents, knowing that a balance was requested, for a personal account, and the account type is Savings.

3. Rule Based Intents

Intents with rules allow for advanced rules to be incorporated in intent training data. Using a ML approach in general is the best; but there might be specific words or phrases you would like to catch and direct to a specific skill.

The intent Forex Trader is invoked when the text entered by the user includes “forex trader”.

As seen above, The intent Forex Trader is invoked when the text entered by the user includes “forex trader”.

A rule can be used in combination with intent examples.

"text": "Do you have support for forex traders?","intent": "Forex Trader","intentScore": 1,"intentFlow": "3bc95377-c78d-4198-bed3-d45357fe9fbd","slots": {},

Keep in mind, the rule must be true for the parent and the child. You won’t get to the to the child if the parent is not true.

Again, this is not a function which is unique to Cognigy, but it is a case of, the whole is greater than the sum of its parts.

4. Conditional intents

Conditions can be set for an intent to only trigger the intent if a certain condition is true. This field can contain a CognigyScript conditions. The intent will only be found if the condition is true.

Conditions can be set for an intent to only trigger the intent if a certain condition is true.

As seen above, conditions can be set for an intent to only trigger the intent if a certain condition is true.

5. Toggle Intents On or Off

When you are not using an intent, but do not want to delete it, the option exist to disable it.

When an intent is disabled, you cannot edit the intent. The intent will also not be triggered in the flow.

You can easily disable and enable Intents by navigating to the Intents overview and clicking on the menu icon on the right side of an Intent.

Enabling or disabling intents are easy especially if there is no need to delete the intent.

As seen above, enabling or disabling intents are easy especially if there is no need to delete the intent.

6. Reverse Invocation

Below is an example where I entered a phrase which did not hit any intent, but valuable information was gleaned from the phrase from a lexicon perspective. Lexicons in Cognigy covers slogs/entities. Below you can see the key phrase with the synonym found in the lexicon.

In events where no intent is detected, the data returned from the lexicon can be used to steer the call appropriately.

Below, a sample of the JSON returned by the dialog turn, with the lexicon detail.

AccountType": [{"keyphrase": "Credit","lower": "credit","neg": false,"synonym": "credit card account","offset": {"start": 0,"end": 19},

This data can be used to further the conversation…

7. Blacklist & Whitelist Intents

Multiple states can be defined for conversations and the intents the NLU can invoked can be controlled.

One or ore states can be created, to each state a Whitelist or Blacklist can be added.

Only Intents added to the Whitelist of the current State of the conversation can be detected. Conversely, intents added to the Blacklist of the current State will not be recognized.

One or more states can be created, to each state a Whitelist or Blacklist can be added.

This is a convenient way of managing legs of a conversation for maintenance, optimization etc.

8. Intent Confirmation

This feature reminds much of the AWS approach with Lex and Alexa. But in the AWS case it’s related to slot filling.

The question for the user whether this intent is the intended one. Triggers when the intent score is above the reconfirmation and below the confidence threshold.

The question for the user whether this intent is the intended one. Triggers when the intent score is above the reconfirmation and below the confidence threshold.

9. Confirmation & Confidence Thresholds

The confidence threshold can beset for each intent for reconfirmation or general confidence.

This is an easy graphic interface displaying the values quite clear an values can be clicked and dragged.

Above, the graphic interface displaying the values quite clear and values can be clicked and dragged.

While testing, the intent score can be gleaned from the info tab where the JSON payload is visible.

While testing, the intent score can be gleaned from the info tab where the JSON payload is visible.

Should it be difficult to decipher the data, copy the JSON payload out of the viewer and into a parser.

Intent confirmation is ideal for important transactional intents and instead of going down a repair path should the wrong dialog branch be taken, ask confirmation from the user.

10. Intent Disambiguation

Define a sentence which will be presented to the user in order to disambiguate.

This is a portion of the intent view in Cognigy, with the option to enter a Disambiguation sentence.

Above, this is a portion of the intent view in Cognigy, with the option to enter a Disambiguation sentence.

11. Digression

Digression can also be referred to as switching flows. The three scenarios are:

  • A flow can be executed once, and return to the entry point of the originating flow.
  • Access a flow and remain the flow without returning.
  • Attach Flow: merge the NLU of one flow with the NLU of another flow.
Attach Flow: merge the NLU of one flow with the NLU of another flow.

Above, merge the NLU of one flow with the NLU of another flow.

12. NLU API

There are a few options to select for a NLU API, with a list of existing integrations, Cognigy NLU or a any 3rd party NLU API.

The options of NLU API providers, with the Cognigy NLU API and also a third party NLU engine.

Above, the options of NLU API providers, with the Cognigy NLU API and also a third party NLU engine.

13. Compound System Entities

Out of the box Cognigy has powerful system entity detection, which is contextual and compound. Below is the user input and a portion of the output…

The input:

We are traveling on Saturday by car with three friends and return on the 1st of March. The plan is to visit Madrid

A portion of the output:

"start": 
{
"year": 2022,
"month": 3,
"day": 1,
"hour": 0,
"minute": 0,
"second": 0,
"milliseconds": 0,
"weekday": 2,
"dayOfWeek": "Tuesday",
"ISODate": "2022-03-01T00:00:00+01:00",
"plain": "March 1, 2022",
"grain": "day"
}
"end": null,
"text": "on Saturday"


"detailedSlots": {
"DATE": [
{
"data": {
"start": {
"year": 2022,
"month": 2,
"day": 26,
"hour": 0,
"minute": 0,
"second": 0,
"milliseconds": 0,
"weekday": 6,
"dayOfWeek": "Saturday",
"ISODate": "2022-02-26T00:00:00+01:00",
"plain": "February 26, 2022",
"grain": "day"
},


"NUMBER": [
{
"data": {
"value": 3
},
"text": "three",
"offset": {
"start": 63,
"end": 68
}
},

14. Context Management supports NLU

Intent detail can be used to steer the call contextually from a dialog state management perspective. Intent names and intent scores can be used to direct the dialog flow.

Case nodes can be setup based on Intent names and the level of the intent. The level can be 1, 2 or 3.

Case nodes can be setup based on Intent names and the level of the intent. The level can be 1, 2 or 3.

15. Approach to Entities

Lexicons can be seen as groupings of domain-specific Keyphrases (Entities) that are in turn linked to a Flow. Entities are referred as slots, and defined in the lexicon editor. The Slots can then in turn be linked to intents.

16. Intents Conditions

This field can contain a CognigyScript condition. The intent will only be found if the condition is true.

17. Intent Entry Points

Entry points can be set for intents, and intents can be executed or activated from any point in the flow.

Defining intent entry points for a flow.

Above, defining intent entry points for a flow.

18. Quick Build

When clicking the arrow on the Build Model button, a Quick Build option can be selected.

This option will build a machine learning model for your intents which doesn’t contain specifications for states and intent conditions and is thus significantly faster in building your model.

19. Augmented Dialog Information

While testing your chatbot, in the info tab you will find a JSON document with detailed data pertaining to the input and output of your dialog turn.

While testing your chatbot, in the info tab you will find a JSON document with detailed data pertaining to the input and output of your dialog turn.

This is extremely useful for trouble shooting, to see in detail what is happening in your conversation. But there can also be supplementary data which can be leveraged to manage the conversation.

20. Mediation layers

There is a scripting option for the NLU interface, pre and post NLU integration. Hence for the input and output data.

This is useful for any data transformation on input or output from the NLU API. This transformer/mediation layer adds flexibility to the solution and a level of customization.

Conclusion

As I mentioned earlier in this story, some of these NLU elements are definitely part of other Conversational AI platforms. But the key difference of Cognizy are:

  1. The way intents, flows, lexicons, states and slot fillers are orchestrated with different parameters. These elements are orchestrated and supplemented with new and innovative settings.
  2. Cognigy NLU is not only NLU, there a plethora of settings and dialog related options added to intents.

--

--

Cobus Greyling

I explore and write about all things at the intersection of AI & language; LLMs/NLP/NLU, Chat/Voicebots, CCAI. www.cobusgreyling.com