Kolkata ·  
AI engineering
workflows
short · 3 min

Classification

Putting each input into one of a fixed set of buckets, with a prompt instead of a trained classifier.

updated 29 Sept 2026

Picture an insurance company's support inbox. Every ticket has to land in one of ten buckets: billing inquiry, billing dispute, claims assistance, claims dispute, policy comparison, and so on. That's classification: one input in, one label out, from a list we fixed ahead of time.

The old way is to label a big pile of tickets and train a model on them. With an LLM we can describe the buckets in a prompt and start with a few dozen labelled examples. That's handy when we don't have much labelled data, when the buckets will change (a new one is a prompt edit, not a retraining), when the rules are about meaning ("a complaint about a claim decision is a dispute"), or when tickets arrive in several languages.

And it's one of the easiest LLM features to measure, because each answer is either the right bucket or it isn't. So let's measure it.

Climbing from 10% to the 90s

Anthropic has a worked example of exactly this inbox, with 68 test tickets. Here's what each change bought.

Random guessing gets about 10%, which is what ten buckets gives us.

A prompt with a definition for each bucket gets about 70%. Where does it go wrong? Mostly between buckets that sound alike, billing inquiry against billing dispute. That's worth sitting with: the model can only sort as well as the buckets are defined. Fuzzy or overlapping categories are where the errors pile up, so writing them down clearly is the first and biggest lever.

Next, for each new ticket we look up the five most similar labelled tickets (by embedding similarity) and put them in the prompt as examples. 94%. The model gets to see how real tickets, close to this one, were sorted.

Last, the model reasons about the ticket before giving the label (chain of thought). 97%.

So the examples did most of the work, and the reasoning added a little.

How sure are we of those numbers?

Less than the chart makes it look. The same notebook prints 74% for the definitions-only run in its own report. A separate re-run with a test tool got 70.6%, 94.1% and 95.6%. Anthropic's ticket-routing guide quotes the examples step as 71% to 93%.

That spread isn't surprising once we count: with 68 tickets, one ticket is about 1.5 points. 94% against 97% is two tickets. So "similar examples help a lot, reasoning helps a little" is what we can trust. The exact figures, much less so. On our own data, we'd label a test set from real tickets first (evals) and look at accuracy per bucket, since an overall number hides the two buckets that keep getting swapped.

Getting the label out cleanly

The label has to reach our code as one of the ten allowed values. The worked example starts the model's reply with <category> and stops it at </category>. The ticket guide asks for reasoning in one tag and the label in another, then pulls them out with a regular expression. If the label tag is missing, that regex quietly returns an empty string, which gets scored as a plain miss. Making the API return only one of the allowed labels closes that gap (structured output). If we want reasoning too, the reasoning field goes before the label, so the model thinks first.

Past about 20 buckets the prompt and its examples get unwieldy. The fix is a tree: first "technical, billing or general", then a smaller classifier under each. More accurate, but every level is another call.

Would a small model fine-tuned on our labelled tickets beat all this on cost, speed or accuracy, once we have enough of them? Neither source tests that. And once we have a label we trust, the obvious next move is to act on it, which is routing.

Further reading

  • Classification with Claude, Garvan Doyle (Anthropic), 2024. The insurance inbox, with accuracy at every step and the re-run at the end. Worth running yourself.
  • Ticket routing, Anthropic, undated. When an LLM beats a trained classifier, target numbers for success, and the tree for many buckets.