From DIET to Deployment: Training Your First Rasa NLU Model

Published: (February 16, 2026 at 08:30 AM EST)
4 min read
Source: Dev.to

Source: Dev.to

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—that’s where real NLU development begins.

We’ve already discussed how DIET works internally. The practical question is: 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

Below we walk through each step.

Generating Training Data

Rasa models learn entirely from annotated examples. Instead of writing rules, you provide examples that illustrate the intents and entities you expect.

The NLU File

Training data lives in a YAML file, typically data/nlu.yml:

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

Notes

  • Intents are the top‑level labels.
  • Entities are annotated inline ([text](entity)).
  • No separate entity file is needed; DIET learns both tasks from this single dataset.

How Much Data Do You Need?

There’s no magic number, but a common guideline is:

Use caseExamples per intent
Minimum prototype10–15
Production baseline50–100

Diverse phrasing is far more valuable than repetitive patterns.

Bad example (repetitive):

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

Good example (varied):

  • 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 the model to generalise.

Training the Model

Once the data and pipeline configuration are ready, training is a single command:

rasa train

Behind the scenes Rasa:

  1. Reads the NLU data and builds a vocabulary.
  2. Initialises the DIET model and runs multiple training epochs.
  3. Optimises the joint loss for intent and entity prediction.
  4. Saves the trained artefacts (e.g., models/20260215-123456.tar.gz) containing the NLU and dialogue models.

What Happens During Training?

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

Typical hyper‑parameters you may tune:

  • epochs
  • learning_rate (advanced)
  • embedding_dim
  • batch_size

Testing the Model

After training, launch an interactive NLU test server:

rasa shell nlu

Type an example, e.g., “Book a flight to Madrid tomorrow”, and you’ll receive a response like:

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

This is DIET in action, trained on your data.

Common Beginner Mistakes

PitfallWhy it hurts
Too few examplesModel cannot learn variability.
Overlapping intentsCauses ambiguity and low confidence.
Copy‑paste variationsLeads to overfitting on narrow phrasing.
Mixing business logic into NLUBlurs the separation of concerns.
Ignoring real user phrasingModel fails in production.

Focus on data quality: diverse phrasing, balanced intents, clear entity boundaries, and minimal overlap. Remember the iterative loop:

Train → Test → Improve → Retrain.

Where We Go Next

Now you know how to:

  • Generate training data
  • Configure DIET
  • Train a Rasa model

The next step is to connect NLU to dialogue management:

  • Domain files
  • Stories & rules
  • Slot filling

Predicting intent is only step one; building behaviour is step two. Stay tuned for the end‑to‑end assistant tutorial.

0 views
Back to Blog

Related posts

Read more »

Preface

Motivation I wanted to record my studies to have consistency. Since I don't directly learn building projects from my CS program, I want to be an expert in my a...