DEV Community

Cover image for From DIET to Deployment: Training Your First Rasa NLU Model
Unknownerror-404
Unknownerror-404

Posted on

From DIET to Deployment: Training Your First Rasa NLU Model

CRF showed us structured entity extraction. DIET showed us joint intent–entity learning. Now it’s time to move from theory to practice.

Understanding models is important. But models are useless without data, and this is where real NLU development begins.

So far, we’ve discussed how DIET works internally.
Now we answer the practical question: How do we actually train it?

Rasa training consists of three core steps:

  1. Create structured training data
  2. Configure the NLU pipeline
  3. Train the model

Let’s walk through each.

Generating Training Data

Rasa models learn entirely from annotated examples. Unlike rule-based systems, you don’t write logic, but you provide examples.

The NLU File

Rasa training data lives inside a YAML file, typically:

data/nlu.yml
Enter fullscreen mode Exit fullscreen mode
version: "3.1"

nlu:
  - intent: book_flight
    examples: |
      - Book a flight to [Paris](location)
      - I want to fly to [Berlin](location)
      - Get me a ticket to [London](location)

  - intent: greet
    examples: |
      - Hello
      - Hi
      - Hey there
Enter fullscreen mode Exit fullscreen mode

Notice:

  • Intents are labels
  • Entities are annotated inline
  • No separate entity file
  • No feature engineering DIET learns both tasks from this single dataset.

How Much Data Do You Need?

  • There’s no magic number, but for general guidance:
  • 10–15 examples per intent → minimum prototype
  • 50–100 examples per intent → production baseline
  • Diverse phrasing is nearly always better than repetitive patterns.

Bad example:

  • Book a flight to Paris
  • Book a flight to Berlin
  • Book a flight to London

Good example:

  • I need to travel to Paris
  • Can you find flights to Berlin?
  • Get me a ticket heading to London
  • Fly me to Rome tomorrow

Variation teaches generalisation.

We've already covered the configuration of the pipeline, so those curious can read the intermediate blogs from the playlist to understand how the configuration works.

Training the Model

Once data and configuration are ready, training is simple:

rasa train

Behind the scenes, Rasa reads NLU data using it to build vocabulary. This is followed by initialises DIET model and running multiple training epochs
This is followed by optimising loss for intent + entity prediction, and those parameters are then saved as a trained model file.

models/20260215-123456.tar.gz

This folder contains:

  • NLU model
  • Dialogue model
  • Metadata Now your assistant is runnable.

What Happens During Training?

Internally:

  • Text is tokenised.
  • Tokens are vectorised.
  • Transformer layers process context.
  • Intent and entity losses are computed jointly.
  • Gradients update shared weights.

You don’t manually tune features.

Where the dev has to tune:

  • epochs
  • learning rate (advanced use)
  • embedding dimensions
  • batch size

Testing the Model

After training:

rasa shell nlu

Which activates a test server where you can truly experience the model yourself, asking prompts, testing limitations and forming improvements as you communicate.

For any input you will obtain the outputs as follows:
Say you type:

Book a flight to Madrid tomorrow

You can safely assume to obtain:

{
  "intent": {
    "name": "book_flight",
    "confidence": 0.94
  },
  "entities": [
    {
      "entity": "location",
      "value": "Madrid"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

This is DIET in action, trained on your data.

Common Beginner Mistakes

Now to address a few common yet harmful beginner errors:
Improving data quality almost always improves performance more than tweaking architecture.

So you should focus on:

  1. Diverse phrasing
  2. Balanced intents
  3. Clear entity boundaries
  4. Avoiding overlapping intent meanings

Good data reduces ambiguity.

And try avoiding:

  1. Too few examples
  2. Overlapping intents
  3. Copy-paste variations
  4. Mixing business logic into NLU
  5. Ignoring real user phrasing

Always remember:

NLU predicts meaning, and it does not enforce workflow.
And that the training works by following:
Train → Test → Improve → Retrain.

Where We Go Next

Now that we know:

  • How to generate training data
  • How to configure DIET
  • How to train a Rasa model

Next, we’ll connect NLU to dialogue training:

  • Domain files
  • Stories
  • Rules
  • Slot filling
  • End-to-end training Because predicting intent is only step one. Building behaviour is step two. Now we begin building real assistants.

Until next time.

Top comments (0)