Unique way of AI-Chatbots (Dynamic memory networks#nlp)

Manish Pawar
3 min readJul 12, 2018

--

Deep learning has made it possible to make AI Chatbots using word2vec, seq2seq, lstm,gru……

Dynamic Memory networks-(DMNs) are state of art in Q&A systems. All nlp tasks r Q&A type. The way we use to build chatbots is to provide a series of input sentences and ask a question based on that sentences and it’s gonna output the answer.

INPUT: there is a dog-dog is black

Query: which color is dog ?

OUTPUT : black (#Literally,we can ask it anything like whats translation or whats sentiment)

There was also a kaggle competition (https://www.kaggle.com/c/the-allen-ai-science-challenge).We can use the fb research dataset called-babi (https://research.fb.com/downloads/babi/) which has

many tasks consisting of inputs,queries and answers.

Input vectors are SEMANTIC memory.Then we can split in train/test sets and vectorize data into 3 parts viz. inputs,queries,answers.

Then we create a EPISODIC memory (output vectors).Further we compile our model and fit it.

Dynamic memory network has 2 modules: Semantic & Episodic.These were invented considering idea behind our brain’s Hippocampus working.

Episodic memory has GRU’s(graded rnn) which are better than lstm.A good post to understand gru-(https://towardsdatascience.com/understanding-gru-networks-2ef37df6c9be).

GRU’s have the ability to remember more hidden states and past states than LSTM ones.

Here we need more episodes because our model should know which part of sentence it should pay attention to.

We can test our model ourselves,but a genious called Ethan Caballero has made a DMN+web app for fb’s babi tasks where we can choose our input task and let Chatbot predict answer of question

link to webapp: https://ethancaballero.pythonanywhere.com/

link to code:https://github.com/keras-team/keras/blob/master/examples/babi_memnn.py(#credit for code goes to francois chollet,I have merely created a wrapper to understand)

--

--