Where a small classifier breaks: fixed labels, typed decisions, and LLMs
How well does a small, open model understand how people feel? I wanted to find out with the kind of sentences people really type, including sarcasm and mixed feelings.
This is the first experiment in my models repo. Each experiment in the repo is small and runs alone.
The experiment
I selected an open emotion model from Hugging Face: j-hartmann/emotion-english-distilroberta-base. It reads a sentence and selects one of seven emotions: anger, disgust, fear, joy, neutral, sadness, or surprise.
The code is short:
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="j-hartmann/emotion-english-distilroberta-base",
top_k=3,
)
while True:
text = input("> ")
for result in classifier(text)[0]:
print(f" {result['label']:<10} {result['score']:.2f}")
The first run downloads the model, which is about 330 MB. After that, the model loads from a cache in a few seconds.
The results
| Input | Top result | What it tells me |
|---|---|---|
| This is nice | joy 0.92 | Clear sentences are easy for the model. |
| ugh | disgust 0.53 | One word gives little context, so the scores spread out. |
| Why is the world in a constantly changing state | surprise 0.58 | The model reads “why” questions as surprise. It has no label for curious or tired. |
| Oh great, another Monday | joy 0.92 | Sarcasm fails. The model reads the word “great”, not the tone. |
| I got the job but I will miss my team | sadness 0.99 | Mixed feelings become one label. |
The last two results teach the most. They show what a model really is.
What I learned
A model only knows its labels and its training data. It does not understand meaning the way people do. This model learned from about 20,000 labeled English sentences. Sarcasm needs tone and context, and the model never learned them.
A single-label model makes the emotions compete. The scores always add up to 1, so joy and sadness compete and one of them wins. A multi-label model gives each emotion its own score, so both emotions can be high.
Text in other languages breaks the model. The tokenizer, the part that cuts text into pieces, cuts unknown words into small parts, and the model guesses. For other languages, you need a multilingual model, such as one built on XLM-RoBERTa.
Three kinds of models
During this work, I found a newer kind of model. It helped me see the larger picture.
| Fixed classifier | Typed decision model | LLM | |
|---|---|---|---|
| Example | My emotion model | Laya, Jev | Claude, GPT |
| Labels | Set during training | Set by me in each request | No labels. It writes any text |
| Size | Small | Medium | Very large |
| Speed and cost | Very fast, almost free | Fast, low cost | Slower, higher cost |
| Reasoning | None | A little | Strong |
Laya is an open typed decision model. You give it text and a question with options, such as “How urgent is this? Today, this week, or later”. It gives a probability for each option in one fast pass. Jev is a similar hosted model from TypeSafe AI. An early review of these models found that the speed and cost gains are real. It found no proof of an accuracy gain yet, and it found that the probabilities need calibration. So test these models before you trust them.
LLMs are general because of scale. They learn from trillions of tokens. Then more training teaches them to follow instructions. Small models still win when the task is narrow and the volume is high.
Real systems often use the same pattern. A small, fast model does most of the work. Only the cases that the small model is not sure about go to an LLM or to a person.
What is next
Next, I will build a smart router. My own small model will rate how hard each prompt is. Then it will send the prompt to the cheapest model that gives a good answer. I will also serve the emotion model as an API and load test it, to learn what scale means in practice.
I will record all the results in the repo. You can read the full plan in part 0.