LIVE · Thursday 3 December

ModernBERT vs DeBERTa-v3 for Classification: Which Encoder to Choose for Each Workload, With Serving Costs

DeBERTa-v3 holds a small accuracy edge in the one controlled test, and ModernBERT is two to four times faster and accepts 8,192 tokens. This guide matches each workload to a starting model and prices the difference.

By Nick8 min read

Choose ModernBERT-base for long documents and high-volume classification, and fine-tune DeBERTa-v3-large alongside it when inputs are short and each error is costly. In the one controlled comparison, a French study published in December 2025, the DeBERTaV3 design won every classification task by 0.27 to 1.54 points. ModernBERT's authors measured their base model at two to four times DeBERTaV3-base's throughput on an RTX 4090. At 100 million short messages a month, that gap is worth about $137 a month of RTX 4090 time at RunPod's $0.89 hourly list price.

The right starting model depends on input length, traffic and the cost of a wrong label

The table pairs five common classification workloads with a starting model and the model worth testing against it.

Your workload Start with Also test Main reason
Documents longer than 512 tokens ModernBERT-base ModernBERT-large DeBERTa-v3 has 512 positions
High-volume short text ModernBERT-base DeBERTa-v3-base 2 to 4 times the throughput
Short text, costly errors DeBERTa-v3-large ModernBERT-large Higher GLUE and French study scores
Few labelled examples Both base models TF-IDF baseline Label efficiency not measured
Routing with deferral Better-calibrated model Both base models Error at fixed coverage decides

For documents past 512 tokens, ModernBERT is the only one of the two that accepts the whole input

DeBERTa-v3's configuration sets 512 position embeddings, and Microsoft's example fine-tuning scripts use a maximum length of 256 tokens. A 4,000-token contract or research paper must therefore be cut short or split into chunks. Splitting adds a second step that combines the chunk predictions, and evidence spread across distant sections can be lost.

ModernBERT accepts 8,192 tokens. It was pretrained at 1,024 tokens and then extended, according to its model card. In its authors' RTX 4090 tests, ModernBERT-base processed 8,192-token documents at 123,700 tokens per second, while DeBERTaV3 could not run that configuration. The card warns that the full window "may be slower than short-context inference," so long inputs still cost more per request than short ones.

This row only applies when the label depends on text beyond the first 512 tokens. A classifier that routes on an email's subject and first paragraph gains nothing from the longer window.

For high-volume short text, ModernBERT's throughput lead comes from removing padding

A standard encoder pads every input in a batch to the length of the longest one and then computes over the padding. ModernBERT strips the padding before the model runs and uses a 128-token local window in two of every three layers. The gain is largest when input lengths vary, which describes most real traffic.

The ModernBERT paper measured throughput on one RTX 4090, averaged over ten runs on synthetic documents. On fixed 512-token inputs, ModernBERT-base processed 148,100 tokens per second against 70,200 for DeBERTaV3-base. On mixed lengths centred on 256 tokens, it processed 147,300 against 35,100. ModernBERT-base also fit batches of 1,604 short inputs against 236 for DeBERTaV3-base.

These are the ModernBERT authors' own figures for batched throughput on synthetic inputs, and the paper does not report tokenization time. They are not p50 or p95 latency for one request. FlashDeBERTa, an Apache-2.0 package that applies FlashAttention to DeBERTa, may close part of the gap. Its README claims three to five times faster inference but does not name the hardware for that claim.

For short text where errors are expensive, DeBERTa-v3-large has the stronger accuracy record

DeBERTa-v3-large leads ModernBERT-large on GLUE, 91.4 against 90.4, according to the ModernBERT model card. The card says that "ModernBERT-large is second only to Deberta-v3-large." At base size the card lists ModernBERT ahead, 88.4 against 88.1. The ModernBERT paper notes, however, that DeBERTaV3's GLUE numbers came from earlier publications and were not re-run under ModernBERT's own tuning sweep.

The controlled French study is the stronger evidence. Wissam Antoun, Benoît Sagot and Djamé Seddah of Inria pretrained a French ModernBERT on the same corpus as CamemBERTaV2, a French DeBERTaV3. With five seeds per setting, the DeBERTaV3 model scored 95.63 against 95.18 on review classification and 84.82 against 83.28 on XNLI. The authors conclude that "DeBERTaV3 remains the stronger choice when performance and sample efficiency are required."

The study tested French base models, so it does not show that English DeBERTa-v3-large beats ModernBERT-large on your data. It also found that ModernBERT was unstable during fine-tuning and sensitive to hyperparameters. A fair trial therefore gives ModernBERT the same number of tuning runs as DeBERTa, not a single default learning rate.

For small labelled sets, the evidence does not favour either model

The French study reports that DeBERTaV3 had better "sample efficiency." In that paper the phrase describes how quickly each model improved during pretraining on a fixed corpus. It does not describe how many labelled examples each model needs during fine-tuning. That label efficiency has not been measured for the English ModernBERT and DeBERTa-v3 checkpoints.

A team with a few thousand labelled examples should therefore fine-tune both base models and add a simple baseline. A TF-IDF model with logistic regression in scikit-learn runs without a GPU. If it reaches the accuracy target, neither encoder is needed. If an encoder beats it only on long inputs or rare classes, the results by length bucket and by class show where the GPU cost buys accuracy.

