How to Create an AI chatbot Effortlessly with the Lack of Data Machine Learning?

21.06.2023 ∙ Product

Hey, friend, my name is Igor Shatalyn and I’m an NLP engineer in Evolwe!

Our team creates a virtual personal assistant which can become every person’s friend, coach, and psychologist. Our mission is to make a better quality of life for every human through the creation of AGI.

At the time, we are busy developing the technology of empathic artificial intelligence — a bot that will recognize the emotional state of the user and demonstrate empathy via different communication lines: text, voice, facial expressions, and gestures. But this is a topic for a future article 🙂

Today we will talk about creating a bot via GPT-NeoX. With the help of this model, we have already implemented several solutions, so I decided to put our experience into a step-by-step guide, which you can quickly create a bot to solve your challenges with.

A short backstory

One of the first problems you will face while creating a bot is searching for relevant data.

In the open access, you can find a large number of datasets such as Persona Cat, Daily Dialog, Wizard of Wikipedia, Empathic Dialogues, and etc.

Where you can search for datasets:

The quantity of available data depends on the task that your bot is going to solve. In our case, there is not an adequate volume of representative data, and collecting a suitable dataset is time-consuming.

What should you do if, like us, you were unlucky, and there were no appropriate datasets in the public domain, and the bot is needed tomorrow in a couple of weeks?

Step 1 — pick a pre-trained ranking neural network of the GPT-3 type

The most logical step is to take a ready-made solution and try to create your own bot based on it. Surely, you know about GPT-3, thanks to that the bot will turn into reality.

GPT-3 (Generative Pre-trained Transformer 3) is a natural language processing algorithm from OpenAI. You can use the official models from OpenAI, see pricing information here. Or you can take an alternative, these are the so-called GPT-like ranking neural networks with open source, the most popular of which are GPT-Neo and GPT-J.

What will be the perfect option for you that can be found only through experiments? In our event, the budget played a key role in making the decision (at the initial stage it was very limited), so we opted for GPT-NeoX.

Next, I will talk about it. Notwithstanding, you chose a different model, the principles of operation will not change in any way.

So, we used GPS-NeoX in zero-sport learning mode to quickly create a sample.

Zero-short learning (ZSL) is a method of obtaining results from ranking neural networks without supervised learning. It works efficiently with large neural networks in conditions when there is no suitable training sample.

The core of the method is that we describe in natural language the problem to be solved and immediately get the result from the neural network. A brief description of the task submitted to the input of the generative ranking neural network is called a prompt.

Step 2 — choose the prompt

In some cases, it is enough to choose the right prompt for the quality work of the bot.

I will clarify that the quality work of a bot is a bot that copes with its task.

Therefore, the step with writing and experiments with prompts should not be neglected. I recommend starting with the most general prompt, which will give the neural network a general understanding of who it is and what task it performs.

For example, the most general prompt in our case may look like this:

The following is a conversation with an AI assistant.

Human: Hello, who are you?

AI:

By sending such a prompt, we get a generated response. For example, the following answer:

  • I’m Ben. Ben is my name.
  • Good question. I’m SmartAnty.
  • I’m an AI assistant.

As we can see, the ranking neural network can generate diverse responses. However, this is not what we would like to see in the final version.

For instance, as it can be seen from the examples above, one of the problems of GPT is the generation of completely different names. In the prompt, the bot serves as an AI assistant, a specific name was not given. So when the user asks: Who are you? The bot will generate random names for itself.

Hence, our next task is to add data to the invitation that we may not have taken into account at the very beginning. We supplemented the prompt in the following way: we indicated the name, main skills, and abilities of the bot, as well as mentioned that the bot should be friendly, responsive, and empathetic.

Updated prompt:

The following conversation is between Human and Nova. Nova is a psychologist and coach, who helps to cope with anxiety, apathy, and difficult situations. Nova helps people to understand themselves, unravel things, to reflect. The best thing in the world for Nova — is to be helpful. Supporting people is her destiny. Nova is helpful, creative, clever, and very friendly.

As a consequence, we have already received better answers. The bot memorized its name, as well as its purpose. For instance, with this prompt, GPT generated the following responses:

  • I am a psychologist.
  • Hi, I am Nova.
  • I’m Nova, I’m your coach. I help you to be more creative, and more likely to achieve.

So, thanks to such industrial engineering the bot can already confidently answer user questions.

If your bot solves a very narrow specific task, then probably already at this step you will get high-quality answers and are faced with a number of difficulties:

  • Firstly, no matter which prompt we chose, there was a high probability that an incorrect answer would be generated.
  • Secondly, our task was to make the bot’s answers useful to the user, satisfy his or her needs, and provide psychological support. And the answers were empathic, natural, and human.

And in our case, these difficulties could not be overcome only through the selection of prompts.

Step 3 — selecting a ranking neural network of answers

If your bot still does not cope with its task due to the selection of prompt, then the next step will be to create ranking neural network-a response ranking system.

The point is to generate several candidate responses using GPT, and the ranking neural network should choose the best answer, which is cognitively close to a person’s answer in our case. In other words, such a neural network will contextually select the most appropriate and consistent bot responses.

