Choosing a Pipeline

Choosing a Pipeline

Choosing an NLU pipeline allows you to customize your model and finetune it on your dataset.

The Short Answer

If your training data is in English, a good starting point is using pretrained_embeddings_convert pipeline.

language: "en"

pipeline: "pretrained_embeddings_convert"

In case your training data is multilingual and is rich with domain-specific vocabulary, use the supervised_embeddings pipeline:

language: "en"

pipeline: "supervised_embeddings"

A Longer Answer

The three most important pipelines are supervised_embeddings, pretrained_embeddings_convert, and pretrained_embeddings_spacy. The pretrained_embeddings_spacy pipeline uses pre-trained word vectors from either GloVe or fastText, whereas pretrained_embeddings_convert uses a pretrained sentence encoding model ConveRT to extract vector representations of complete user utterance as a whole. On the other hand, the supervised_embeddings pipeline doesn’t use any pre-trained word vectors or sentence vectors, but instead fits these specifically for your dataset.

pretrained_embeddings_spacy

The advantage of pretrained_embeddings_spacy pipeline is that if you have a training example like: "I want to buy apples", and Rasa is asked to predict the intent for "get pears", your model already knows that the words "apples" and "pears" are very similar.

pretrained_embeddings_convert

Warning
Since ConveRT model is trained only on an English corpus of conversations, this pipeline should only be used if your training data is in English language.

This pipeline uses ConveRT model to extract vector representation of a sentence and feeds them to EmbeddingIntentClassifier for intent classification.

supervised_embeddings

The advantage of the supervised_embeddings pipeline is that your word vectors will be customized for your domain.

Comparing different pipelines for your data

Rasa gives you the tools to compare the performance of both of these pipelines on your data directly.

Class imbalance

Classification algorithms often do not perform well if there is a large class imbalance.

Multiple Intents

If you want to split intents into multiple labels, you can only do this with the supervised embeddings pipeline.

Understanding the Rasa NLU Pipeline

In Rasa NLU, incoming messages are processed by a sequence of components.

Component Lifecycle

Every component can implement several methods from the Component base class.

The “entity” object explained

After parsing, the entity is returned as a dictionary.

Pre-configured Pipelines

A template is just a shortcut for a full list of components.

supervised_embeddings

To train a Rasa model in your preferred language, define the supervised_embeddings pipeline in your config.yml.

pretrained_embeddings_convert

To use the pretrained_embeddings_convert template.

pretrained_embeddings_spacy

To use the pretrained_embeddings_spacy template.

MITIE

To use the MITIE pipeline, you will have to train word vectors from a corpus.

Custom pipelines

You can run a fully custom pipeline by listing the names of the components you want to use.