Photo by Robert Bye on Unsplash

How To Use 🤗 HuggingFace In Your Chatbot

And How Hugging Face Is Lowering The Barrier To Entry


If a company can lower the barrier to entry for AI in general, and Conversational AI in specific, there is bound to be interest. Ease of initial access needs to be two-fold;

  • Technical and
  • Cost.

Obviously also whilst presenting a compelling value proposition.

Being able to access and experiment with software via Jupyter Notebooks at no cost, without too much technical knowledge requirements are important for creating critical mass in adoption.

Simple example of sentiment analysis on a sentence.

This is why 🤗 HuggingFace is thriving with their easy accessible and open source library for a number of natural language processing tasks.

There is striking similarities in the NLP functionality of GPT-3 and 🤗 HuggingFace, with the latter obviously leading in the areas of functionality, flexibility and fine-tuning.

Named Entity Recognition using the NER pipeline.

Pretrained models for Natural Language Understanding (NLU) tasks allow for rapid prototyping and instant functionality. Transfer learning is a technique to train a machine learning model for a task by using knowledge from another task.

🤗 HuggingFace is democratizing NLP, this is being achieved by acting as catalyst and making research-level work in NLP accessible to mere mortals.

It is important to understand 🤗 HuggingFace is a Natural Language Processing problem solving company, and not a chatbot development framework company per say.

Their pipelines and models can be used to augment a chatbot framework to perform various tasks, as you will see later in this article. But elements like operational implementation and management of intents and entities are not part of their ambit. Together with dialog development and management.

Considerations For Conversational AI

There are a few general considerations when in comes to Conversational AI technology choices for any enterprise.

The first tier includes Cost, Hosting and Technical Barriers. With 🤗 HuggingFace there is no initial cost impediment, prototyping can be performed within Jupyter Notebooks.

And productionized environments can be hosted in the cloud or installed locally. The technical barriers to entry in terms of skills are relatively low; 🤗 HuggingFace succeeded in democratizing NLP for the masses.

Three tiers of consideration when implementing Conversational AI

Looking at the second tier, it is important to understand what the requirements is. For a chatbot, 🤗 HuggingFace is not a complete solution; lacking in the areas of:

  • Dialog state management and development
  • Operational Intent and Entity creation & management.

Natural Language Understanding and Processing are the mainstay of 🤗 HuggingFace. With extensive Fine Tuning avenues. It needs to be noted that the finetuning of 🤗 HuggingFace is quite a step up from the initial prototyping phase and can get technical.

🤗 HuggingFace is a NLP tool, and even though functionality is available like Natural Language Generation and entity extraction, for day-to-day chatbot operation and scaling it’s not a perfect fit, as mentioned before. A comprehensive solution is required for dialog state management and granular intent and entity implementation and management.

The third tier of considerations are scaling, specific languages and Machine Learning. Scaling addressed the process of adding conversational aspects like disambiguation, digression, limiting fallback proliferation, forms and slot filling etc. Again this is not the forte of 🤗 HuggingFace.

🤗 HuggingFace can assist in training a model for a new language. Machine learning be incorporated and assist in the chatbot development. 🤗 HuggingFace is ideal for a higher-order NLP first pass on user input.


There is a big difference between Natural Language Processing (NLP) tools and a chatbot development framework. Common NLP tools include Q&A, classification, summarization, key word extract, named entity extraction etc.

These tools can be implemented as a top tier in a chatbot technology stack of a chatbot. Acting as a pre-processing layer for user input. This processing can include sentence boundary detection, language identification etc.

The next layer is Natural Language Under standing (NLU). A key requirement here is to, on a very granular level, define intents (verbs) and entities (nouns) which should be detected.

Areas in the chatbot development framework where 🤗 HuggingFace can make a contribution.

You can read more about 🤗 HuggingFace entitity extraction. As mentioned before, granular intent and entity extraction is required, which must be maintained daily with limited overhead by a team.

It might be possible via 🤗 HuggingFace, but for an operational environment the task of managing intents and entities is a continuous process and required a interface which allows for easy management.

While most chatbot environments converge on the NLU portion, there is a considerable divergence on how the management and development the dialog state. Regardless of the approach, this is a vital part of the chatbot’s working, but also management. An area 🤗 HuggingFace does not play in.

The Dialog Responses can be augmented with Natural Language Generation (NLG). Even though this is still experimental and not mainstream in production systems, it is an area 🤗 HuggingFace excels in.

Natural Language Processing

Here are a few practical examples of how 🤗 HuggingFace can be implemented within an existing chatbot development framework.

Classifying sequences according to positive or negative sentiments.









English to German:

English to French:


🤗 HuggingFace calls themselves the AI community building the future.

And their vehicle is to build, train and deploy state of the art models powered by referencing open source in natural language processing.

The challenge is knowing which technology to use for which task. And combining technologies in such a way, that scaling is not impeded. All the whilst adding new functionality.

🤗 HuggingFace can help enhance any chatbot with supporting processes, but it needs to be implemented according to its intended purpose.

NLP/NLU, Chatbots, Voice, Conversational UI/UX, CX Designer, Developer, Ubiquitous User Interfaces.