# Choosing a Pipeline

In Rasa Open Source, incoming messages are processed by a sequence of components. These components are executed one after another in a so-called processing `pipeline` defined in your `config.yml`. Choosing an NLU pipeline allows you to customize your model and finetune it on your dataset.

- ## How to Choose a Pipeline
  - ### The Short Answer
    If your training data is in English, a good starting point is the following pipeline:
    
    ```yaml
    language: "en"
    
    pipeline:
      - name: ConveRTTokenizer
      - name: ConveRTFeaturizer
      - name: RegexFeaturizer
      - name: LexicalSyntacticFeaturizer
      - name: CountVectorsFeaturizer
      - name: CountVectorsFeaturizer
        analyzer: "char_wb"
        min_ngram: 1
        max_ngram: 4
      - name: DIETClassifier
        epochs: 100
      - name: EntitySynonymMapper
      - name: ResponseSelector
        epochs: 100
    ```
    
    If your training data is not in English, start with the following pipeline:
    
    ```yaml
    language: "fr"  # your two-letter language code
    
    pipeline:
      - name: WhitespaceTokenizer
      - name: RegexFeaturizer
      - name: LexicalSyntacticFeaturizer
      - name: CountVectorsFeaturizer
      - name: CountVectorsFeaturizer
        analyzer: "char_wb"
        min_ngram: 1
        max_ngram: 4
      - name: DIETClassifier
        epochs: 100
      - name: EntitySynonymMapper
      - name: ResponseSelector
        epochs: 100
    ```

- ### A Longer Answer
    We recommend using the following pipeline if your training data is in English:
    
    ```yaml
    language: "en"
    
    pipeline:
      - name: ConveRTTokenizer
      - name: ConveRTFeaturizer
      - name: RegexFeaturizer
      - name: LexicalSyntacticFeaturizer
      - name: CountVectorsFeaturizer
      - name: CountVectorsFeaturizer
        analyzer: "char_wb"
        min_ngram: 1
        max_ngram: 4
      - name: DIETClassifier
        epochs: 100
      - name: EntitySynonymMapper
      - name: ResponseSelector
        epochs: 100
    ```
    
    The pipeline contains the [ConveRTFeaturizer](https://legacy-docs-v1.rasa.com/1.10.19/nlu/components/#convertfeaturizer) that provides pre-trained word embeddings of the user utterance, which is especially useful if you don’t have enough training data.

- ### Choosing the Right Components
    A pipeline usually consists of three main parts:
    
    - [Tokenization](https://legacy-docs-v1.rasa.com/1.10.19/nlu/choosing-a-pipeline/#tokenization)
    - [Featurization](https://legacy-docs-v1.rasa.com/1.10.19/nlu/choosing-a-pipeline/#featurization)
    - [Entity Recognition / Intent Classification / Response Selectors](https://legacy-docs-v1.rasa.com/1.10.19/nlu/choosing-a-pipeline/#entity-recognition-intent-classification-response-selectors)

#### Tokenization
For tokenization of English input, we recommend the [ConveRTTokenizer](https://legacy-docs-v1.rasa.com/1.10.19/nlu/components/#converttokenizer).

#### Featurization
You need to decide whether to use components that provide pre-trained word embeddings or not. We recommend using them in cases of small amounts of training data. Once you have larger amounts of data, supervised embeddings can make your model more specific to your domain.

### Multi-Intent Classification
You can use Rasa Open Source components to split intents into multiple labels by using the [DIETClassifier](https://legacy-docs-v1.rasa.com/1.10.19/nlu/components/#diet-classifier) in your pipeline.

## Comparing Pipelines
Rasa gives you the tools to compare the performance of multiple pipelines directly. See [Comparing NLU Pipelines](https://legacy-docs-v1.rasa.com/1.10.19/user-guide/testing-your-assistant/#comparing-nlu-pipelines) for more information.

## Handling Class Imbalance
Classification algorithms often do not perform well with a large class imbalance. To mitigate this, you can use a `balanced` batching strategy which ensures that all classes are represented in every batch.
