Introduction to Chatbots

If you’ve ever asked a question from Siri or asked Alexa to play your favorite playlist on Spotify, it turns out you’ve already used a chatbot. Chatbots are specialized software that allow a computer to interact with a human user conversationally using either text or audio. Modern chatbots are versatile enough to carry out complete conversations with their human users and even carry out tasks given during conversations.

Having become mainstream in recent years because of personal assistants from the likes of Google, Amazon and Apple, chatbots have become a vital part of our everyday lives whether we realize it or not.

A brief history

In the early 1950s, Alan Turing, a mathematician most famous for breaking the German Enigma Machine, laid the foundations of a revolutionary machine capable of ‘thinking’ like a human. Turing, often considered the father of modern computer science, introduced the concept of artificial intelligence in his paper “Computing Machinery and Intelligence”. In the paper he suggested that the way to building a truly intelligent machine would be to design a program that simulated a child’s mind and learnt from its environment rather than a program that simulated a more complex adult mind.

In his paper, Turing also introduced an experiment to judge if a machine was truly intelligent – that later became known as the Turing Test. The idea was that a machine would be considered intelligent if a listener could not tell it apart from a human being during a text-based conversation.

Alan Turing, 1928 (Aged 16)

Emergence of Rule based Chatbots

The Turing Test became an interesting challenge in the field of mathematics and as computers evolved, scientists tried building specific programs that would pass the Test. The first breakthrough in such a program came in 1966 when Joseph Weizenbaum, a German-American computer scientist at MIT Artificial Intelligence Lab, created ELIZA.

ELIZA was an early, extremely rudimentary rule based chatbot that simulated human conversation by using a pattern-matching methodology to ‘guess’ appropriate responses to inputs from a human user from an existing database of stored responses. These databases along with instructions or ‘rules’ on how to process incoming inputs were provided using external ‘scripts’ which were loaded at initialization.

As part of its workflow, ELIZA would first examine a user input for specific ‘keywords’ written in the loaded instructions or ‘script’. The keywords in the script were ‘ranked’, with a higher rank being given more precedence during selection of a response. Any keywords detected in the incoming sentence were put into a ‘keystack’ according to their rank. The keywords were then matched against specific rules. This allowed ELIZA to maintain a hierarchy of possible responses depending on the input and allowed it to perform without having any support for contextualization. In cases when the input matched multiple rules in the script, ELIZA would choose a response at random, giving it a sense of understanding.

Conversation between ELIZA and a user

Following ELIZA, a few more rule based chatbots were released, the most famous of which were;

1. PARRY: PARRY was a chatbot written by Kenneth Colby, a psychiatrist at Stanford University, in 1972. The bot implemented a crude behavioral model of a schizophrenic.

2. Jabberwacky: Jabberwacky was created by British programmer Rollo Carpenter in the 1980s. The Jabberwacky project was Carpenter’s attempt to develop an AI capable of passing the Turing Test. Even though it did not pass the Turing Test, the chatbot evolved overtime and was released on the internet in 1997.

A sample conversation with Jabberwacky

3. A.L.I.C.E.: A.L.I.C.E. (Artificial Linguistic Internet Computer Entity) was a chatbot that used heuristical pattern matching rules (an early form of Natural Language Processing) to the input. A.L.I.C.E. was one of the most capable rule based chatbots developed at its time and, despite not being capable enough to pass the Turing Test, has won the Loebner Prize (awarded to the most realistic talking robot) thrice.

Rise of AI Based chatbots

With the rise in the use of machine learning in recent years, a new approach to building chatbots has emerged. Using artificial intelligence, it has become possible to create extremely intuitive and precise chatbots tailored to specific purposes.

Unlike their rule-based kin, AI based chatbots are based on complex machine learning models that enable them to self-learn. These types of chatbots can be broadly classified into two main types depending on the types of models they use;

1. Retrieval based Models: Like their rule-based kin, Chatbots using retrieval based models are provided with a database of answers and are trained to find the most relevant answer based on the input question. These bots cannot generate their own answers but with an extensive database of answers and proper training, they can be very productive and useful.

2. Generative Models: Generative models, unlike Retrieval based models, can generate their own responses by analyzing the input word by word to understand the query. These models are more ‘human’ during their interactions but at the same time also more prone to errors as they need to build sentence responses themselves.

Both these models need to be trained on datasets of user queries to make them effective in their use cases. Chatbots based on generative models, however, also require training on language datasets.

Google Assistant and Amazon Alexa are prime examples of the scope of AI based Chatbots. These virtual assistants are intelligent enough to carry out complete conversations with their human users. They are able to remember context, understand complex sentences and commands and are even able to tailor their responses to their understanding of the user.

Building a chatbot as powerful as the assistants mentioned above, however, is an almost impossible task. Google and Amazon have been able to achieve this feat after spending years and billions of dollars in research, something that not everyone with a use for a chatbot can afford.

Luckily, almost every player in the tech market (including Google and Amazon) allows users to buy their technology platforms to design customized chatbots for their own use. These platforms have pre-trained language models and easy to use interfaces that make it extremely easy for new users to set up and deploy customized chatbots in no time.

The most famous of these platforms are:

1. Google DialogFlow

2. Amazon Lex

3. IBM Watson

4. Microsoft Azure Bot

Why use Chatbots?

In recent years, the use cases of chatbots in the industry have skyrocketed. They have found a strong foothold in almost every task that requires text-based public dealing. They have become so critical in the support industry, for example, that almost 25% of all customer service operations are expected to use them by 2020.

Businesses using chatbots can very easily scale while maintaining customer support operations without having to increase human resource. The consistent availability with shorter response times helps improve customer loyalty leaving the business time to focus on growth. Companies such as Spotify and Starbucks are already using chatbots to handle their customer support operations.

Chatbots have come a long way since the introduction of ELIZA in 1966. Modern day chatbots are intelligent, versatile and almost indistinguishable from human beings. They have become a vital part of the business ecosystem and their usefulness will only increase as they keep becoming more and more intelligent.


This is a companion discussion topic for the original entry at https://blog.datasciencedojo.com/p/037928b0-b591-4238-8c7e-c2060443ea1b/