How do chatbots work and what is the technology behind them?

Konstantin Sadekov
January 10th, 2022

how do chatbots work

While browsing through a website or contacting a company via Facebook messenger, you probably encountered a friendly-sounding chatbot. In the past, these chatbots tended to be stiff and could only offer simple options to complex customer service questions. However, because of artificial intelligence (AI), chatbots today are more intuitive and able to mimic human conversations.

But what is the technology behind such intelligent tools and how does it work? What are the complex systems in place that allow a customer support chatbot to interact with human users?

Well, in short, it is all about natural language processing, natural language understanding, solution flow management, and natural language generation. 

Based on the experience working with the biggest Telcos like Veon and Elisa, as well as the Government of Estonia our team has put together a very simple overview of chatbot technology. After reading the article, you will be able to understand the different types of chatbots, how they learn, and how they work. In this article, we will cover the following terms:

how do chatbots work
chatbot software ui

Chatbots have come a long way in just a few years. While the first versions could be clunky and unnatural to converse with, today’s AI-based chatbots offer valuable support to customer service teams significantly improving customer experience.

By improving response times, automating routine processes, and handling queries, chatbots enable agents to focus on complex, high added value cases that require a human touch. But not only: chatbots can also help qualify leads, support HR staff in recruitments and streamline operations in sectors as diverse as healthcare, finance and online and offline retail. According to recent research, chatbots could be saving businesses up to $8 billion by 2022.

According to research company Research and Markets, the global chatbot market value is expected to increase by $1.73 billion between 2021 and 2025. Tech research firm International Data Corporation believes that global spending on AI technologies such as chatbots will only continue to surge in the near future, jumping to more than $204 billion by 2025, an increase of almost 140% from $85.3 billion in 2021. Retail and banking are forecast to be the most active industries in terms of implementing AI solutions as more companies look to streamline and innovate.

What are the types of chatbots?

First, let’s take a look at the main types of chatbots and explore the different ways they process human languages and human interactions.

rule based chatbot

Rule-based chatbots are simpler forms of chatbots with pre-defined rules. They’re mostly used in instant messaging apps to perform automated customer support. These chatbots can detect common phrases for answering simple questions, such as booking a restaurant, buying movie tickets, or purchasing online services.

Guided by a decision tree, the virtual assistant gives customers a set of pre-defined options that lead to the desired answer. If a query falls outside the pre-defined rules, the chatbot won’t be able to assist further and will have to end the conversation.

ai chatbot

The other type is AI chatbots, which use natural language processing (NLP) technologies to understand the intent or context behind the question and solve the customer’s problem entirely without any human assistance.

The biggest difference with the rule-based chatbot is the usage of the machine learning models that significantly increase intent recognition and guide the chatbot for future interactions through text classification or training data. Through API integration with the back-end systems, chatbots can even automatically perform the tasks for the customers when asked.

Rule-based versions are not necessarily inferior to AI ones. It all depends on the business objectives.

If the service is pretty straightforward, rule-based ones are possibly all that is needed. However, as companies start to offer more complex and interconnected products and services, the need to have a chatbot that can handle multiple queries and recommend relevant products becomes necessary.

How do chatbots learn?

Simply put, chatbots learn through processing data (questions and responses) or a knowledge database (stored information). By feeding computers large amounts of data, AI can anticipate how humans think and react, and mimic human intelligence. Chatbots learn through exposure to syntax, word usage, how satisfied the customers were by previous answers, and even sentiment analysis, where chatbots interpret emotions based on the terms a user sends.

Aside from sentiment analysis, algorithms can train chatbots to detect anomalies or fraud, recognize speech and voice patterns (conversational IVR), and predict additional queries, which can be helpful in FAQs. Pattern matching, or learning from past conversations, allows chatbots to look for a related pattern that matches a customer’s behavior. Compare this with human agents who can remember only a limited number of conversations. By analyzing past and real-time data, chatbots and other AI systems learn through experience rather than active coding/programming.

human in the loop example
Human in the loop

Although chatbots can learn without human intervention, a real person is still initially needed to check the responses to ensure they’re still on the right track. This is called “human in the loop.”

However, as chatbots are exposed to relevant data and the different ways that users communicate, they would require less and less maintenance. As they start to build a neural network, they become more self-sufficient. Without humans in the loop, machines can learn even unnecessary things, that is why only this can secure high-quality results.

CTA chatbot page

How do chatbots work?

We’ve established that chatbots learn through data exposure and experience. Let’s take a closer look at all the components that make this possible.

Chatbots use AI and machine learning to understand human words, or a human conversation, and use pre-build solution flows that help to give a solution. 

All about natural language processing (NLP)

Not all chatbots are made equal. Rule-based models, in particular, depend on a pre-defined answer for certain keywords. More sophisticated AI-enhanced chatbots use Natural Language Processing (or NLP) to read, interpret, understand, and respond to human speech.

