How do you classify text with an LLM, and when is a simple model enough?

Updated · 6 min read

What a classification job looks like

A classification job takes a piece of text and returns a label from a list you choose. Common examples are tagging support tickets by product area, routing incoming emails to the right team, detecting sentiment in reviews, identifying the intent behind a chat message and flagging spam. The output is small, but the decisions behind it are not, because every label has to mean the same thing each time it is applied.

Two questions shape the whole project. How many labels are there, and how often do they overlap? A list of five clearly separate categories is a different problem from twenty categories where one message can fit two of them. Settle these questions before you write any prompt.

Define each label so two people would pick the same one

Most classification errors start in the label list, not in the model. Vague labels such as “other” or “general enquiry” absorb anything the model is unsure about, and two labels with close meanings split similar cases at random. Write each label as a short definition that a new staff member could apply correctly on the first day.

  • A name, a one-sentence definition and a note on what the label does not cover.
  • One or two example messages for each label, including a borderline case and the label it should receive.
  • A rule for mixed messages, such as picking the most urgent label or allowing a second label.
  • A review label, such as needs a person, for text the model cannot place with reasonable confidence.

Write the prompt so the answer is easy to check

Ask the model to return one label from the list you give it, and nothing else. A structured response, such as a single field in JSON, is easier to parse and test than a sentence. Put the label definitions in the instructions, and include the examples so the model sees the same boundaries you intend.

Check your model provider’s current documentation for structured output features, because these change from one release to the next.

How do you measure accuracy?

Accuracy means nothing until you compare the model’s labels with labels a person has chosen for the same messages. Build a labelled sample that covers every label, including the rare ones, and keep it separate from the examples in your prompt. Otherwise the test only rewards the model for repeating what it was shown.

Re-run the same sample after every change to the prompt, the label list or the model. A model update from your provider can shift results, so keep the sample fixed and run it on a regular schedule.

  • Overall agreement with the person’s labels, as a starting point.
  • Agreement for each label on its own, because a rare but important label can disappear inside a good overall score.
  • A confusion table showing which labels get mixed up. It tells you whether to rewrite a definition or merge two labels.
  • A record of which prompt version produced each result, so you can see whether a change really helped.

When a traditional model is enough

A language model is not always the cheapest or fastest choice. If the text contains clear keywords, if the categories rarely change and if you already have a large history of labelled examples, a traditional classifier trained on that data may be accurate, quick to run and simple to host. Plain rules also work well, such as routing any message that contains a specific order prefix to the billing team.

A common pattern combines the two. Simple rules or a small classifier handle the obvious cases, and the language model reads only the messages they cannot place. That keeps cost predictable and sends the hard cases to the part of the system that can judge meaning.

Mistakes that make classification unreliable

Most failures are predictable and avoidable. Teams that know them can design around them from the start.

  • Testing on the same messages used as examples, which hides real errors.
  • Treating a model’s self-reported confidence as a probability. Such scores can be poorly calibrated, so measure accuracy within each band before you set a threshold.
  • Changing labels without relabelling old data, so reports from before and after the change mean different things.
  • Skipping the review label, which forces a guess on every unclear message.
  • Ignoring languages. A model that works well in English may label Traditional Chinese or Japanese text less consistently, so include each language in the sample.

How Hundred Seas helps

Hundred Seas is a product studio in Taipei. We build AI agents and AI CRM systems on Claude and on OpenAI models, and we pick the model for each task based on cost, speed, quality and where the client’s data must stay. For a classification project, that means testing prompts against your own labelled messages and comparing a language model with a simpler classifier before we recommend either.

A project with us starts with a scope step of about one week at a fixed price, which ends in a written plan, a clickable prototype and a firm quote. The build follows in weekly releases of working software over two to four weeks. A monthly run plan then keeps the classifier accurate as your labels and message volumes change.

Questions

Do I need to train my own model to classify text?
Usually not at first. A well-written prompt with clear label definitions and a few examples is a quick way to test whether a language model can do the job. Training your own classifier becomes worth considering when you have a large labelled history, the labels are stable, and the model must run at very high volume or inside your own environment.
How many labelled examples do I need before I can test accuracy?
Enough to cover every label, with the rare labels deliberately included. Count the examples per label, not only the total, because a sample that looks large can contain almost no cases of an important category. Ask a second person to label the hard cases independently, so you can see where people disagree.
Can I ask the model how confident it is?
You can ask, and the answer is a useful rough signal, but it is not a reliable probability. Treat low confidence as a trigger for the review label, and check that the threshold you choose really catches the mistakes in your labelled sample. A high confidence score does not prove that the label is correct.
Is sentiment analysis the same as text classification?
Sentiment analysis is a kind of classification, where the labels are positive, negative, neutral or mixed. The same steps apply: define the labels, decide how sarcasm and mixed reviews should be labelled, and measure accuracy on a sample. Many teams find sentiment more useful when it is tied to a topic, such as delivery or price.
Does the model work for Chinese and Japanese text?
Modern models handle Traditional Chinese, Simplified Chinese and Japanese, but accuracy varies by language, writing style and subject. Build a labelled sample in each language your customers use, include slang and very short messages, and compare results across languages before you assume they match.

Have a project in mind?

Tell us what you want to build. We reply with a plan, not a sales call.

AboutHow do you classify text with an LLM, and when is a simple model enough?