Jan 7, 2021 7:48:00 AM
How Chatbots Are Getting Smarter With NLP
This article is going for a deep dive into the technology that makes a great chatbot. How do we build the perfect chatbot that makes the life of customer service agents much easier? And how do we still provide a friendly and familiar experience?
Customers are sometimes angry, frustrated, stuck and confused, they need to vent out, they need to talk to somebody and most importantly, they need their problem solved as soon as possible! This is why we are going to explain how we are building our chatbot using a mix of state-of-the-art machine learning and NLP to provide customers with the support they need.
What is NLP?
NLP stands for Natural Language Processing, and while that sounds complicated, a natural language is nothing but any of the languages we speak, e.g. English, German, Japanese, etc., and stands in contrast to artificial languages such as programming languages and mathematical notations. For decades and even before the term NLP was coined, experts have tried to make computers capable of understanding the human language with all its complexity, which is never an easy task.
NLP is often defined as “the process of a computer extracting meaningful information from a natural language and\or producing natural language output.”
The NLP research actually started with Alan Turing himself when he published his paper “Computing Machinery and Intelligence.” Introducing the concept of the Turing Test, as a benchmark of when to tell if machines have really become intelligent. Which inspired a lot of research during the 50s and 60s.
Since then, the field of NLP developed over the decades and with the modern advancements of machine learning and deep learning, tasks which were once impossible are now tackled with great performing models. People are exposed to NLP models every time they interact with the internet. It is how Google understands what you mean, and what could be relevant to your search, and which pieces of information are related, and it is how Facebook optimize which posts you should see in which order, and it is how core technology of NLP-based chatbots works.
Why add NLP to our chatbot?
Solvemate’s chatbot uses a very special and unique technology based on dynamic decision trees. Which currently makes it outperform conventional chatbots using static decision trees, as well as bots which are purely NLP based.
Pure NLP bots come with a price. The natural language is full of ambiguities and nuances that humans can naturally understand, but there is always a margin of error when it comes to NLP models. This margin of error can safely be neglected in many NLP applications; for example you would not care much if one of your top 10 search results is not actually relevant, or if one of the posts in your Facebook feed is not that interesting to you. But if one out of 10 users of a chatbot gets an answer that doesn’t make sense to their question, that would result in a very frustrating experience.
But then why do we want to introduce NLP into our chatbot? Dynamic decision trees do not have that margin of error, and they are performing better, right? The short answer is because it can get even better, by benefiting from the best of both worlds!
How do we plan to do that? And how are we different?
Allowing users to type in whatever they want to describe about their problem can be used to improve the solutions proposed to them by the chatbot as well as make the time they spend even shorter. And with the right design, the precision of the decision tree could be used to make up for the margin of error from the NLP models.
Imagine someone who wants to know the price of a certain product, instead of asking about the type of their question, and if it is about pricing, then which product they want, we can simply allow them to say something like “How much does X costs?”, and then we can automatically answer them.
Of course, not all user input will be as simple and straightforward, and sometimes we might need to approximate and guess and do a lot of work behind the scenes to figure out which solution to display, or which question to ask next to get more clarification from the user. This is why Solvemate is employing state-of-the-art NLP technology.
And what if the user inputs a text that is a little bit too ambiguous to be matched to any answer? Well that wouldn’t be a problem because we will simply revert back to our decision trees which will tell us the state of what we already confidently know about the user’s request, and ask the next best question.
The decision tree will remain the backbone of the bot’s technology and algorithm, while being supplemented with our NLP models. It's the knowledge base that allows the NLP models to work better than they usually do and improve their quality. Free text input will basically allow the user to walk down the decision tree more efficiently, while providing a more user-friendly experience at the same time.
What technologies do we use? And which languages do we support?
In order to achieve the best possible performance of this NLP approach we use a range of modern NLP technologies, including word embedding models, deep learning, intelligent text preprocessing, topic modeling and intent classification algorithms. Most companies in the NLP field resort to using only language-independent models or models based on translated content, to be able to support as many languages as possible. However, most of the time at the expense of the provided quality. We are using a mix of language-specific as well as language-independent models, to achieve the best possible quality for the supported languages.
One of the main advantages of our chatbot prior to introducing NLP is that it is language agnostic which makes it available for any user in the world. We do not plan to give up this advantage by introducing NLP, so we will be using NLP models that work with any language, and to achieve the best quality, we will be improving them with models trained on languages specific to our customers’ needs. The first two languages we will fully support will be English and German, other languages will follow.
NLP beyond the chatbot?
One of the most important features that we are introducing thanks to NLP technology is the ability to retrain our algorithm based on unsuccessful conversations in order to be able to solve them in the future.
When users interact with the bot and get to a solution that is not satisfactory - not exactly what they were expecting - there are two scenarios: They often provide written feedback through the bot, or they get handed over to a human agent, in which case they can also provide a form of feedback. The text of their feedback can be used as an input to a trained classification model, that can figure out which solution they were actually looking for!
Our classification model can predict the correct expected outcome of an unsuccessful conversation. And this valuable information from user feedback can be used to improve the structure and conditional probability of the dynamic decision tree, as well as retrain the models themselves, in order to allow similar conversations in the future to find the right solution. This means that our algorithm will just automatically improve over time. It’s a feedback loop! And this is what makes our unique way of integrating NLP very promising one.
Belal is a machine learning and NLP engineer at Solvemate, based in Berlin. He has 7 years of experience building NLP products in different languages. Worked on problems related to Sentiment Analysis, Topic Modelling, Text Clustering, Search & Ranking and Chatbots.