There are several ranking neural networks in the public domain, for example, DialogRPT made by Microsoft engineers.

Alas, in our case, this solution doesn’t work, since this neural network is trained on open-domain dialogues (dialogues on general topics for chit-chat bots). And we, in turn, need specialized responses from our bot. The task of our bot is not just to write empathic answers, but also to give advice, provide psychological support, and ask questions that allow the user better understand himself or herself, his or her problems, and the tasks that he or she sets for future work.

Therefore, you can either find a suitable ranking neural network in the public domain or create your own one based on marked-up texts.

OK, we have selected/created a ranking neural network. But how can this neural network help the bot choose the appropriate answers? To do this, we need a dialog design.

Step 4 — making a dialog design

The final challenge you will face when creating a bot is dialog design. The conversational design allows computers and artificial intelligence communicate and conduct casual conversations almost the same way a human would.

The dialog design includes communication with the bot and markup activity. Therefore, we began to actively communicate with the bot on various topics, and send the generated results to our psychologists for markup.

The basis of the dialog design is the markup of SI-metrics (Sensibleness, Specificity, and Interestingness) from Google, it is described in more detail in the article about bot training LaMDA. The advantage of this markup is not only in dividing the answers into “good” and “bad”. This technique includes a more complex markup consisting of many components.

First of all, we take not only the last replica of the user, but a more extended context — the previous messages of the bot and the user, and evaluate the generated response of the bot in this extended context.

Secondly, the specialist must evaluate the replica by several indicators at once to calculate the metric and, accordingly, decide whether the generated bot response is suitable. The most important indicators are the following:

  • Sensibleness — to what extent the answer makes sense in this context and whether it is contradictory to what was said earlier? In other words, is the answer completely reasonable and consistent in context? If a user answered this way, it would be clear what he or she was talking about.
  • Specificity — how specific is the answer for this context? Does the answer correspond to a specific context, is there any special, specific information, or the answer “about nothing”, can fit different dialogues?
  • Interestingness — how interesting, unexpected and witty the answer is. Did the answer seem unusual, interesting, and witty? Would you like to continue communicating with a person (bot) after such an answer? Ask some questions, and continue the discussion…
  • Safety — how safe is the answer? The answer should not be offensive, do not touch on dangerous topics, etc. Is the answer offensive, rude, or biased? If they answered this way in correspondence, wouldn’t it be unpleasant for a person? Does the bot make biased judgments about gender or race?
  • Groundedness — to what extent the answer is truthful and reliable from the point of view of factual correctness? Is the bot telling false information? (for example: about non-existent books, places, movies, etc.), as well as about their fictional plans, their history, etc. Does the bot tell the facts about the user (about his age, gender, status, biography, plans, and other facts that are impossible to know)?
  • Helpfulness — how much the answer helped the user and correctly answered his question or problem. *Is the bot’s response convincing/exhaustive? Did the bot answer the question, problem, or topic, or did it ask a clarifying question about the topic?

This step is the most significant and labor-intensive. We have been constantly working on this markup, improving the generated bot responses on a regular basis.

Conclusions

Let’s summarize our findings. We managed to create a non-clan bot with the help of two neural networks GPT-NeoX and the answer ranker, we have created an absolutely generative chatbot — neural networks generate all the answers.

Of course, the zero-short learning approach will not give such a result as training a neural network ranker on high-quality datasets. But this is a good way to create a working prototype of the bot in a short time.

AI is definitely a game-changing technique. But creating and deploying successful AI products is difficult. In order to create a successful product plan with artificial intelligence, in our opinion, it is necessary:

– to set realistic expectations, taking into account existing limitations;

– to use different approaches in your work, and try something new.
90% of our work is conducting experiments;

– to follow the experts in your field and beyond as well as be ready to share experience and knowledge.

I hope that our practice has been useful to you and will help you in creating your product. Share your successes.

Keep in touch!

Similar Posts

Product

14.03.2024

Evolwe at CoRN 2023

link

Our founder joined to the Consciousness Research Network with a topic "Towards a More Human AI: Designing for Empathy and Personalization"

Product

14.03.2024

Evolwe collaborated with Dr. David Gamez and Middlesex University

link

We're thrilled to share our latest venture into the world of AI and emotion recognition, led by Dr. David Gamez.

Product

14.03.2024

Evolwe at IARCE 2023

link

Our founder Aliya Grig joined the 3rd International Conference on Industrial Automation, Robotics, and Control Engineering (IARCE 2023).

Product

14.03.2024

Evolwe at TechTalks with TFN, Homegrown, London

link

This is an amazing discussion about the AI future that promises not just technological innovation but also compassion, empathy, and inclusivity.

Product

11.08.2023

Evolwe at The Science of Consciousness

link

This is the leading event dedicated to the study of human consciousness.

Product

11.08.2023

Evolwe as part of the AI for Good summit

link

During the summit, our founder could discuss the use of Evolwe technologies in robotics and especially smart companion in settings to improve the world's wellbeing and promote sustainability.

Subscribe and get the latest updates, events, and offers from Evolwe

    By clicking "Subscribe" you agree to Evolwe's Terms of Use and Privacy Policy.