End-to-End Machine Learning — The Intro

This article is the introduction to a series of articles on how to build an end-to-end machine learning pipeline for a chatbot AI that relies on a user-defined knowledge base.

This article contains an overview of the use case for this project. If you would like to skip to a specific section, please click the appropriate link below.

  1. Dashboard front-end: click here
  2. Dashboard back-end: click here
  3. Deep learning model: click here

Note: this is intended to be a proof-of-concept (p.o.c.): there are still huge areas for improvement and many interesting features that might be added. If you are interested in extending the functionalities of this project, please feel free to contact me!

The Why

The motivation behind the development of this project is mainly driven by curiosity: I wanted to learn a new programming language (golang, used for the dashboard backend) as well as develop a solution that involved machine learning and other different technologies.

With such goals in mind, I decided to develop a NLP (natural language processing) oriented project, to code from scratch both the front- and backends of the solution and, while doing so, to explore programming languages, frameworks, and software architectures not yet known to me.

The Use Case

The bert-faqclass project has been developed with the aim of building a machine learning end-to-end solution. Its AI is able to answer in detail questions written in multiple languages and to manage context specific concepts characterised by words not natively known to the AI.

The key feature of the project is that the admin of the chatbot can control the knowledge base (KB) of the AI and define a set of business-related context keywords, with keyword meanings strictly dependent on the business for which the KB has been defined. The knowledge base is composed of a set of FAQs. Each FAQ is defined in several languages using a set of semantically similar training examples and their respective answers.

The architecture of the deep learning model adapts both to the number of FAQs and to the keywords automatically, without requiring human intervention.

The KB is retrieved during the training of the model. BERT multilingual was the base model chosen to undergo transfer learning on a custom network that is able to classify the input sentence into one of the knowledge base FAQs.

The architecture of the solution is depicted in Figure 1:

As can be seen, there are three main macro-components:

  • Dashboard
  • MLOps
  • Chatbot

Dashboard

The dashboard allows the KB admin to manage the FAQs, the examples, and the keywords known to the AI. The dashboard is the tool that allows the KB to be managed by the KB admin.

The dashboard is composed of a front-end and a back-end. The front-end serves the webpages to the user. The back-end is responsible for all CRUD (Create, Replace, Update, and Delete) operations, and manages the connections to Firestore, a Google Cloud Platform (GCP) No-SQL database that contains the FAQs and their training examples, answers, and keywords. The dashboard also allows the invocation of the model training.

Both components are served with Google Cloud Run, a highly scalable service for the deployment of containerized applications.

MLOps

MLOps includes the functions for training a new model, saving it, and serving it to make predictions. The GCP component used for these operations is AI Platform training and prediction.

The machine learning model architecture is parametric with respect to the number of keywords and FAQs. Once the model is successfully trained, the model is saved in Google Cloud Storage.

Chatbot

The Chatbot component is concerned with the interactions with the user. It is composed of a front-end, which serves the pages to the user, and a backend, which manages the logic of the conversation and which connects to AI Platform prediction.

In the following articles you will gain a better understanding of the solution and of the development choices.

Machine Learning Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store