AI & Chatbots: The Technical Approach Behind Neural Conversational Agents

Matt Fitzgerald
DataSeries
Published in
8 min readSep 23, 2019

How Do You Order Your Groceries?

If you still prefer to access a modern GUI (Graphical User Interface), you would probably;

  • Access your PC
  • Open up your browser
  • Type in Amazon and then type “grocery” in the search box
  • Draining time in comparing and selecting best groceries at the cheapest price by simply browsing gazillions of sites popping up on your screen
  • Make a choice but then confronted with more options over how many packs to get
  • Sign in the account, if you are a first-time buyer
  • Put in your payment details, if you haven’t registered yet
  • Subscribe for regular deliveries or go for a one-time order
  • Review your order details and confirm the order

And after putting so much effort and analysis, you still remain in doubt whether you make the right decision or not.

Or, you can put all the struggle aside and leverage the Amazon Echo feature to simply order the farm-fresh groceries at the cheapest price.

Image Via Medium

Needless to say, Artificial Intelligence(AI) or Machine learning has taken the world by storm and made your life far easier than ever before. From making calls to setting reminders, putting shopping orders to playing your favorite music track, is now just a matter of your echo command.

Machine Learning Will Automate Jobs That Most People Thought Could Only Be Done By People” — Dave Waters.

However, with the rise of conversational AI(Artificial Intelligence), many people agreed with the fact that leading bots including Siri, Alexa, or Cortana are only limited with voice experiences or digital assistants like Google Assistant. It is tough to turn them into conversational agents capable of talking on general or philosophical topics.

In this digital era, where everyone is expecting their chatbots to be their all-time experts and want them to answer all their queries with a quick simple command, how to take your chatbots to the next level? How to fix this problem?

Don’t panic! Everything has a solution… Human beings can talk to Robots in natural language. Don’t believe that? Let me take you to the deep.

The blog provides an overview of neural network chatbot build today and how it has included both traditional approaches and modern computer science to tailor the ways to use machine learning in the chatbot. This blog will give you a deep explanation of:

  • Introduction of Neural Conversational Agents
  • Purpose of Building Conversational AI
  • What Types of Dialogue Systems Are Being Used?
  • How Do Conversation Models Encode or Decode Your Language?
  • Why Robots Are Not Available on Your Mobile Phone?
  • Future of Neural Network Chatbots

The Concept Of Neural Conversational Agents

Honestly speaking, Neural conversational agents are no different from Chatbots. Instead, it is a computer software program enables intelligent interactions with human (M-H) via both text and audio using the natural language processing capacity depending upon the language model and dataset.

Don’t get Muddle!

If put simply, Conversational AI applications including messaging apps, voice-based assistants, chatbots or voice assistant platforms which are fueled by artificial intelligence techniques, models and algorithms that help you provide the perfect answer that you expect from the machine.

Image Source

“Technology is going to disrupt the future of work, perhaps sooner than we thought” — Brain Cornell

Do you know, according to the facts and figures, over 2.5 billion people are using messaging apps and 75% of smartphone users accessing at least one chat app to remain connected with virtual assistants?

Apart, hundreds of millions of people are using Facebook Messenger, WeChat, WhatsApp, and other messaging platforms for hassle-free online communication. Millions more are using other platforms including email, mobile apps and traditional web applications for interactive conversations.

Image Via Pinterest

Purpose of Introducing Neural Conversational Approaches

Don’t you want your virtual bots to be more than just robots who have all the answers for you? With that in mind, comprehensive dialogue templates are integrated to stimulate programmed agents.

To obtain natural language, the context box rewrites those templates by simply using crowdsourcing.

Upgrade an end-to-end conversational agent on this fully automated dataset, achieving a reasonable task completion rate by predicting the institution, nature, and emotions of the user.

Lastly, deploy these chatbots to interact with users and collect user feedback which serves as a reward value to often improve the agent’s policy with reinforcement learning updates.

Before you jump on how Conversation Models Encode or Decode Your Language In natural language, it’s time to understand the types of dialogue systems are being used in general conversation…

What Types of Dialogue Systems Are Being Used in General Conversations?

Basically, there are two types of dialogue systems are involved in chatbots; Goal-oriented (Siri, Alexa, Cortana) and general conversation (Microsoft Tay Bot). With the great advancements in artificial learning, Microsoft Tay Bots are taken to the next level and started attempting to talk to people on multiple ranges of topics. In fact, it won’t be wrong to say “ Neural Conversational agents have successfully replaced human beings”.

