Designing Chatbot Dialog Management

Leave a comment
Artificial Intelligence / chatbot / Uncategorized

People are always fascinated by intelligent devices, and today they are software “chatbots”, which are becoming more and more human-like and automated. The combination of an immediate response and a permanent connection makes them an attractive way to expand or replace the web applications. The high-level diagram of an architecture for a chat-bot shown in Figure 1. Natural Language Understanding component tries to determine the purpose of the user’s input (intent) and useful data (entities). Also, the chatbot has a Dialog Manager to define the flow of conversation and paths that the system will take. Finally, a Language Generation component generates user output.

The main function of a chatbot us to generate an answer for the user request. It can be a direct answer to the question, requesting missed slots, fallback standard input or anything else. Natural Language Understanding module detects intents (which represent the purpose of a user’s input) and entities (an object that provides specific information for an intent). There are many useful NLU tools, like Dialogflow,, LUIS or IBM Watson that can help you classify intents and parse entities using its custom deep learning and rule-based models. They have convenient web interfaces and easily integrate with different messaging platforms

There are three main types of dialog management systems:

  • Switch statements
  • Finite state machine
  • Frame-based system
  • Partially Observable Markov Decision Processes

Switch statements is the simplest way to implement a dialog manager. Every intent triggers different responses. The initiative of the conversation always comes from the user and it’s easy to design and implement. But it has significant disadvantages: it doesn’t keep a conversation context and can’t take initiative of the dialogue.

Finite state machine helps your bot to navigate through the conversation flow. The nodes of the graph represent system questions, the transitions between the nodes represent answers to questions, and the graph specifies all valid dialogues. FSMs are useful if you have a limited number of conversational scenarios and structured dialogue. Many commercial bots have this model under its hood, but it lacks flexibility and naturalness. So it’s problematic to develop more complex flow, adding new states and transitions between them. Finally, you can get an unmanageable diagram with a bunch of circles and elements.

In a frame (or template) based system, the user is asked questions that enable the system to fill slots in a template in order to perform a task. This model helps to provide more flexibility to the dialog control because it allows a user to input slots in a different order and combination. Google’s Dialogflow chatbot framework uses a frame-based system with the context control mechanism. Contexts represent the current state of a user’s request and allow your agent to carry information from one intent to another. So you create intents with some entities and design context chains. Dialogflow provides a simple and user-friendly interface for creating and managing your bot agents. 

Partially Observable Markov Decision Processes (POMDP) helps us to combine the idea of statistical dialogue management approach and handling unexpected results. POMDP characterizes by:

  • a set of states S an agent can be in
  • a set of actions A the agent can take
  • a set of observations O
  • a matrix of transition probabilities T
  • a reward R(a, s) that the agent receives for taking an action in a state
  • a dialogue state reward J(s)
  • a discount factor \gamma \in \left[0,1\right]

Classical MDP model defines rewards as a function of belief states, but  POMDP – as a function of the environment state s , because the performance of the model should be measured by the user really wants. Distribution over possible states called a belief state b_t is maintained where b(s_t) indicates the probability of being in a particular state s_t . The aim of the system is then to optimize the expected dialogue reward using this adjusted reward function. The reward could be obtained using the following formula:

J(s_{i}) = \underset{a}{max}\mathbf{\Bigg(}R(s_{i}, a)+\gamma\sum_{j=1}^{N}p(s_{j}\mid p(s_{i}, a)) \times J(s_{j})\Bigg)

So, first of all, you should understand potential users and nature of the tasks through user surveys, research on similar systems and study related human dialogues. Then you need to build a prototype of your conversation flow and try to figure out which dialogue management system will be most appropriate for this task. 

Leave a Reply

Your email address will not be published. Required fields are marked *