Course Classroom

Transformer models — Which model can route a maintenance note?

Lesson summary

A night dispatcher receives the message “The motor is finally quiet, but the guard is loose.” Should the note reach mechanical maintenance or customer service? Decide what an acceptable answer looks like before choosing a Transformer. A cheerful sentence can describe an unsafe machine.

Lesson 1 / 1 · 4 min · Beginner · English

Learning route

Transformer families, task pipelines, transfer learning, inference, bias and limitations.

The course runs a sentiment pipeline that takes ordinary text and returns a label and a score. The tokenizer converts text into identifiers. The model produces numerical scores and the pipeline turns them into readable labels. The labels come from the task the model learned. A confidence score only compares the available labels.

Work through the case

  1. Write the allowed queue codes on paper. For this exercise they are MECH and SERVICE. Record MECH as the expected route for the loose guard. Keep the original note alongside the answer so another person can audit the choice.

  2. Consider a sentiment classifier that returns POSITIVE. Even a score of 0.99 fails the queue contract because the returned label does not name a queue. Run the small check below to reproduce that failure without downloading model weights.

  3. Now compare two candidates. An encoder with a classification head trained on routing labels can output a queue directly. A causal decoder can generate an answer given a prompt but may add a sentence. Validate its output with the same rule. An encoder-decoder model is another option when the deliverable is a rewritten handover rather than a code.

Three candidate labels checked against the queue list and expected route.

Original GuideWit diagram. Three candidate labels checked against the queue list and expected route.

Worked example

Output

Valid queue

Correct route

"MECH"

True

True

"POSITIVE"

False

False

"SERVICE"

True

False

Try it with Python 3

queues = {"MECH", "SERVICE"}
reference = "MECH"
for output in ["MECH", "POSITIVE", "SERVICE"]:
    print(output, output in queues, output == reference)

Expected output

MECH True True
POSITIVE False False
SERVICE True False
Python code and its actual output. MECH passes both checks. SERVICE belongs to the list but disagrees with the expected route.

GuideWit local Python experiment. MECH passes both checks. SERVICE belongs to the list but disagrees with the expected route.

A valid queue code can still be the wrong route. After checking membership, compare the prediction with an independently assigned label. Include notes with negation and notes that mention two faults. Record ambiguous cases for a dispatcher.

Troubleshooting

Symptom

Check

A sentiment label reaches the queue field.

Read the classifier's label map and reject values outside the queue vocabulary.

The output is a valid queue but misses the loose guard.

Compare it with the dispatcher's label and examine which phrase determined the route.

Check your understanding

  1. Would a high sentiment score authorize a mechanical dispatch?
  2. What changes when the output must be a two-sentence handover?

Answer key

  1. No. The score describes sentiment labels and carries no evidence about the destination queue.
  2. You need a generation task and a check that the handover preserves the safety detail.

Glossary

Classification head — The part of a model that transforms its text representation into a score for each class.

Sources and chapter units