“Yet the biggest harm that AI is likely to do to individuals in the short term is job displacement, as the amount of work we can automate with AI is vastly bigger than before” — Andrew NG

And the recent improvements in Artificial learning is clearly making this above statement true…

Still confused? How do general conversation systems work? How do they decode or encode the language? What changes have been made in the previous chatbots? If yes, quell your stress here as this blog has covered everything from the basic working of these systems to the future of machine learning in chatbot!

Let’s get into the details…

Do you know, general conversations are not as straightforward as you may think with chatbots. The general conversational model has further segregated into two major types; Generative and Selective models. However, the common thing between both models is that they receive several sentences of dialogue context and predict the answer for this context.

Image Source

The network consumes a sequence of words before it is embedded in the reply. In simple words, models are trained in pairs (Content, reply). Context can be several sentences or maybe one, which help preceded the reply. In addition, sometimes models use additional meta information from data, such as speaker ID, gender, emotion, etc to predict the perfect answer to your query.

Now we are ready to discuss the Generative Model in-depth…

I know understanding the mathematics or algorithm of Generative Learning is quite complicated, but we have put into a simple layman language along with the diagrams and cut down all the complicated mathematics from this post.

Based on the theory of Osborne and Wittrock, a Generative Approach is a simple concept that involves the active integration of the new data points by considering the previous existing approaches and recently proposed sequence-to-sequence (STS) frameworks. The model works by predicting the next sentence given the previous sentence or sentences in a conversation. The strength of the model can be trained end-to-end and thus minimize the scope of using hand-crafted rules.

Experts find that this is a straightforward model that is capable to generate simple conversations given a large conversational training dataset. Instead of optimizing the wrong objective, Generative approaches extract knowledge from both a domain-specific dataset as well as from a large, general domain dataset of movie subtitles.

Image Source

Finally, now it’s time for some maths…

Generative Learning Algorithms: How Do They Work?

To create these models, generative approaches learn the Joint Probability Distribution that has been defined as:

P (x,y)= P(X/Y). P(Y)……equation 1

Further using Bayes’ Rule, we can also write it as:

P (Y/X) = P(X/Y). P(Y) / P(X) ….equation 2

To predict the label Y, we only use the arg max and denominator can be removed from equation 2.

Hence to predict the actual value of Y from the training example x, generative models are evaluated as — F(X)= argmax_Y P(Y/X) = argmax_Y P(X/Y). P(Y)

You can consider this diagram for the clear calculation, but the most important part of the above-mentioned equations is P(X/Y), which is what makes this model a generative!

Image Via Medium

P(X/Y) means, what “X” features are given to class “Y”. Therefore, with the joint probability distribution function of equation 1, given a “Y”, you can calculate (generate) it’s corresponding to X, for this reason, this is all called as Generative Model.

Generative Learning algorithms make strong predictions on the data and provide you more accurate and proficient answer to your query.

Is There Any Possibility To See These Conversational Agents On Smartphones?

Can you get connected with the neural dialogue systems on your smartphones? This is the so far asked question by the many users…

Well, despite draining the hard efforts in this area, neural dialogue systems are still not ready to talk with humans in open-domain and limited to provide them informative/funny or helpful answers on the smartphone. But, if we talk about closed-domain technical support, their success stories will make you overwhelmed.

Now the question comes to our mind is, will the Neural Conversational Agents replace the Human Doctors in the future…?

What Will be the Scope of AI in the Coming Future?

No doubt, Artificial intelligence will continue to delight us, surprise us and scare us…

Jobs that were never ever thought to be replaceable will now experience the full automation. In the coming 10 years, it is not so surprising to see professional drivers with self-driving cars and expecting the pullback of other positions as well. So having the professional customer support or robot to converse in detail on any random topic, is not such a big deal.

Top software development companies are emerging the latest technologies to develop better algorithms to produce better results and encounter every single query with perfection.

Conclusion

This is true that digesting the concept of the conversational model at first is quite difficult especially if you have never ever heard about the term like machine learning with Chatbots. I hope this post has helped you understand what neural conversational agents are all about and how they may help you in the future.

As there is so much to learn about these dialogue systems, so I would suggest you consider the links mentioned in the blog. If you are not sure how this will work and how the structure will be formed, then leave the job on experienced software developers.

--

--

Matt Fitzgerald
DataSeries

Working in xicom.ae | Business Analyst (12+ years) | Technical Writer | Tech Geeks | Tech Enthusiast