The Machine Learning Cycle in Support Chatbots (Part 1 of 2)

Erik Pfannmöller
5 min readJun 13, 2018

--

Having met with close to 100 companies to discuss their customer support problems, I’ve learnt that the market is very confused when it comes to the term chatbots. As a result, I wrote an article earlier this year, classify different types of chatbots. Many of you sent me great feedback (thanks for that) but also said that two of the points I used in the article weren’t entirely obvious to understand.

That’s why I’ve decided to dive in even further. In this two-part series, I’ll first explain how a “rule-based flow” in chatbots works and then how the flow is “dynamically changed with usage”.

UPDATE 17th of July 2018: Part 2 is live now, find it here.

Getting into the Flow

When I talk about flow, I mean a sequence of messages that are shown by a given chatbot. Even though each bot’s flow is generated differently, it is generally based on the same overall principle:

Here are two examples that show you a different approach to the flow: The first is a Facebook Messenger bot called Erwin that asks small riddles.

The second one is from one of our own customers, SumUp.

Let’s look at Erwin first. By writing “Let’s start”, I provided a New Request. Erwin then asked its Trained Model for a Response. Here, the first Response was a riddle.

My reply to it (“it will fall”) was a New Request that took the chat history into account. The Trained Model determined that the answer was correct, gave me an explanation as Response and the question whether this had been hard. In case of a wrong answer, the Trained Model would have provided a different answer. After that, the whole process started again.

In our second example the flow was quite similar: By clicking the question mark, I initiated a New Request, the Trained Model defined a Response, I replied by clicking a button and so on.

Sounds easy enough, right? But how does the trained chatbot model make the decision of what to do next?

Training the Model

In my taxonomy, question three, I talked about two different types of flows: Rule-based and dynamic.

The first one is easy to understand.

For rule-based bots, the Trained Model is defined by a human in the form of if-then statements.

They tell the bot exactly what to do for each given situation:

  • If a user writes “hello”, reply with “how are you?”
  • If user says “I want to book a flight” reply with “Please give me your departure city and your destination.”

These rules can be very powerful. For example, one can train synonyms for the input, the bot can have multiple texts for the same responses, and much, much more. If-then statements can be referenced across and re-used in the whole logic of a bot, so the only limitation is the human capability of handling the complexity of all these if-then statements.

There are several companies offering visual SaaS tools for building rule-based bots, such as Chatfuel, the bot-builder from recast.ai, or flow.ai. There are also tools which are less visual, such as wit.ai (acquired by Facebook) or dialogflow (acquired by Google).

The second type of model is a bit more complicated.

A bot with a dynamic flow relies on mathematical calculations to predict a response.

I’ve added training data to the graphic from above:

How does it work? Let’s assume you have a chat history of 100.000 interactions between a service agent and a user. A machine learning algorithm can use this training data to crunch them into a compressed Trained Model, which calculates which response is most likely true for a given request — based on what human agents told users. The Training Data determine the Trained Model.

At Solvemate, we don’t analyze natural language input but instead offer bots that ask a user multiple choice questions. Our training data are the knowledge items provided by our customers’ service agents.

Either way the data is handled, remember that these bots are dynamic: Whenever the Training Data changes, so does the Trained Model.

Setting the Bot Free

Wikipedia defines Machine Learning as:

(…) a subset of artificial intelligence in the field of computer science that often uses statistical techniques to give computers the ability to “learn” (i.e., progressively improve performance on a specific task) with data, without being explicitly programmed.

The last two words are important here: “explicitly programmed”. As we’ve learned, a ruled-based bot does not rely on machine learning (as the if-then rules are explicitly programmed). In contrast, a chatbot with dynamic flow relies on machine learning (as the responses aren’t explicitly programmed but learned using an algorithm).

There is no right or wrong approach here. Your requirements should always determine which type of bot is appropriate. Both rule-based and dynamic bots are easy to maintain as long as complexity remains low. However, rule-based bots get very hard to maintain as they become more complex. This is where dynamic flows come in. They may take more time to set up, but they can handle more complex flows.

To be continued…

In part 2 of this article, I’ll explain go into more detail on how changing the Training Data will change the flow of a bot. I’ll also go into the machine improvement cycle and how it contrasts with the human improvement cycle to demonstrate the inner workings of a dynamic flow.

If you’re interested in all of that, follow me now to be notified!

UPDATE: PART 2 is now live.

--

--

Erik Pfannmöller

CEO @ Solvemate.com Passionate about AI, computers and software. Like structure and efficiency. Nerdy on details. Love keyboard shortcuts. Chasing a big vision.