LIVE · Thursday 3 December

Best Open-Weight Model for Classification and Routing With Confidence Scores, by Situation

Teams with labels should fine-tune ModernBERT, teams without labels should use GLiClass or DeBERTa zero-shot, and RouteLLM fits strong-or-weak LLM routing. Each score needs a calibration check before it drives a decision.

By Surya8 min read

The best open-weight model for classification and routing with confidence scores is a fine-tuned ModernBERT if you have labeled data, and GLiClass or DeBERTa-v3 zero-shot if you do not. With labels, fine-tune ModernBERT (Apache 2.0) and calibrate its probabilities with temperature scaling. Without labels, use GLiClass (Apache-2.0) or deberta-v3-large-zeroshot-v2.0 (MIT), which accept the label list with each request. To choose between a cheap and an expensive LLM, use RouteLLM (Apache-2.0). In each case, the confidence score is safe to act on only after you measure its calibration on your own requests.

Five open models cover the common situations, but their published figures cannot be compared directly

The table lists each model's licence, where its labels come from, and the headline figure on its own model card or launch post. The figures come from different datasets and cannot be ranked against each other.

Model Licence Labels Published figure
ModernBERT-base, fine-tuned Apache 2.0 Fixed at training GLUE 88.4 for the base model
gliclass-modern-large-v3.0 Apache-2.0 Supplied per request 0.6082 average zero-shot F1
deberta-v3-large-zeroshot-v2.0 MIT; training data varies Supplied per request 0.673 mean macro-F1 over 28 tasks
RouteLLM mf router Apache-2.0 Strong or weak LLM Over 85% lower cost than GPT-4 alone on MT Bench, per LMSYS
NVIDIA prompt-task-and-complexity-classifier NVIDIA Open Model License 11 fixed task types 0.981 task accuracy

A side-by-side test of these models for macro-F1, calibration error, latency and throughput on the same intent and routing sets has not been published.

Teams with labeled data should fine-tune ModernBERT and calibrate it

Answer.ai released ModernBERT on December 19, 2024, in base (149M parameters) and large (395M parameters) sizes. Both read up to 8,192 tokens, which Answer.ai describes as "over 16x larger than most existing encoders." The Hugging Face card lists the weights, architecture and training code under Apache 2.0. Answer.ai calls it a "slot-in replacement for any BERT-like models," so standard BERT fine-tuning recipes work. Answer.ai also reports that it runs twice as fast as DeBERTa.

A fine-tuned model returns logits for a fixed set of labels, which makes it the easiest model to calibrate. Chuan Guo and colleagues showed at ICML 2017 that modern neural networks tend to be poorly calibrated. They also found that temperature scaling, which divides the logits by one number fitted on held-out data, works well on most datasets. Dividing by that number leaves the top label unchanged, so accuracy stays the same. Since version 1.8, released in December 2025, scikit-learn has offered this as CalibratedClassifierCV(method="temperature").

Teams that have only a few examples can still take this route. A Hugging Face walkthrough generates synthetic training data with an LLM and fine-tunes ModernBERT on it.

Teams without labels, or with labels that change, should use a zero-shot encoder

Zero-shot encoders take the candidate labels with each request, so a new route does not need retraining. Two open families fit this situation:

  • Choosing GLiClass gives a published throughput figure to plan capacity around. The gliclass-modern-large-v3.0 card lists 399M parameters, Apache-2.0, and 43.80 examples per second at batch size 1 on an A6000 GPU. Speed falls from 46.30 to 32.89 examples per second as the label count rises from 1 to 128. The larger gliclass-large-v3.0 scores 0.7001 average F1 but runs at 25.22 examples per second.
  • Choosing DeBERTa-v3 zero-shot keeps the stack inside Hugging Face's standard zero-shot-classification pipeline, which runs on CPU or GPU. The pipeline scores each label as a natural language inference hypothesis. Inputs are limited to 512 tokens. The author recommends the "-c" variants for strict legal requirements, because they are trained only on commercially friendly data.

Neither model card mentions calibration. GLiClass's example applies a 0.5 threshold to per-label scores. The Transformers pipeline normalizes scores to sum to 1 when multi_label=False, and scores each label independently when multi_label=True. Until a team checks those scores against labeled requests, they work as a ranking rather than as probabilities.

Teams routing between two LLMs should start with RouteLLM

RouteLLM, which LMSYS announced on July 1, 2024, routes each query to either a strong model or a weak model. LMSYS reports cost cuts of over 85% on MT Bench, 45% on MMLU and 35% on GSM8K against using GPT-4 alone, while keeping 95% of GPT-4's performance. The repository recommends its matrix factorization router, mf. It sets the threshold from a sample of your own queries and a target share of strong-model calls, with python -m routellm.calibrate_threshold --task calibrate --routers mf --strong-model-pct 0.5 --config config.example.yaml. It also ships an OpenAI-compatible server.

RouteLLM fits only this two-model decision. For routing by task type across many models, NVIDIA's prompt-task-and-complexity-classifier assigns one of 11 task types and scores six complexity dimensions. It returns the top task's probability. It was trained on 4,024 human-annotated English prompts and needs an NVIDIA GPU, and teams must map its task types to their own models.

Teams choosing tools or actions inside an assistant have a newer option in TOD

