What it takes to develop a good AI

A robot's face silhouette with a text box inside it.

We are living in the era of Artificial Intelligence since everyone is talking so much about how it will revolutionize our market and our lives. Well, I want to share today a use case in which I worked directly: creating a virtual attendant that teaches the end user to create a “Project Model Canvas” through conversations in Portuguese (PT-BR).

There are several tools on the market – the famous Chat Bots – that you can think of. The easier option would probably be paying for one of these services, but keep in mind that maintaining a flow of context, recognizing the user’s back and forth in the conversation, understanding referrals are something these tools currently do not do. They act on as an IVR (Interactive Voice Response) and guide the user’s conversation being active, such as: “What are you going to eat today? Pizza or Hot dog? “ is very different from “What are you going to do today?”, where the customer is free to speak innumerable different answers.

First attempts

The first attempt was to use IBM’s Watson Conversation and inserting several models of conversations. The first impact was to treat short answers – such as a simple “yes” – in the dialog models in multiple instances. The user’s response would be simpler or equal to other places and realized that the flow of context was not followed by the AI. The following attempt was DialogFlow from Google, it gave the support to create the context flow (in this case called intentions). The thing is Google does not have anything of its Machine Learning enabled for Portuguese.  A simple extra comma, or the lack of it, and the AI couldn’t correctly recognize the user’s intention.

The conclusion was that this world of artificial intelligence for conversation was still a bit immature since there are many things to be tackled yet.

The corpus is the most important!

How could this problem be solved? Creating our own virtual attendant! It started by making a relational database to store the phrases, intentions, entities and context flow. By using some queries with Levenshtein, we realized in a few lines that our result was achievable. Let’s clog this database with examples of conversations and see where it gets. Clog with examples? Where can I find examples of conversations which are exactly what the attendant the AI should respond to? The answer is:  stop writing code and go generate – or find – corpus.

And this is what I consider the biggest difference and the biggest obstacle in any intelligence to develop/apply: the corpus that the AI ​​will use to train. The better your corpus, the smarter your AI will be. And in most cases, it is not enough to just put some initial data and then use “Machine Learning” taking the data somewhere. Take the famous case of “Tay” as an example: Microsoft AI that in less than 24 hours was already causing terror on Twitter with its controversial statements and was taken off the air. Training requires dedication, filtering, supervision, and follow-up.

Talk is cheap, show me the AI!

In the end, the goal was achieved even without using the most famous API in the market, but don’t think it was easy. To start with AI you need to know programming, but if you ever want to develop it further, you need to know more about data mining, math, and a few other things.

If you have questions or are  interested to know more about the whole process and the code, do not hesitate to contact me: natam.oliveira@ckl.io

About the author.

Natam Oliveira
Natam Oliveira

VP of Engineering at Cheesecake Labs - IA / IoT enthusiast. Go bravely where no one have never gone before!