How Does a Chatbot Work? (Chapter 3)

The 2018 Complete Guide to Chatbots

Chapter 3


<<Previous  | Table of Contents | Download the Chatbot Guide | Next >>


How does a chatbot work?

Think of a chatbot in terms of simple logic. Chatbots are more than simple logic, but to understand the basic concepts, simple logic will work.

A chatbot is “listening” for certain words and phrases. When a particular term is heard, the chatbot responds with a preprogrammed answer. For example, if a user asked:

User: What is your phone number?

Bot: Our number is 800-555-1212. Do you want to talk to support, accounting, sales, or customer service?

User: If the user says “sales,” the bot provides the sales phone number which can be clicked to initiate the phone call.

The challenge is there are many ways to ask for a phone number. The chatbot needs to understand all the variations in a particular language as well as multiple languages.

The next layer of complexity is to understand the context of the conversation. If the user asks, “What time is it in London,” the bot will provide the time. If the user asks a follow up question such as, “What’s the weather there,” the bot doesn’t know what “there” means. It may not connect the first question with the second question. Humans easily understand this sequence of questions, but chatbots may not get it. It becomes even more complex when the user continues to ask questions and the bot may forget the original question, which was about the time in London. That is the most difficult part of programming a chatbot.

There are three primary terms that describe how a chatbot is programmed. Different systems use different terminology. See the glossary for terms for more.

Intent – An intent is figuring out the user’s intention and providing the appropriate response. The intent is “listening” for keywords and phrases and has a programmed response such as, ask another question, provide an answer, present button options, show an image or video, or go to a URL. The intent has many variations of the keywords and phrases, and it has logic around particular keywords. Intents can also be connected together.

Agent – An agent is a set of intents around one topic. For example, an agent called “Contact” could have intents for phone, email, web, social, etc. Other agents could be for specific types of products and services.

Conversations – This is a decision tree or logic diagram of a scripted conversation. Think of a sales script. What are the questions you would ask during the sales process or when trouble-shooting a technical support issue? These conversations can be linear or have branching logic with multiple answers to questions. They can also be interrupted mid-conversation and switch conversations to questions and answers much like a human conversation.

Chatbots are powerful because they can mimic human language. They do not have to stay in the conversational flow. If the user asks a separate question, the bot can jump over the preprogrammed response and answer that particular question. For example, the bot could be asking questions to narrow down what product or service the user needs. In the middle of this conversation, the user could interrupt the bot and ask an unrelated question like “Where are you located?” or “What is the cost?” The bot will then stop its conversation and answer that question.

How does a chatbot learn?

Chatbots can learn automatically by analyzing past data and making assumptions on what is right. The other way chatbots learn is by having a human editing the system.  In most cases, both are required. Even though a chatbot has artificial intelligence, a human still needs to audit the responses to make adjustments. This is called “human in the loop.” There have been some epic failures of chatbots that run 100% on artificial intelligence. Many smaller bots only have human in the loop because there is not enough data to answer all of the user’s questions. In these cases, data is collected from the bot system and what is learned is applied to all the bots for general intents and agents.

Over time, the bot gets smarter and theoretically there is less maintenance. From a marketing perspective, there are insights to be gained from the bot data, and the data is fed back into the bot as well as shared with product development, marketing and sales teams.

What is artificial intelligence?

Artificial Intelligence (AI) is the creation of computer systems that can perform tasks that require human intelligence, such as speech recognition, understanding and translating language, and decision making. AI includes computer science, neuroscience, psychology and linguistics, which are all needed by a machine to duplicate a typical human response. When an AI process can function with contextual responses in a real human conversation, that is when it has become successful in simulating human intelligence.

The data is collected and clustered into groups. These clusters of data are multidimensional and take significant computer power to analyze. Special software systems with a variety of algorithms are used to evaluate how the data is being correlated. The system is then tested and adjusted accordingly.

Artificial intelligence is what makes chatbots different than a simple yes or no logic program. Chatbots learn over time what a user is asking in a particular industry and what is the best way to answer that question. This is done by collecting and monitoring the data of all the conversations. The AI system applies what it learns from each conversation. However, there is a caveat. A human has to monitor some of these responses. This is called “Human in the Loop.” In the past, chatbots have been launched on social sites, and unfortunately, they start learning the more negative influences of our society. For example, Microsoft’s Tay.ai was launched on Twitter in 2016, and it became a sexist bigot within 24 hours and was shut down and fixed. The best way to avoid these situations is to respond with polite humor preventing the conversation from spinning out of control.

The bottom line is a good chatbot will have ongoing maintenance to review the conversations. This has two benefits. First, it gathers data about what customers want, ask for, are confused about, etc. Second, it detects where the bot is getting stuck in a conversation so it can learn and create new responses.

What is machine learning?

Chatbots and other artificial intelligence systems have multiple inputs such as text, button clicks, voice, and vision. Machine learning is when the chatbot analyzes the input data to determine a result. For example, if the system is reading a scanned document with numbers, the number images are clustered by how similar they are. All the 6’s are grouped separately, then all the 3’s are grouped together. This is pretty simple to do. The trick is when a 1 looks like 7 or 4 looks like a 9. By clustering thousands of images, it becomes smarter and the error rate decreases.

Machine learning is the process where a computer learns from experience rather than from programming. The machine learns by gathering data and it can find insights from that data without being explicitly programmed. When you see an ad on your Facebook newsfeed or from Google for a product you recently searched, that is a result of machine learning about you and your preferences. There are many inputs of data for the system to draw a conclusion. Computers are really good at this, where it would take a human too long to figure it out.

What is natural language processing?

Natural language processing (NLP) is teaching a computer to understand language and the intent behind the language. NLP is based on artificial intelligence, computer science, and computer linguistics.

NLP is enabled by machine learning where words, phrases, and sentences are analyzed, and the system gives a response based on the analyzed data. An NLP algorithm uses inferences to provide the best answer. The system gives a better answer when it receives more data. One of the biggest challenges with NLP is context – human conversations are contextual and it’s difficult to teach context to a computer.

If you use a spelling and grammar app or a language translation app, it is most likely using NLP to correct you.

What is Human in the Loop?

“Human in the loop” is a Natural Language Processing Engineer who continually reviews the bot data and adds new intents and agents to the bot. The engineer adjusts the programming with new acronyms and new ways of asking a question. The engineer also detects new customer objections and questions which are vital to selling a product or service.


 <Previous  | Table of Contents | Download the Chatbot Guide | Next >>


Follow Me

Greg Ahern

Greg Ahern Founder and President of Ometrics® is a fanatic about conversion rate optimization, chatbots and lead generation. Greg has been a successful Internet entrepreneur since 1994. He speaks at conferences and webinars and has built a number of internet businesses, including web marketing, web development and internet lead generation, which have been successfully acquired. Greg is the Denver Chapter Leader for the Digital Analytics Association. You can follow Greg on Twitter @gregahern and join his CRO Hacks Groups on Facebook and Slack.
Follow Me

Latest posts by Greg Ahern (see all)

Leave a Reply

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