Parsec's TOD targets the case where an assistant picks one action from a caller-supplied list. It is released as Apache-2.0 LoRA adapters on Google's gemma-4-12B-it plus a ModernBERT-base retriever. The Gemma 4 base weights are not included and carry Google's terms. Its predict call returns one probability per option, summing to 1, and the repository reports tests with up to 300 options. Parsec's TOD page describes a confidence gate that passes uncertain turns unchanged to the parent LLM, and it lists a hosted price of $0.30 per 1,000 decisions, on top of the parent model's cost. The repository states that TOD is not state of the art on the public JevBench benchmark, and no independent calibration measurement of TOD has been published.

Self-hosting GLiClass on one A6000 costs less than Haiku 5.5 only above about 11 million requests a month

Self-hosting a classifier is not automatically cheaper than calling a hosted LLM. The example below prices 3 million requests a month and states every assumption:

  • Each request has 400 input tokens, counting the text, the label list and the instructions, and 10 output tokens.
  • The hosted LLM is Claude Haiku 5.5 at Anthropic's list price of $0.10 per million input tokens and $0.50 per million output tokens.
  • The open model is gliclass-modern-large-v3.0 on one RTX A6000 rented from RunPod at $0.69 an hour on Secure Cloud, running all 720 hours of the month.
  • Throughput is the card's 43.80 examples per second at batch size 1.
Setup Monthly cost at 3 million requests Cost per request
Claude Haiku 5.5 API $135 about $0.000045
One A6000, always on, GLiClass $496.80 about $0.000166
One A6000, Community Cloud from $0.33/hr $237.60 about $0.000079

The hosted LLM costs $120 for input and $15 for output. The GPU is busy for only about 19 hours of the month at this volume. The break-even point with Haiku 5.5 is about 11 million requests a month on Secure Cloud, or about 5.3 million on Community Cloud. One A6000 at batch size 1 could handle about 113 million requests in 30 days, so above the break-even point the GPU gets steadily cheaper per request.

Anthropic notes that Claude 4.7 and later models use a tokenizer that produces about 30% more tokens for the same text, so measure token counts on real traffic. The example also leaves out engineering time and a second GPU for failover. Batched throughput is not published on the GLiClass card. Below the break-even volume, the case for the open model rests on the confidence score: it returns a score for every option in one pass, and it can be calibrated and thresholded.

The threshold you deploy comes from your own coverage curve

No one has published a curve that shows what share of traffic these models can handle at a 90%, 95% or 99% accuracy target. Each team has to draw its own, using these steps:

  1. Hold out labeled requests that the model never trained on, and save the full score vector for each.
  2. For a fine-tuned model, fit a temperature on half of the set and apply it to the other half.
  3. Measure expected calibration error, which Guo and colleagues define as the weighted average gap between accuracy and confidence across confidence bins. Plot a reliability diagram with scikit-learn's calibration_curve.
  4. Sort requests by top confidence and pick the lowest threshold at which accuracy above it meets your target.
  5. Send everything below the threshold to a larger model or a person, and add those requests to the next training set.

For zero-shot scores, which come without logits, scikit-learn's isotonic method is the usual alternative to temperature scaling. Its documentation warns that isotonic calibration overfits small sets and performs best with more than about 1,000 samples. With fewer labeled examples than that, set the threshold directly from the coverage curve and recheck it as more labels arrive.

The code below covers steps 2 to 4 for any model that returns logits. It uses only NumPy and SciPy, and it prints the threshold and the share of traffic covered at 90%, 95% and 99% accuracy targets.

import numpy as np
from scipy.optimize import minimize_scalar
from scipy.special import log_softmax, softmax

def fit_temperature(logits, labels):
    idx = np.arange(len(labels))
    nll = lambda t: -log_softmax(logits / t, axis=1)[idx, labels].mean()
    return minimize_scalar(nll, bounds=(0.05, 10.0), method="bounded").x

def ece(probs, labels, bins=15):
    conf, correct = probs.max(1), probs.argmax(1) == labels
    edges = np.linspace(0, 1, bins + 1)
    total = 0.0
    for lo, hi in zip(edges[:-1], edges[1:]):
        m = (conf > lo) & (conf <= hi)
        if m.any():
            total += m.mean() * abs(correct[m].mean() - conf[m].mean())
    return total

def threshold_for(probs, labels, target=0.95):
    conf, correct = probs.max(1), probs.argmax(1) == labels
    order = np.argsort(-conf)
    acc = np.cumsum(correct[order]) / np.arange(1, len(order) + 1)
    ok = np.where(acc >= target)[0]
    if len(ok) == 0:
        return None, 0.0
    k = ok.max()
    return conf[order][k], (k + 1) / len(order)

# T = fit_temperature(val_logits, val_labels)
# probs = softmax(test_logits / T, axis=1)
# print(ece(probs, test_labels))
# for target in (0.90, 0.95, 0.99):
#     print(target, threshold_for(probs, test_labels, target))

For a zero-shot model, the same check runs on the pipeline's scores. The example below uses the DeBERTa zero-shot model in single-label mode, so that the scores across labels sum to 1.

from transformers import pipeline

clf = pipeline("zero-shot-classification",
               model="MoritzLaurer/deberta-v3-large-zeroshot-v2.0")
out = clf("I was charged twice for the same order",
          candidate_labels=["billing", "shipping", "returns", "account access"],
          hypothesis_template="This text is about {}",
          multi_label=False)
# out["labels"] is sorted by score; out["scores"] holds the matching values

Sources

More in Models

All Models →