g↗genai/ learner
AI foundations / Lesson 05

Training vs inference

Building a model and using a model are two different jobs. Using one does not normally change it. Changing it takes training.

Concept + interactive labBeginner friendly

Building a model and using it are different jobs.

Two ideas are common but wrong: that a model can never be trained further after release, or that every chat teaches it something. Neither is how it works.

Think of a factory and a vending machine. The factory builds the machine. The vending machine only hands out what it was built to hand out. Pressing its buttons does not rebuild it.

In a model, the “built” part is its learned settings: values inside the model that shape how it responds. In our example, we call the first saved set v1.

Diagram of a factory labelled Training, an arrow to a card labelled Learned settings with a v1 tag, and an arrow to a vending machine labelled Inference.
Training builds the learned settings. Inference uses them.

The picture has limits. A model is software, not metal, and it can be rebuilt later. Unlike a vending machine, it can also produce new outputs for new inputs.

You meet three ideas in this order: training, then inference, then how a chat message fits in. After that you see how a model really changes.

One question tells them apart. Are the model’s learned settings being changed? If yes, that is training. If no, and the model is producing an output, that is inference.

Running example: Ticket Tagger

Ticket Tagger is an invented tool. It reads a customer email and tags it “billing” (about money) or “delivery”. It is not a real product.

Training changes the model.

Training changes a model’s learned settings, using data. The model is adjusted again and again to try to improve at its task.

Training is usually done by the people who build the model. It typically takes far more work than a single use of the model.

In Ticket Tagger: how v1 learned

v1 was trained on emails that already had a label, like the examples and labels in lesson 1.3. For instance:

  • “I was charged twice.” was labelled billing.
  • “My box has not arrived.” was labelled delivery.
  • “Please refund my order.” was labelled billing.

After many such examples, words like “charged” and “refund” lean toward billing, and “arrived” leans toward delivery.

This is a simplified picture. Real models learn patterns that are far subtler than single words.

Why v1 will make a mistake later

Suppose v1 saw very few emails that mention a parcel and money together. An email like “My parcel charge is wrong” may then be pulled toward delivery by the word “parcel”. This gap is invented for the lab below.

Diagram: a stack of emails labelled Labelled emails goes into a factory labelled Training, which produces a card labelled Learned settings: v1.
Training turns labelled emails into learned settings.

Inference uses the model as it is.

Inference means using a model to produce an output. An input goes in, an output comes out, and the learned settings stay as they were.

In Ticket Tagger: one email, step by step
  1. An email arrives: “My parcel charge is wrong.”
  2. The app sends it to v1.
  3. v1 produces a tag, such as “delivery”.
  4. The app shows the tag. v1 is exactly as it was before.
Diagram: an envelope labelled New email goes into a vending machine fed by a card labelled Learned settings: v1, and a ticket labelled Tag: delivery comes out. Nothing points back into the card.
Inference reads the settings. It does not change them.

The same idea appears in other tools. A photo app naming a plant, a chat assistant writing a reply and a translator turning a sentence into another language are all inference.

Training is typically an occasional, heavy job. Inference happens each time someone uses the model.

A chat message is input, not training.

In this lesson’s tagger, the email and any hint are input to one request. The model uses them to produce a tag and does not change its learned settings.

In Ticket Tagger

A hint such as “this is about money” can change the tag for the request it is sent with. It leaves v1 unchanged.

Diagram: a frame labelled One request holds an envelope with a note labelled Hint; it goes into a vending machine fed by an unchanged card labelled Learned settings: v1, and a ticket labelled Tag: billing comes out.
A hint travels with one request. The settings card stays v1.
The same thing in a chat assistant

You write “Call me Sam.” The next reply says “Sure, Sam.” In many chat apps this works because the app sends your earlier messages along with each new one, so the model reads them again.

Start a new chat without those messages, and with no saved information supplying the name, and the model has no way to know it.

Some apps save information and may include relevant saved information in a later request. That is the app supplying input, like the data source in lesson 1.4. It is separate from changing the model.

How a model really changes.

A model changes when it is trained again. That can mean retraining on new data, or adapting it to a task. Both change the learned settings, so both are training.

Training can happen again after a model is released. In Ticket Tagger the builder trains a new version, v2, and the app switches to it.

In Ticket Tagger

The builder collects more labelled emails that mix parcels and money, then trains again. The result is v2. Now “My parcel charge is wrong” is tagged billing without any hint.

Diagram: a card labelled Learned settings: v1 and a stack labelled New labelled emails go into a factory labelled Training again, which produces a card labelled Learned settings: v2.
A new version comes from training again, not from using v1.

For a user this can look like the same app behaving differently after an update. In this example, the change came from a separate training step, not from sending a chat message.

Try it: a hint, then retraining.

Press the buttons in order. Watch the learned settings line and the log. Press Reset to start again.

  1. Tag email 1. While the settings are v1, it gets this wrong.
  2. Tag it again with the hint. The tag changes.
  3. Tag email 2 with no hint. v1 is wrong again.
  4. Train v2, then repeat step 3.

This is an invented toy with scripted answers. It is not a real model.

Email 1: “My parcel charge is wrong.”

Email 2: “The parcel charge on my card is wrong.” (from a different customer, sent later)

Learned settings: v1

Try them in this order, then repeat step 3. You can press any button at any time.

    What to notice

    The hint changed one reply and left v1 as v1. Only training changed the settings.

    Training or inference?

    Ask one question: are the learned settings being changed? Each item says whether the model itself is changed.

    0 of 5 right

    • The builder runs 50,000 labelled emails through the model and updates the model itself after each batch until it tags them well.
    • A customer’s email arrives and the tagger replies “delivery”. Nothing about the model is saved or changed afterwards.
    • You send “this one is about money” along with your email, and the tag for that request changes. The model itself is not changed.
    • The company uses new labelled emails to teach the model again, then releases the result as version 2.
    • You press “try again” and get a new reply. Nothing about the model is changed.

    Quick questions.

    If I correct the model, will it remember?

    Within that conversation, the app may keep sending your correction, so it can seem to. The learned settings are the same. Another chat, or another user, will not see it unless the app saves it or the builder trains again.

    Does a thumbs-down button retrain the model?

    Not by itself, and not right away. A company may collect such feedback and use it in a later training step, depending on its policies.

    Is a model trained only once?

    No. A model can be trained again after release, and the app can switch to the new version.

    Where this picture is too tidy.

    • The tagger is a toy with scripted answers. Real models and real training are far larger and messier.
    • Some real systems, such as some recommendation systems, may be updated continuously. The test is the same: are the learned settings changing?
    • A provider may use chats for later training, depending on its policies and settings. That is a separate training step, not the chat itself.
    • Chapter 2 covers how large text models are trained in stages.
    ✎ Try it yourselfKnowledge check · Practice only

    Check your understanding.

    In Ticket Tagger v1, you add the hint “this is about money” and get the right tag. The next morning a different customer’s similar email is sent with no hint and no earlier messages, and in this toy it is tagged wrong again. Why did the earlier hint not carry over?
    THE TAKEAWAY

    Take this with you.

    Ask whether the model’s learned settings are being changed. If yes, that is training, including retraining. If no, and the model is producing an output, that is inference. A message or hint is input to inference, so it can shape one reply without retraining the model.