For routing with deferral, the model with better error at fixed coverage wins

A routing classifier acts on confident predictions and sends the rest to a person or a larger model. That design depends on calibration: inputs scored at 0.9 should be correct about nine times in ten. Chuan Guo and colleagues found in 2017 that modern neural networks are often poorly calibrated. They also found that temperature scaling, fitted on held-out data, worked well on most of their datasets.

Two rules keep the measurement fair. The scikit-learn documentation says that the calibrator should be fitted on data that was not used to train the classifier. It also says that isotonic calibration matches or beats sigmoid scaling only with more than about 1,000 samples. The deciding number is the error rate on the most confident 70, 80 or 90 percent of inputs, which Yonatan Geifman and Ran El-Yaniv framed in 2017 as a trade between risk and coverage. Neither the model cards nor the two papers report calibration for these checkpoints on English classification.

Parsec, a small-model lab, applies a similar confidence gate in its TOD decision model. According to Parsec's TOD page, the gate passes a turn to the parent LLM when TOD is not confident. The TOD release pairs LoRA adapters on Gemma 4 12B with a ModernBERT-base retriever, according to its model card. TOD ranks actions from a supplied list and is not a ModernBERT text classifier. Parsec's pages do not mention a service for fine-tuning ModernBERT classifiers and publish no price for custom tuning.

Each checkpoint should be pinned by revision, because counts and token limits differ

Published parameter counts often understate DeBERTa-v3. Its base card gives "only 86M backbone parameters" but adds 98 million embedding parameters for its 128,000-token vocabulary, about 184 million in total. DeBERTa-v3-large has 304 million backbone and 131 million embedding parameters, about 435 million. ModernBERT-base totals 149.7 million and ModernBERT-large 395.9 million, according to their safetensors files.

Four details affect whether a test can be reproduced.

  • ModernBERT-base is at commit 8949b90 and ModernBERT-large at 45bb465, both last modified on January 15, 2025, under Apache 2.0.
  • DeBERTa-v3-base is at commit 8ccc9b6 from September 22, 2022, and DeBERTa-v3-large at 64a8c8e from March 19, 2023, under MIT.
  • ModernBERT uses a BPE tokenizer with 50,368 entries and needs transformers 4.48.0 or later, while DeBERTa-v3 uses a SentencePiece model with 128,100 entries.
  • The same text produces different token counts in each tokenizer, so truncation at 512 tokens removes different amounts of text.

A worked example shows that GPU cost differs by about four times but stays small at moderate volume

The example prices inference for a support-routing classifier. It uses the following assumptions, all drawn from list prices and published measurements.

  • The classifier handles 100 million messages a month at an average of 256 tokens, or 25.6 billion tokens.
  • Throughput matches the ModernBERT paper's mixed-length RTX 4090 figures for batched processing, with tokenization time not included.
  • The GPU is an RTX 4090 at $0.89 an hour on RunPod's Secure Cloud, as listed on November 12, 2026.

On those assumptions the monthly GPU time and cost are as follows.

  1. ModernBERT-base needs 48.3 GPU-hours, or $42.97.
  2. DeBERTa-v3-base needs 202.6 GPU-hours, or $180.31.
  3. ModernBERT-large needs 134.4 GPU-hours, or $119.64.
  4. DeBERTa-v3-large needs 578.1 GPU-hours, or $514.54.

A single RTX 4090 left running for a 30-day month costs $640.80 at the same rate. At the paper's rates it can process about 91 billion tokens a month with DeBERTa-v3-base and about 32 billion with DeBERTa-v3-large. One GPU therefore carries this workload with any of the four models. DeBERTa-v3-large would use about 80 percent of the GPU, which leaves little room for traffic peaks.

At this volume the serving bill is small next to the cost of wrong labels. The gap changes the number of GPUs once traffic passes one GPU's monthly capacity. That is about 32 billion tokens for DeBERTa-v3-large, 91 billion for DeBERTa-v3-base and 382 billion for ModernBERT-base. A strict p95 latency target that forces small batches would also reduce these capacities. None of the cited sources reports training time, p50 and p95 latency including tokenization, or peak memory for these checkpoints.

A matched trial on your own data turns the table into a decision

The defaults in the table are a starting point, and a short trial confirms them. The trial should cover the following points.

  1. Fix train, validation and test splits before tuning, and use the validation split alone for both tuning and calibration.
  2. Give each model the same number of tuning trials and at least five seeds, and report macro-F1 with confidence intervals and recall for each class.
  3. Break results down by input length, for example under 128, 128 to 512, and over 512 tokens.
  4. Measure p50 and p95 latency from raw text to label at batch sizes 1 and 32, including tokenization, padding and truncation, together with peak memory.
  5. Report error at 70, 80 and 90 percent coverage after temperature scaling, separately from accuracy.

Public sets make the trial repeatable. Banking77 offers 77 intents with 10,003 training and 3,080 test examples under CC BY 4.0. The arXiv classification set offers 11 classes of documents longer than 4,000 tokens, and its no_ref configuration removes class labels printed inside the papers. Choose the faster model if it lands within the accuracy margin agreed before training.

Sources

More in Research

All Research →