Recently, one of my clients asked me if it is possible to use GPT2 for his Dialogflow bot.
Short answer: probably not.
Natural Language Generation (NLG)
GPT2 is a machine learning model (and associated code) which can automatically write text. Here is the official definition:
The text is grammatically correct, too. Often you will find it hard to distinguish between something written by GPT2 and human-generated prose if you don’t know anything about the subject. 🙂
Two types of chatbots
There are primarily two types of chatbots.
Task led bots – the kind of bots that you usually create in Dialogflow. Here, there is a specific task that the user wants to do, and your bot will help and guide them during this process.
Topic led bots – these are bots which can do chitchat. A good example is Mitsuku.
Can NLG be used in Dialogflow bots?
A better question might be – is NLG good enough for use in Dialogflow bots?
NLG can be useful if the bot’s response is relevant to the task at hand, and can guide the user towards completing their task.
I don’t think we are at that point yet.
A cautionary tale
Microsoft’s Tay was a Twitter chatbot which used some form of NLG and replied to people on Twitter.
Unfortunately, it took only a day for trolls to make it say all kinds of offensive stuff.
It was taken down by Microsoft within 24 hours, but it is an extreme example of how things could go quite wrong if you start using these models without having a good understanding of what you are trying to do.
Even if your bot does not say offensive stuff, there is another issue you should be aware of.
For example, here is an article which describes hallucination in neural NLG – a phenomenon where the bot says things which are simply not true or not even relevant to the topic of discussion. They are being “hallucinated” into existence by the NLG system.
It also seems to happen in Neural Machine Translation (NMT), as seen in a comment from that same article:
This is also anecdotally verifiable if you use GPT2 for some topic which you already know very well.
Here is what I got when I typed in the name of a famous cricketer into an online tool which lets you test GPT.
Here is another hallucination 🙂
This is actually a perfect example of the hallucination problem. If you don’t follow the game of cricket, the paragraph below seems plausible. But you will immediately realize something is wrong if you do follow the game.
In summary, I would say the following:
- Quite often, there is a pretty big gap between hype and reality when it comes to Machine Learning advancements.
- The ML practitioners who create these systems don’t often talk about this gap because it is obviously not in their best interest
- Also, sometimes the hype actually turns into reality. For example, despite the occasional hallucination in Neural Machine Translation (NMT), I often use Google Translate to understand the comments/feedback that readers of this blog send me (in their native language). And 9 times out of 10, I understand perfectly what they are asking simply by using Google Translate!
- You should be skeptical of tall claims when it comes to ML advancements.
- And finally, it is always a good idea to quickly test things out before jumping into any ML based tech.
This website contains affiliate links. See the disclosure page for more details.
Check out my free YouTube courses Dialogflow CX Beginner Tutorial Dialogflow ES vs CX using a Decision Tree Bot Intro to NLU for technical non-programmers Better Dialogflow ES Bots Using the CTFS Framework Search the autogenerated transcripts of all my YouTube videos
"The magic key I needed as a non-programmer" The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn. - Kathleen R Cofounder, gathrHealth