Text classification often starts with an LLM prompt. Someone routes support tickets or tags documents by feeding category names to a model and hoping the output parses correctly. A few months later teams complain about latency, cost, and malformed JSON breaking downstream pipelines. There is a simpler approach that achieves better results: freeze a sentence embedding model and train a logistic regression head on top. No fine-tuning, no GPU, no prompt engineering required.

Why prompting an LLM breaks down at scale

The pattern repeats often. A team needs to classify text—perhaps routing customer support tickets or detecting intent for a voice assistant. They prompt an LLM with 77 possible categories from the Banking77 dataset, which includes labels like "lost_or_stolen_card," "card_payment_not_recognised," and "contactless_not_working." Many of these labels are semantically close, which makes the task difficult. The demo works, but later complaints focus on cost per request, high latency, and the fragility of parsing generated text.

Banking77 contains 77 customer intent classes. Examples include "activate_my_card," "age_limit," "apple_pay_or_google_pay," and "atm_support." Many labels are semantically close, which is precisely what makes the dataset a real test of classification quality. This type of problem appears everywhere: support ticket routing, email classification, voice assistant intent detection.

LLM classification with prompting

Using OpenAI as the example, a developer creates a function that sends a chat completion request with the full list of 77 labels embedded in the prompt. The model is asked to reply with only the category name. In practice the output sometimes contains extra text, poorly formatted JSON, or a label that does not match any option. The cost adds up quickly since each request is a paid token-based call.

Classification with frozen embeddings + logistic regression

An alternative approach uses Jeffy, a library that freezes a sentence embedding model (BGE-large) and trains a logistic regression head on top. The embedding model runs locally via ONNX, and the classifier is trained on the standard Banking77 training set. The whole pipeline runs on CPU. Three lines of code are enough to predict a label, output confidence, and measure latency.

Benchmark results from a MacBook Air M2 with 16GB RAM, testing 100 held-out samples, show a clear gap between the two approaches:

  • Jeffy (BGE + logistic regression): 94.3% accuracy, 118ms latency, $0 cost
  • phi4 (14B LLM): 68% accuracy, 15.4s latency, ~$0.30 per 1K tokens
  • gemma4 (9.6B): 68% accuracy, 696ms latency, ~$0.15 per 1K tokens
  • gemma3 (4B): 64% accuracy, 956ms latency, ~$0.08 per 1K tokens
  • llama3.1 (8B): 62% accuracy, 8.9s latency, ~$0.12 per 1K tokens
  • phi4-mini (3.8B): 52% accuracy, 181ms latency, ~$0.05 per 1K tokens
  • llama3.2 (3B): 46% accuracy, 143ms latency, ~$0.04 per 1K tokens
  • mistral (7B): 39% accuracy, 17s latency, ~$0.12 per 1K tokens
  • phi (2.7B): 30% accuracy, 231ms latency, ~$0.04 per 1K tokens
  • qwen2.5 (0.5B): 15% accuracy, 55ms latency, ~$0.01 per 1K tokens

Why LLMs struggle with many classes

LLMs are general-purpose models. They were not trained specifically on banking intent labels. When presented with 77 options, they must differentiate categories based on label names alone, which leads to confusion between similar-sounding intents. A trained logistic regression classifier, by contrast, learned the embedding-space boundaries between phrases like "lost my card," "card won't tap," and "charged twice" during training. It is not guessing from label names; it has seen examples during training.

This accuracy gap widens as class count increases. At two classes (positive/negative sentiment) LLMs perform adequately. At 77 classes their accuracy collapses compared to a dedicated embedding + logistic regression system.

Cost and latency considerations

Hosted LLMs are better than local ones at classification, but the fundamental problem remains: every call sends data to an external API, incurs per-token costs, and takes seconds of latency. A recent COLM 2026 paper, "The Embedder's Dilemma," benchmarked 10 LLMs against 26 embedding models across 37 tasks and found embedding models beat LLMs on classification specifically, with LLMs costing up to 1,431x more.

Training a custom classifier takes seconds

If a team does not have a pretrained classifier for their specific task, training one is fast. Using the Jeffy Engine, a developer provides a small set of labeled examples, and the logistic regression head retrains in seconds on CPU. No GPU, no fine-tuning loop, no hyperparameter search is required. The classifier can be retrained as new labeled data arrives.

from jeffy import Engine
engine = Engine()
texts = ["reset my password", "can't log in", "upgrade my plan", "cancel subscription", ...]
labels = ["account_access", "account_access", "billing", "billing", ...]
engine.train("my_support_task", texts, labels)
result = engine.predict("my_support_task", "I forgot my login")
# → {"label": "account_access", "confidence": 0.91}

After training, the operator can predict on new inputs with structured JSON output that does not require post-processing. The jeffy-classify package can be installed via pip, and jeffy-serve starts 68 pretrained classifiers locally on port 8400. An online playground is also available at playground.jeffyclassify.com.