Which Text Classification Model to Use in Production: ModernBERT, DeBERTa-v3, DistilBERT or an LLM
A situation-by-situation guide to choosing between fine-tuned encoders and prompted LLMs for production text classification, with the accuracy evidence, list prices and a worked monthly cost.
The best model for text classification in production depends on three things: whether your label set is fixed, how much labelled data you have, and whether the label depends on world knowledge. With fixed labels and a few thousand examples, fine-tune ModernBERT-base; in a February 2026 benchmark, fine-tuned encoders beat zero-shot and few-shot GPT-4o and Claude Sonnet 4.5 on three of four standard datasets. With only a few hundred examples, changing labels or knowledge-heavy tasks, prompt an LLM, and at today's $0.10-per-million-token rates for low-cost models that is no longer much more expensive.
The evidence the choice rests on
Two studies compare the two approaches head to head. Alberto Andres Valdes Gonzalez's preprint (arXiv 2602.06370, February 6, 2026) fine-tuned BERT, DistilBERT and RoBERTa and prompted GPT-4o and Claude Sonnet 4.5 on IMDB, SST-2, AG News and DBPedia, reporting macro F1, cost and latency. Encoders led on AG News (RoBERTa 94.63 against Claude's best of 91.35), DBPedia (above 99.3 against 98.83) and, narrowly, SST-2 (BERT 94.42 against Claude few-shot 94.41). The LLMs led on IMDB sentiment (Claude few-shot 96.48 against RoBERTa 94.84).
Zhang and colleagues' EMNLP Findings 2025 paper tested BERT, RoBERTa, ERNIE and ELECTRA against LLM queries and LLM internal-state probes on six harder datasets, and found BERT-like models "excel in pattern-driven tasks" while LLMs win where the label requires deep semantics or real-world knowledge. When training data was cut to 10 percent, or 132 to 443 examples per dataset, methods built on an LLM's internal states were competitive on every task, while the BERT-like models degraded more.
Neither study tested ModernBERT or DeBERTa-v3 against an LLM, and neither used production data such as support tickets or many-label routing. The picks below combine their findings with each encoder's own published benchmarks.
The candidates
| Model | Size and licence | Published result | Best for |
|---|---|---|---|
| ModernBERT-base | 149M, Apache 2.0 | GLUE 88.4 | Default fine-tune; long inputs |
| ModernBERT-large | 395M, Apache 2.0 | GLUE 90.4 | More accuracy, still fast |
| DeBERTa-v3-large | 435M, MIT | GLUE 91.4 | Top accuracy on short text |
| DistilBERT | Distilled BERT | AG News 94.11 F1 | CPU-only, tight latency |
The GLUE figures come from the ModernBERT paper; DeBERTa-v3-large's size is its model card's 304 million backbone plus 131 million embedding parameters; DistilBERT's score is from the 2026 preprint. The low-cost API models discussed below, OpenAI's gpt-6-luna and Anthropic's Claude Haiku 5.5, are left out of the table because no accuracy has been published for either on these datasets.
If your labels are fixed and you have thousands of examples
Fine-tune ModernBERT-base. It was released by Answer.AI and LightOn in December 2024, trained on about 2 trillion tokens, and its model card says to fine-tune it "following standard BERT fine-tuning recipes" with transformers 4.48.0 or later. It slightly outscores DeBERTaV3-base on GLUE (88.4 against 88.1) and is much faster: on one RTX 4090 with variable-length short inputs, its paper measured 147,300 tokens a second against 35,100 for DeBERTaV3-base.
The fixed-label condition matters because an encoder learns your label set as part of its weights. Adding, merging or renaming a label means relabelling data and retraining. The 2026 preprint's author puts the point directly: encoders are "better suited to function as decision engines once the label space is fixed."
If you need the last point of accuracy on short text
Try DeBERTa-v3-large. Its 91.4 GLUE average is the highest in the ModernBERT paper's comparison, a point above ModernBERT-large's 90.4. The cost is speed: on short variable-length inputs, the paper measured DeBERTaV3-large at 12,300 tokens a second against 52,900 for ModernBERT-large. If your volume is moderate and your latency budget generous, that trade can be worth making.
If you must serve on CPU with a tight latency budget
Use DistilBERT, or a similarly small distilled model. In the 2026 preprint, served on Google Cloud Run with two vCPUs and 2 GiB of memory, DistilBERT answered AG News at a median of 108 ms and a 95th percentile of 161 ms, scoring 94.11 macro F1, close to RoBERTa's 94.63. BERT on the same setup took 197 ms at the median. For comparison, GPT-4o zero-shot through its API took 411 ms at the median and Claude Sonnet 4.5 1,435 ms. CPU serving has a limit, though: on longer IMDB reviews, BERT's median rose to 480 ms, slower than GPT-4o's 345 ms, so a CPU-only encoder is fastest on short inputs and with a small model.
If you classify long documents
ModernBERT reads up to 8,192 tokens natively. Its paper reports throughput at that length for ModernBERT-base (133,800 tokens a second with variable-length inputs) and lists no such figures for BERT or DeBERTaV3, while DeBERTa-v3-large's own fine-tuning example uses a 256-token limit. The model card warns that using the full window "may be slower than short-context inference." No published study has compared ModernBERT with an LLM on documents near the 8,192-token limit.
If you have only a few hundred labelled examples
Start with a prompted LLM. Zhang and colleagues found that BERT-like models degraded more than LLM-based methods when training sets fell to a few hundred examples, although the LLM methods that held up best in that test probed a model's internal states rather than prompting it. Among current low-priced options are OpenAI's gpt-6-luna, described on its model page as built "for focused, high-volume tasks", and Anthropic's Claude Haiku 5.5, both at $0.10 per million input tokens and $0.50 per million output. Set gpt-6-luna's reasoning effort to none: its default is medium, and reasoning tokens bill as output.
Then use the LLM to build the training set for an encoder. The 2026 preprint recommends LLMs for weak labels and synthetic data, and Vajjala and Shimangaud's 2025 study across 32 datasets and eight languages found classifiers trained on synthetic data from several LLMs beat zero-shot open LLMs. Labelling 10,000 examples with Claude Sonnet 5.5 at $2 and $10 per million tokens, assuming 400 input and 5 output tokens each, costs about $8.50.
How accuracy grows from 100 to 1,000 to 10,000 examples for ModernBERT against a prompted LLM has not been measured, so the crossover point on your data is something to test.
If labels change often, or depend on world knowledge
Keep the LLM as the classifier. A prompted model takes a new label as an edit to its instructions; an encoder needs new data and a retrain. And where the label depends on facts outside the text, the EMNLP paper's results favour LLMs clearly: on detecting false statements, an LLM internal-state probe scored 90.0 F1 and a direct Qwen or LLaMA query 86.2, against 75.6 for RoBERTa. For 50-plus-label routing or monthly label churn, no published benchmark compares the two approaches.
If you want most of both: the hybrid
Run the encoder on everything and send its low-confidence predictions to an LLM. Mathur and colleagues, in a paper posted to arXiv on October 16, 2026 for work done in 2024, tested this on 16-class survey text: RoBERTa alone scored 96 percent F1, GPT-3.5 alone 83 percent, and routing RoBERTa's predictions below 0.5 confidence to GPT-3.5 gave 97.5 percent at about 4.4 percent of GPT-3.5's cost. The paper does not say how much traffic was routed and tests a single threshold. The 2026 preprint leaves probability calibration and abstention for further investigation, so how reliably any of these encoders' confidence scores flag their errors has not been measured; set the threshold on your own held-out data.
Parsec, a small language model lab, sells this pattern as a managed service: according to its inference page it fine-tunes and serves a compact model on the customer's traffic and sends requests the model is not confident about to a closed frontier model, with downloadable weights. It publishes no price and no classification accuracy results for it.
Worked cost example
Take 10 million classifications a month, each 400 input tokens of instructions and text with a five-token label.
Prompting Claude Sonnet 5.5 costs 4 billion input tokens at $2 per million ($8,000) plus 50 million output tokens at $10 ($500): $8,500 a month. Prompting gpt-6-luna or Claude Haiku 5.5 costs $400 plus $25: $425, or about $213 through either provider's 50 percent Batch discount if results can wait.
A fine-tuned BERT-class encoder costs about $254 a month and DistilBERT about $124, using the 2026 preprint's IMDB cost per million requests ($25.44 and $12.44), the closest input length in the paper. The preprint computes that from each request's median latency on two Cloud Run vCPUs and 2 GiB at January 2026 rates, so it counts only busy CPU time and excludes training and idle capacity; an always-on instance or a GPU will cost more.
The hybrid adds the LLM's cost for the routed share. If 10 percent of requests (1 million) go to Haiku 5.5 at $42.50, the month costs about $297; at 20 percent, about $339. What share of real traffic falls below a useful confidence threshold has not been measured for these models.
At these prices a $0.10 LLM costs under twice as much as a BERT-class encoder on CPU, so the decision rests mainly on accuracy and on how stable your labels are.
Bottom line
Fixed labels and thousands of examples: fine-tune ModernBERT-base, and send low-confidence cases to a $0.10 LLM. Short text where accuracy outranks speed: DeBERTa-v3-large. CPU-only with a tight latency budget: DistilBERT. Long documents: ModernBERT. A few hundred examples: prompt gpt-6-luna with reasoning off or Claude Haiku 5.5, and use it to label data for an encoder later. Labels that change monthly or depend on world knowledge: keep the LLM. Whichever you choose, measure macro F1 on a few thousand of your own labelled inputs before you commit.
Sources
- Valdes Gonzalez, Cost-Aware Model Selection for Text Classification (arXiv 2602.06370, abstract): https://arxiv.org/abs/2602.06370
- Valdes Gonzalez, Cost-Aware Model Selection for Text Classification (full text): https://arxiv.org/html/2602.06370
- Zhang et al., Do BERT-Like Bidirectional Models Still Perform Better on Text Classification in the Era of LLMs? (EMNLP Findings 2025): https://aclanthology.org/2025.findings-emnlp.1033/
- Zhang et al., full paper (PDF): https://aclanthology.org/2025.findings-emnlp.1033.pdf
- Warner et al., ModernBERT paper (arXiv 2412.13663): https://arxiv.org/html/2412.13663v2
- Hugging Face, answerdotai/ModernBERT-base: https://huggingface.co/answerdotai/ModernBERT-base
- Hugging Face, answerdotai/ModernBERT-large: https://huggingface.co/answerdotai/ModernBERT-large
- Hugging Face, microsoft/deberta-v3-large: https://huggingface.co/microsoft/deberta-v3-large
- Mathur et al., Best of Both Worlds (arXiv 2610.24260): https://arxiv.org/abs/2610.24260
- Mathur et al., full text: https://arxiv.org/html/2610.24260
- Vajjala and Shimangaud, Text Classification in the LLM Era (arXiv 2502.11830): https://arxiv.org/abs/2502.11830
- OpenAI, API pricing: https://developers.openai.com/api/docs/pricing
- OpenAI, GPT-6 Luna model page: https://developers.openai.com/api/docs/models/gpt-6-luna
- Anthropic, Claude pricing: https://platform.claude.com/docs/en/about-claude/pricing
- Parsec, Inference: https://parseclab.ai/inference/