NLP is a branch of AI and machine learning that explores the way machines analyze and interpret human language to provide context-based responses and improve their performance over time. It’s behind many of the NLP applications we use on a day-to-day basis, such as automatic translation, text-to-speech, autocorrect, predictive typing, and virtual assistants such as Siri and Alexa.

There are more than 7 billion people on the planet, and the millions of conversations they have per day generate huge volumes of text-heavy, unstructured but potentially valuable data. By bringing together computer science, linguistics, cognitive science, and data science, NLP builds deep neural networks that facilitate human-to-machine communication by allowing machines to obtain and process that data.

How do chatbots work with regards to NLP? There are three main building blocks involved in building a chatbot, two of which are NLP subsets. Let’s take a closer look.

How do chatbots use natural language understanding (NLU)?

We humans can usually understand each other even when the sentences we write or pronounce aren’t grammatically perfect. Unfortunately, the same can’t usually be said for machines, which can be easily floored by misspellings, mispronunciations, or contractions, not to speak of colloquialisms. How do chatbots work when it comes to understanding typos, hurriedly-typed out requests and just generally finding out what it is a user means to say? 

This is where natural language understanding (NLU) comes in. NLU is a deep and complex subject that has been fascinating researchers for several decades – the first known attempt at an NLU program dates back to 1965. Specific examples of NLU include machine translation, automatic routing of customer service tickets, and automated reasoning, i.e the ability to make logical inferences based on previous examples. Basically, NLU is what enables us to be understood by machines, without having to type code into our smartphones (and if you’re wondering what the difference is between NLP and NLU, the answer is simple: NLU is a subset of NLP.

nlp and nlu
Source:https://nlp.stanford.edu/~wcmac/papers/20140716-UNLU.pdf

Most NLU systems are based on three main aspects:

  1. Syntactic parsing, i.e syntactic analysis of a sentence in order to identify the function of each word and how they relate to each other.
  2. Semantic parsing, in which the meaning of words are identified independently of their context.
  3. Contextual interpretation, which removes any remaining ambiguities.

Various artificial intelligence classifiers and other techniques are used to achieve the above. In a nutshell, Natural Language Understanding is what enables chatbots to gauge intent and convert it into structured data that a machine can understand, thus going beyond simple keyword recognition.

Solution flow management and chatbot

But once the chatbot has correctly interpreted what the user is looking for, how does it know how to select the correct reply? The answer will be based both on the question and the bot’s knowledge using solution flow management, or SFM.

solution flow

Solution flow refers to the process of managing and implementing a conversation, with the main aim of finding a relevant answer or response to a user question. In some cases (“What’s the temperature today in Sarasota, Florida?”), this can be relatively simple. However, us humans aren’t always that clear when we express ourselves, in which case the conversational flow will be more complex. 

Let’s take the example of a user who poses the question “Where’s a great place to eat?”. Here are some dialog principles the chatbot would have to take into account:

  • Grounding: the chatbot has to ensure that both the user and the bot are on the same page. It could do this by replying “Great! Let’s find you a nice restaurant”.
  • Slot filling: the chatbot may need to request more information in order to provide a relevant answer, such as “Where are you located?” or “What would you like to eat?”.
  • Context: the bot will need to save and refer back to all sorts of different information throughout the conversation. The context may change in the middle of the conversation (i.e, the user suddenly decides they would rather see a movie rather than go out to eat). This is known as “context switching”.
  • Initiative: the person posing the question is usually the one who has the initiative in a conversation. The bot can either follow or take over the initiative. In mixed-initiative, the initiative switches between both parties.
illegal adds

It is very important that every solution flow has an owner who provides the most up to date information about the service the customer is asking about. It can be an expert in the field, or a product owner that knows everything about the service. Sometimes it might happen that service conditions are changed just overnight, and your customers should get correct information from the chatbot.

Besides, having a product owner in charge of the solution flow management helps the person to understand what the most common questions are that the clients ask. This allows the product owner to adjust the manuals and improve the quality of the provided information, which at the end might decrease the number of unnecessary contacts.

Where natural language generation (NLG) comes in

So far, we’ve found out what enables chatbots to understand and interpret language, as well as how they process information and create conversation flows that feel natural and deliver relevant information. But how do chatbots work to produce text and speech that’s comprehensible to humans?

NLG or Natural Language Generation is another subset of NLP. Its purpose is to transform structured data into natural language, i.e text that us humans can easily read and understand. NLG can be understood as the opposite of Natural Language Understanding: while the latter makes human speech or writing understandable to machines, NLG converts data back into plain English (or any other language). When it comes to ai chatbots, both NLP subsets are necessary in order to produce a smooth and coherent conversation.

In summary

Today’s AI-powered chatbots are a far cry from the clunky, unnatural versions of just a few years ago. But behind the bots that help you book cheap flights, select the best candidates for your latest recruitment drive or tell you how to make your office more energy-efficient, there’s some very sophisticated technology at work. MindTitan builds machine learning-based chatbot software built on NLU, and solution flow management to go beyond simple command flows to provide true added value for your business. Get in touch with us to find out more.

CTA chatbot page

Go back