---
title: "ModernBERT or DeBERTaV3? Examining Architecture and Data"
description: "A controlled French pretraining study compares ModernBERT with DeBERTaV3 and RoBERTa on accuracy, data efficiency, training cost…"
canonical: "https://research.elamur.ai/free/en/papers/antoun-2025-modernbert-or-debertav3-examining-architecture/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/antoun-2025-modernbert-or-debertav3-examining-architecture/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2025](https://md.research.elamur.ai/free/en/papers/2025/) / ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance

# ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance

Paper · 2025 · Wissam Antoun, Benoît Sagot and Djamé Seddah

**Authors:** [Wissam Antoun](https://md.research.elamur.ai/free/en/authors/wissam-antoun/), [Benoît Sagot](https://md.research.elamur.ai/free/en/authors/benoit-sagot/) and [Djamé Seddah](https://md.research.elamur.ai/free/en/authors/djame-seddah/) · **Year:** 2025 · **Venue:** Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2025.ijcnlp-long.164/)
- [PDF](https://aclanthology.org/2025.ijcnlp-long.164.pdf)
- [DOI 10.18653/v1/2025.ijcnlp-long.164](https://doi.org/10.18653/v1/2025.ijcnlp-long.164)

## Summary

When a new text encoder scores higher than an older one, its training data can be as important as its design. That was the difficulty with earlier comparisons of ModernBERT and DeBERTaV3. The original ModernBERT study reported stronger results on several benchmarks, but the available details about its corpus left open what would happen if both encoders learned from the same text. The authors train a base-sized ModernBERT on the public [French](https://md.research.elamur.ai/free/en/topics/french/) corpus already used for CamemBERTaV2, a DeBERTaV3 encoder, and CamemBERTv2, a RoBERTa encoder. They also train a separate French ModernBERT on a larger, more heavily filtered corpus. Together, these comparisons ask what changes when the training recipe changes and what changes when the text changes.

With the corpus held fixed, CamemBERTaV2 led every benchmark in the main comparison outside the embedding evaluation. Its advantage was visible in [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/), where it scored 83.04 F1 on FQuAD against 81.34 for ModernBERT-CV2, and in [named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/), where it scored 93.40 F1 against 92.03 on the French Treebank evaluation. Its intermediate checkpoints also reached stronger results earlier in pretraining. ModernBERT-CV2 still improved on CamemBERTv2 across the directly supervised tasks. The order changed for [information retrieval](https://md.research.elamur.ai/free/en/topics/information-retrieval/). CamemBERTaV2 produced weak retrieval embeddings under the tested procedure, and CamemBERTv2 finished ahead of both ModernBERT variants on the overall French MTEB embedding evaluation.

ModernBERT had a different advantage in computational cost. The paper reports 1300 H100 GPU-hours for ModernBERT to process 1 trillion pretraining tokens and around 2700 GPU-hours for CamemBERTaV2 to make a single pass over 275B tokens. The stronger DeBERTaV3 results per training token and the lower ModernBERT cost per run therefore describe different kinds of efficiency. The authors also emphasize ModernBERT’s inference speed and ability to process longer inputs. After a continuation phase that raised the input limit to 8,192 tokens and changed the training data and schedule, the filtered-corpus variant achieved the highest result on the French long-document retrieval test, with an average NDCG@10 of 34.32.

The filtered corpus helped ModernBERT reach its question-answering plateau earlier, while the final scores on the standard benchmarks changed only modestly and in mixed directions. The authors raise benchmark saturation as a possible explanation. They also report occasional failures during question-answering [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/), including runs with an undefined numerical loss in the first batch. The study shows why an encoder comparison needs separate evidence about learning from data, processing that data cheaply, adapting to a task, and representing documents for retrieval.

## Deep dive: ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance

A controlled French pretraining study compares ModernBERT with DeBERTaV3 and RoBERTa on accuracy, data efficiency, training cost, and long-document retrieval. · about 32 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a benchmark ranking can establish

A text encoder converts a sequence of text into numerical representations. A system can use those representations to assign a label to a sentence, mark a name in a passage, identify the words that answer a question, or compare a query with documents. These uses give the encoder a different job from a system that generates a continuation. In [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/), for example, the output is a category. In retrieval, the immediate goal is to rank candidate texts by relevance. The paper treats encoders as practical components for these jobs, especially when a system has to process many inputs or respond quickly. In a [retrieval-augmented generation](https://md.research.elamur.ai/free/en/concepts/retrieval-augmented-generation/) pipeline, an encoder can support the search step that supplies material to a generator.

A benchmark score belongs to a trained system with a history. That history includes the text seen during pretraining, the task used to learn from that text, and the computational design that carried out the learning. A newer encoder might have seen text that is more helpful for a benchmark. It might have been trained on more of it. Its objective might provide more learning signals from the same passage. Its implementation might also process more passages for a fixed computational budget. When those conditions move together, a benchmark ranking can describe the released systems accurately while leaving the cause of the ranking unsettled.

The authors start from exactly that distinction. The earlier [ModernBERT](https://md.research.elamur.ai/free/en/papers/warner-2024-smarter-better-faster-longer-modern/) comparison was evidence about what its trained encoder could do. The comparison the authors wanted required a corpus that was available in full and a baseline whose training progress could be examined before the final checkpoint. CamemBERTaV2 supplied both. CamemBERTv2, trained on the same corpus, gave the study a second reference point. This made it possible to ask where ModernBERT sits relative to both the earlier BERT lineage and the DeBERTaV3 recipe on a set of common French tasks.

#### Why pretraining objectives and architectures both matter

The [Transformer and attention](https://md.research.elamur.ai/free/en/concepts/transformer/) are the common starting point. Attention lets the representation at one position draw on information from other positions. A bidirectional encoder can use context to the left and to the right. Such context is relevant when a label or answer depends on words that appear elsewhere in an input. The systems in the study inherit this general approach, but differ in how they encode position, which positions an attention layer can use, and what kind of answer the encoder must learn to produce during pretraining.

The paper traces the encoder lineage back to [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/). One of BERT’s objectives hides selected tokens and trains the encoder to recover them. The surrounding text supplies the clues and the original text supplies the answer, so the pretraining corpus requires no task-specific labels for this exercise. BERT also used next sentence prediction. In the account given by the authors, [RoBERTa](https://md.research.elamur.ai/free/en/papers/liu-2019-roberta-robustly-optimized-bert-pretraining/) dispensed with that objective and improved the recipe through more pretraining text and changes to optimization. Both designs used absolute position embeddings and conventional attention. An absolute position embedding associates a position with its place in the input sequence.

[DeBERTa](https://md.research.elamur.ai/free/en/papers/he-2020-deberta-decoding-enhanced-bert-disentangled/) changed the way attention incorporates position. Its disentangled attention keeps position and content in separate representations. This makes where a token appears and what it contains distinct sources of information in the attention calculation. [DeBERTaV3](https://md.research.elamur.ai/free/en/papers/he-2021-debertav3-improving-deberta-using-electra/) added replaced token detection. During pretraining, a generator proposes substitutions and a discriminator learns to judge whether a token is original or has been replaced. A masked-token prediction asks for the identity of a hidden item. Replaced token detection asks for a decision about whether an item in context belongs there, and supplies decisions at positions beyond those chosen for masking.

The generator and discriminator also create a training problem of their own. If their embeddings are shared, updates arising from the two jobs can pull the shared parameters in different directions. The gradient-disentangled embedding sharing used by DeBERTaV3 addresses that conflict. A gradient is the signal used to change a parameter in response to a training objective. The historical point for this comparison is that CamemBERTaV2 brings a different attention design and a different learning objective into the experiment at the same time. Both could affect how quickly useful representations emerge.

#### An encoder designed to process more text efficiently

ModernBERT keeps masked language modeling and makes a different set of design choices. It alternates layers that attend across the full input with layers that attend within a limited neighborhood. A local layer can incorporate nearby context without considering every distant position. A global layer provides a route for information to travel across the sequence. The design also uses rotary position encodings, drawn from [RoFormer](https://md.research.elamur.ai/free/en/papers/su-2021-roformer-enhanced-transformer-rotary-position/), which introduce position through rotations used in the attention computation. [Gemma 2](https://md.research.elamur.ai/free/en/papers/gemma-2024-team-gemma-2-improving-open-language/) is among the works the authors cite in connection with alternating global and local attention.

Other changes concern how much work the machine does to implement attention. The authors discuss FlashAttention, including work on [FlashAttention-2](https://md.research.elamur.ai/free/en/papers/dao-2023-flashattention-2-faster-attention-better/) and [FlashAttention-3](https://md.research.elamur.ai/free/en/papers/shah-2024-flashattention-3-fast-accurate-attention/), as part of the background on efficient attention computation. They also describe sequence packing, which groups sequences so more of the work is spent on real tokens, and unpadding, which avoids processing positions added to make inputs the same shape. ModernBERT changes its feed-forward blocks as well, including their activation and use of bias terms. These changes make its design a package of choices about representation and implementation.

The paper situates that package among other attempts to update BERT-style encoders. MosaicBERT had already pursued faster pretraining with packing, FlashAttention, and a higher masking rate. The authors describe NomicBERT as combining rotary positions and a different gated activation with a longer input limit of 2048 tokens. NeoBERT explored how depth and width should be allocated and expanded both context length and corpus size. These precedents give the main comparison its practical meaning. By the time of the study, encoder design involved choices about how to spend training compute and how far across an input to look, as well as what task to use during pretraining. A matched corpus gives those choices a common starting point.

### The method, step by step

#### Set up the comparisons before changing the corpus

The authors begin with CamemBERTaV2, their French DeBERTaV3 reference, and CamemBERTv2, their French RoBERTa reference. They use the available checkpoints from each, including intermediate states saved during training. A checkpoint is a saved set of learned parameters. It can be adapted to a supervised task and evaluated as a record of what the encoder had learned up to that point. The authors then train ModernBERT-CV2 on the corpus shared by the reference systems. This branch keeps the collection of training texts fixed while replacing the encoder and its training recipe.

The other branch keeps the ModernBERT design and changes the corpus. It produces ModernBERT-HQ, the variant trained on the larger filtered French collection. Comparing the two ModernBERT variants addresses a different question from comparing ModernBERT-CV2 with CamemBERTaV2. Here the architecture, tokenizer, and main training budget are held fixed, while several properties of the corpus change together. The authors also continue pretraining the ModernBERT variants on long-context subsets. This lets them measure the effect of the continuation stage as a whole on the same downstream evaluation and on a dedicated long-document retrieval task.

How the French encoders were trained and compared The steps in order.

#### Build one branch around the public corpus

The original CamemBERTaV2 corpus contains 275 billion tokens. Its main component is CulturaX-FR, with around 265 billion French tokens originating from several OSCAR and mC4 snapshots. The paper cites the work associated with [mT5](https://md.research.elamur.ai/free/en/papers/xue-2021-mt5-massively-multilingual-pre-trained/) for mC4. HALvesting contributes roughly 4.7 billion tokens from French research papers and theses. French Wikipedia contributes approximately 0.5 billion tokens and is upsampled. Upsampling gives a source more opportunities to appear during training. In this case the intention was to increase the presence of general knowledge from the encyclopedia within a collection dominated by web text.

This corpus is the reference across the three encoder families. Corpus size and training exposure have different meanings here. The size describes the collection from which training examples can be drawn. The training budget counts the tokens that pass through the encoder over the run, including repeated exposures. The authors describe CamemBERTaV2 as making a single epoch on the shared corpus, while ModernBERT-CV2 is described as making three epochs and processing 1T tokens. An epoch is a pass over the training collection. The importance of the distinction is that the same collection can support experiments that expose encoders to different volumes of text over time.

Both ModernBERT branches reuse the CamemBERTaV2 tokenizer. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/) turns a string into the units the encoder receives. A token may correspond to a word, part of a word, or another text unit. Keeping the tokenizer fixed across the new runs means the switch to the filtered corpus comes without a simultaneous change in how French text is segmented. It also provides a common tokenization basis for the comparison with CamemBERTaV2. The paper specifies a vocabulary of 32,768 entries for its ModernBERT configuration, including 418 unused entries.

#### Build the filtered branch with semantic and statistical judgments

For ModernBERT-HQ, the authors construct a French collection of 1T tokens using French RedPajamaV2, HALvesting, and French Wikipedia. They apply heuristic and semantic filtering and full deduplication in preparing the RedPajamaV2 data. Heuristic rules screen for properties selected in advance. Semantic filtering seeks to judge the content of a document. Deduplication removes repeated material from the collection. The resulting branch changes the source mix and the amount of unique text, along with the rules that determine which documents enter the training pool. [RedPajama](https://md.research.elamur.ai/free/en/papers/weber-2024-redpajama-open-dataset-training-large/)

The semantic stage follows the approach associated with [FineWeb-Edu](https://md.research.elamur.ai/free/en/papers/penedo-2024-fineweb-datasets-decanting-web-finest/). The authors first use Llama 3 70B to label 200K RedPajamaV2 samples as low, medium, or high quality. The prompt asks for an overall judgment supported by a short explanation. Its criteria cover accuracy, clarity, coherence, use of language, depth, and general usefulness. For instance, a judgment of clarity concerns how readily a reader can follow the document, while a judgment of depth concerns how much substance the document offers. The evaluation is a broad judgment of the text. Details of the criteria and the requested response format are given in the appendix. [Llama 3](https://md.research.elamur.ai/free/en/papers/grattafiori-2024-llama-3-herd-models/)

The labeled sample is then used to adapt XLM-V-base as a classifier. A classifier trained on this subset can assign quality labels to the remaining RedPajamaV2 text at corpus scale. The labels carry the criteria in the prompt through both stages, first through Llama 3’s judgments and then through the smaller classifier trained to reproduce them. This process defines what the authors mean by high quality in preparing the web corpus. The relationship between those judgments and downstream task scores remains an empirical question.

The selection also uses a perplexity score supplied by RedPajama. Perplexity measures how surprising the text is to a predictor. Here that predictor was trained on Wikipedia, so its perplexity supplies a different signal from the content classifier. RedPajama groups documents by perplexity into head, middle, and tail buckets. The authors select documents from the head or with a high classifier score, discarding tail documents and those assigned a low quality label. This rule combines statistical fit with a content judgment. The French Wikipedia and academic sources accompany the selected web material in the resulting corpus.

#### Pretrain the French ModernBERT encoders

The authors use the official ModernBERT codebase and follow the base-sized recipe. The encoder contains 22 layers with a hidden size of 768, meaning that a token’s representation within the encoder has 768 coordinates. It uses 12 attention heads. Heads give an attention layer multiple ways to relate positions to one another. The architecture table places global attention every three layers and specifies a local attention window of 128. With that arrangement, some layers have access to the entire sequence while the rest concentrate their attention on a bounded region. The table gives separate rotary position settings for global and local attention, with theta values of 160,000 and 10,000, respectively. Theta governs how the rotation varies with position across the representation.

The architecture uses pre-normalization, placing normalization before the operations in the block. Its configuration lists LayerNorm and disables both linear and normalization biases. The paper describes the feed-forward activation as GeGLU in its architectural discussion and lists GeLU together with the gated expansion in the configuration. The gate controls how much of a transformed signal passes onward. The intermediate size is 1,152 and the listed gated expansion is 2,304. These details specify the version of ModernBERT used in the study. The architecture comparison evaluates this configuration together with its objective and implementation.

Each ModernBERT variant receives 1 trillion tokens in the main pretraining phase with a maximum sequence length of 1,024. The objective is masked language modeling, or MLM. Selected tokens are hidden and the encoder learns to predict their original identities from context. The masking rate is 30%. Masking is dynamic, so which positions are selected can vary when text is presented again. For ModernBERT-CV2, this matters because repeated passes over the same underlying source collection can still supply different prediction exercises. The paper describes the objective in words and gives the training settings. It supplies no separate loss equation for MLM or replaced token detection.

The paper reports a batch size of 4,608 and a microbatch size of 96 for the main run. A microbatch is a smaller group used to carry out part of a larger training update. The optimizer, which applies the updates, is DecoupledAdamW. The appendix gives a pretraining learning rate of `8e-4`, weight decay of `1e-5`, and an optimizer epsilon of `1e-06`. The learning rate controls the scale of an update. Weight decay applies pressure against large parameter values, and the optimizer’s epsilon is a small constant used to stabilize the numerical calculation. These are settings of the ModernBERT run. The comparison uses the available CamemBERT runs as the references for the other recipes.

Training uses 48 NVIDIA H100 accelerators with 80GB of memory each. PyTorch’s Fully Sharded Data Parallel strategy distributes training state across the devices. The paper also reports bfloat16 mixed precision, which uses a lower-precision number format for parts of the computation. The appendix identifies the software implementation of FlashAttention used in this setup. Hardware, sharding, and attention kernels are relevant to interpreting the training costs because elapsed computation depends on how the architecture is implemented as well as which operations it calls for.

#### Compare checkpoints after bringing the learning rate down

The main training schedule is warmup, stable, decay, abbreviated WSD. During warmup, the learning rate rises from the initial part of training. During the stable period it remains at its main level. During decay, it falls, reducing the size of later updates. The appendix reports 3 billion warmup tokens for the main pretraining phase. The schedule makes it possible to save checkpoints during the stable period and then bring copies of those checkpoints through a decay stage before evaluating them.

For an intermediate ModernBERT checkpoint, the authors perform a separate cooldown over an extra 50 billion tokens, taking the learning rate to zero. The extra stage gives the checkpoint a defined training endpoint. A raw checkpoint from the stable phase represents a different point in the schedule, even if it comes from the same main run. The paper’s curve figures use the label `wsd` for checkpoints evaluated before cooldown. The distinction matters in interpreting a point on either curve. Its downstream score can reflect both how far pretraining had progressed and whether that particular state received cooldown. The paper compares those curves with the available intermediate checkpoints of the established French encoders.

#### Extend the maximum input length

The final ModernBERT variants come from another phase of training. The authors expand the maximum sequence length to 8,192 tokens and construct corresponding long-context subsets for the two branches. For the shared-corpus branch, they keep documents longer than 2,048 tokens in full. Shorter documents have a 10% chance of being retained, so the long-context collection still includes some shorter material. Selecting full documents supplies stretches of text that can occupy the expanded window and gives the encoder longer spans over which to build representations.

The authors give lengthy, high-quality sources like French Wikipedia and scholarly literature a larger share of the filtered branch. They retain only documents from the HQ collection that received the high label from the semantic filter. The continuation thus differs between the branches in how the training texts are selected. In both cases the input window is expanded. The resulting comparison covers preparation for long inputs under the chosen recipe, including the text selected for that preparation.

The initial extension runs for 150 billion tokens at the fixed rate below.

```
η = 3e-4
```

The symbol `η` denotes the learning rate. The equals sign assigns its value, and `3e-4` is the appendix’s scientific notation for the fixed rate used in this phase. A final cooldown covers 100 billion tokens and ends at zero. The main discussion calls this decay linear, while the appendix lists a `1-sqrt (50B tokens delayed)` schedule for the final phase. The schedule shape is therefore described differently in the two places. Both place the cooldown after context extension and give the final stage the same token budget.

The resulting checkpoints are designated ModernBERT-CV2-final and ModernBERT-HQ-final. They are evaluated again on the standard tasks, then compared with the earlier checkpoints and the baselines on the French test subset of a long-document retrieval benchmark. The authors release the French ModernBERT variants as ModernCamemBERT, together with intermediate checkpoints and evaluation results. This preserves the distinction between the shared-corpus branch, the filtered branch, and the checkpoints that received additional training for longer inputs.

### Experiments and results

#### What the downstream evaluations measure

The standard evaluation mixes tasks that ask the encoder to preserve different kinds of information. FQuAD 1.0 is a French extractive question-answering benchmark. An example pairs a question with a passage, and the system selects a span from the passage as the answer. The F1 score gives credit for overlap with the reference answer by balancing precision and recall over the answer text. Exact match, or EM, requires an exact answer match under the evaluation. Reporting both reveals whether a system frequently finds part of the answer and whether it can consistently identify its full boundaries.

Named entity recognition uses the 2008 French Treebank with entity annotations. The task is to mark names and identify the kind of entity they denote. The authors report F1, which balances successful identification against missed and incorrect predictions. The treebank is the source of the evaluation text, and the entity annotation supplies the targets for this use of it. [Building a Treebank for French](https://md.research.elamur.ai/free/en/papers/abeille-2000-building-treebank-french/)

The classification results come from the FLUE benchmark associated with [FlauBERT](https://md.research.elamur.ai/free/en/papers/le-2019-flaubert-unsupervised-language-model-pre/). CLS assesses classification of Amazon reviews. PAWS-X asks whether a sentence pair expresses the same meaning. XNLI asks the system to classify the inference relation between two texts. The metric for each is accuracy, the share of examples assigned the correct label. These tasks give the comparison measures of whole-text or sentence-pair decisions alongside the span selection and token-level labeling of the other benchmarks.

The embedding experiments use the French subset of a translated Semantic Textual Similarity benchmark, or STS, for training. The goal is to obtain vectors whose relationships reflect [semantic similarity](https://md.research.elamur.ai/free/en/concepts/semantic-similarity/). The authors evaluate the resulting representations on French MTEB. It covers several uses of embeddings, including retrieval, reranking, clustering, and similarity assessment. An overall MTEB average therefore measures performance across the whole suite. For the specific claim about retrieving texts, the retrieval category supplies more direct evidence than the aggregate. [MTEB](https://md.research.elamur.ai/free/en/papers/muennighoff-2022-mteb-massive-text-embedding-benchmark/)

The authors reuse the downstream splits from the CamemBERTaV2 work and tune hyper-parameters for all systems and datasets, using 5 seed variations. A seed controls random choices made during a training run. The main downstream numbers average the runs for the best set of hyper-parameters for each encoder. The reported variation across runs helps interpret small differences and strong sensitivity. The dedicated long-document experiment explicitly uses the French test subset of Multi Long Doc Retrieval, or MLDR.

#### The shared-corpus comparison on supervised tasks

On FQuAD, CamemBERTaV2 has the highest F1 and exact match of the encoders in the main comparison. ModernBERT-CV2 comes ahead of the RoBERTa-based CamemBERTv2 on both measures. The gap between the DeBERTaV3 baseline and the shared-corpus ModernBERT is visible on both scoring rules, so the ordering holds whether the evaluation rewards a partially correct span or requires an exact answer.

FQuAD 1.0 question answering by encoder, F1 CamemBERTaV2 leads on answer overlap, and ModernBERT-CV2 improves on CamemBERTv2.

**The numbers**

| System or setting | F1 |
| --- | --- |
| CamemBERTv2 | 80.39 |
| CamemBERTaV2 (this paper) | 83.04 |
| ModernBERT-CV2 | 81.34 |
| ModernBERT-HQ | 81.11 |

For FQuAD exact match, the scores are 64.29 for CamemBERTaV2, 61.47 for ModernBERT-CV2, and 61.35 for CamemBERTv2. ModernBERT-HQ scores 62.07. The filtered encoder therefore has the higher exact match of the ModernBERT pair, while the shared-corpus encoder has the higher F1. Treating the answer metric as a single number would obscure the fact that the corpus switch moves these two views of answer quality in different directions. The reported FQuAD F1 variation is ±0.19 for CamemBERTaV2 and ±0.35 for ModernBERT-CV2, over the selected runs.

On French Treebank entity recognition, CamemBERTaV2 scores 93.40 F1. ModernBERT-CV2 scores 92.03 and CamemBERTv2 scores 91.99. The shared-corpus ModernBERT lead over the RoBERTa baseline is small on this task. Their accompanying variation is different, with ±0.14 for ModernBERT-CV2 and ±0.96 for CamemBERTv2. ModernBERT-HQ scores 91.80 F1. The corpus that helps the ModernBERT variants most on FQuAD exact match gives the lower entity recognition mean in the initial comparison.

The three FLUE accuracy measures preserve the same shared-corpus ordering. In CLS review classification, CamemBERTaV2 reaches 95.63, ModernBERT-CV2 reaches 95.18, and CamemBERTv2 reaches 95.07. In PAWS-X, their respective accuracies are 93.06, 92.79, and 92.00. In XNLI, they score 84.82, 83.28, and 81.75, respectively. These tasks distinguish two conclusions that can coexist. The ModernBERT recipe improves on the RoBERTa baseline in the direct supervised comparison, and the DeBERTaV3 recipe achieves the highest scores under the same corpus control.

The filtered ModernBERT produces mixed classification results. Its XNLI accuracy rises to 83.66, while it scores 95.04 on CLS and 92.55 on PAWS-X. Those CLS and PAWS-X results are below ModernBERT-CV2’s means. The paper’s discussion includes CLS among the tasks that benefited marginally from the filtered corpus, but the main results table gives the higher CLS score to ModernBERT-CV2. The tabulated means place the favorable classification result for ModernBERT-HQ on XNLI. Combined with the opposing FQuAD directions on F1 and exact match, these values support a modest and task-dependent effect at the end of the main pretraining run.

#### What changes when the output is a text embedding

On the overall French MTEB evaluation, CamemBERTv2 leads with 51.67 ±0.57. ModernBERT-HQ records 49.93 ±0.60, and CamemBERTaV2 records 31.15 ±5.26. The paper gives inconsistent last digits for ModernBERT-CV2’s MTEB overall average. The main downstream table lists 49.44, the context-extension table lists 49.49 for the same checkpoint, and the detailed MTEB table lists 49.45. The same ±1.36 accompanies all of those entries. Each entry preserves its position between CamemBERTv2 and CamemBERTaV2, and below ModernBERT-HQ. The detailed retrieval subcategory gives a consistent direct comparison.

French MTEB retrieval category by encoder, average score CamemBERTv2 leads the retrieval category, and CamemBERTaV2 trails both ModernBERT variants.

**The numbers**

| System or setting | Average retrieval score |
| --- | --- |
| CamemBERTv2 (this paper) | 39.40 |
| CamemBERTaV2 | 6.80 |
| ModernBERT-CV2 | 32.20 |
| ModernBERT-HQ | 34.20 |

The subcategories show more than a general change of ranking. In the French MTEB reranking category, CamemBERTv2 scores 65.20 and ModernBERT-HQ scores 58.60, while CamemBERTaV2 scores 35.20. Reranking assesses the ordering of candidate results. In contrast, CamemBERTaV2’s pair classification average is 55.60, close to CamemBERTv2’s 56.60. For STS, CamemBERTaV2 records 52.00 ±20.65, while CamemBERTv2 records 75.60 ±0.55. The weak retrieval outcome is thus part of a wider profile that includes especially large variation on similarity evaluation and a much smaller difference on pair classification.

The MTEB classification category also illustrates why the output procedure matters. ModernBERT-CV2 records 62.60 there, ahead of CamemBERTv2 at 62.40 and CamemBERTaV2 at 41.00. This category belongs to an embedding evaluation after adaptation on STS. It answers a different question from the FLUE classifiers, which were adapted directly to their downstream tasks. Strong performance in supervised inference or review classification can coexist with weaker results when the system must use a shared text representation learned for similarity.

#### What longer inputs accomplish

The continuation stage moves the ordinary benchmarks in several directions. On FQuAD, ModernBERT-CV2-final reaches 81.68 F1 and 62.00 exact match. ModernBERT-HQ-final reaches 82.19 F1 and 62.66 exact match. Both improve on their earlier points on those measures, and the larger F1 gain is on the filtered branch. The final filtered variant’s NER score, however, is 91.33 F1, while the final shared-corpus variant reaches 92.17. For CLS, the context-extension table places the final filtered branch at 94.92 accuracy and the earlier filtered checkpoint at 95.04. The surrounding discussion describes a CLS gain for that branch, but the table endpoints show a decline. On PAWS-X and XNLI, the final filtered checkpoint is close to its predecessor, with 92.52 and 83.62 accuracy, respectively.

Both ModernBERT branches decline on the aggregate MTEB evaluation after the continuation. The final averages are 48.79 for ModernBERT-CV2-final and 49.29 for ModernBERT-HQ-final. On the dedicated long-document test, both improve. The distinction is relevant to what the added context buys. It is possible to obtain a stronger long-document ranking while several standard embedding tasks remain steady or favor the earlier checkpoint.

The French MLDR result is reported using NDCG@10, which stands for normalized discounted cumulative gain at the specified cutoff. It rewards placing relevant documents near the top of an ordered list and normalizes that gain against an ideal ranking for the query. The paper reports both a maximum and the highest 5-seed average. The average gives a view across runs, whereas the maximum shows the best observed result. Both measures rank ModernBERT-HQ-final first in this comparison.

French MLDR test set by encoder, mean NDCG@10 Both ModernBERT variants improve after continuation, and the filtered final variant leads the field.

**The numbers**

| System or setting | NDCG@10 |
| --- | --- |
| CamemBERTv2 | 28.37 |
| CamemBERTaV2 | 00.91 |
| ModernBERT-CV2 | 10.39 |
| ModernBERT-CV2-final | 22.59 |
| ModernBERT-HQ | 25.80 |
| ModernBERT-HQ-final (this paper) | 34.32 |

The maximum NDCG@10 is 39.07 for ModernBERT-HQ-final, compared with 31.76 for ModernBERT-HQ. ModernBERT-CV2-final records a maximum of 26.93 after an earlier maximum of 21.45. CamemBERTv2 reaches 32.59 and CamemBERTaV2 reaches 2.44. The reported variation on the mean is ±5.44 for ModernBERT-HQ-final and ±2.77 for CamemBERTv2. The two context-extended encoders share the 8192 input limit in the retrieval table, yet the final filtered branch leads while the final shared-corpus branch remains below CamemBERTv2. That difference motivates the authors’ discussion of what kinds of long text the encoders saw during training.

#### Computational cost and adaptation failures

The paper reports ModernBERT’s pretraining cost at 1300 H100 GPU-hours for 1 trillion tokens. CamemBERTv2 takes roughly 2100 GPU-hours at the reported comparable token volume. CamemBERTaV2 takes around 2700 GPU-hours for its single pass over 275B tokens. A GPU-hour is a measure of accelerator use, summed over the devices running the job. These totals establish a practical advantage for the ModernBERT implementation in the reported pretraining runs. The paper also identifies inference speed as an advantage. The quantified resource comparison here concerns pretraining.

During adaptation, the authors encounter ModernBERT runs that fail to converge on FQuAD. Their hyper-parameter search includes learning rates from 5e-5 to 5e-4 as well as different schedulers, batch sizes, and seeds. In runs examined more closely, the loss becomes NaN in the first batch. NaN means the computation produced a value that cannot be represented as an ordinary number. Its presence at the outset is consistent with a numerical failure in training. The authors suggest the FlashAttention implementation as a possible source. The stable runs in the benchmark table and the failed runs in the stability analysis describe different aspects of the same recipe, its attainable scores and its reliability during adaptation.

### What the ablations show

#### What matching the corpus removes from the comparison

The shared corpus is the largest control in the study. The introductory question was whether ModernBERT’s reported benchmark lead could be assigned to its design when the pretraining text differed. ModernBERT-CV2, CamemBERTaV2, and CamemBERTv2 put the same collection of documents behind each encoder family. The supervised task splits are reused, and each encoder is tuned for evaluation. Under those conditions, the original ordering reported for ModernBERT need not recur. The DeBERTaV3 baseline leads on all the directly supervised measures in this study, and the RoBERTa baseline leads on the overall embedding evaluation. Training corpus composition alone cannot explain either ordering within the shared-corpus group.

What varies in this comparison is a full recipe. The DeBERTaV3 run combines disentangled attention, replaced token detection, and gradient-disentangled embedding sharing. The ModernBERT run combines masked language modeling with a pattern of global and local attention, its positional scheme, and an efficient implementation. The RoBERTa run has its own established recipe. A controlled corpus comparison narrows the explanation to differences among the recipes and their training histories. It does not assign a share of the result to every component. For an individual claim about the value of disentangled attention or replaced token detection, a component-level comparison would have to vary that choice while holding the other relevant choices fixed.

The intermediate checkpoints strengthen the comparison at the recipe level. CamemBERTaV2 reaches higher scores earlier in the QA and NER trajectories. That is evidence about sample efficiency, the amount of pretraining text processed to reach a downstream result. It adds something that the final table alone could not show. Two runs might finish at a similar score after very different paths. Here the learning curves show an early lead for CamemBERTaV2, in addition to its lead at the reported endpoints. The authors regard replaced token detection and gradient-disentangled sharing as plausible contributors to the pattern.

The shape of the curves also depends on which downstream skill is measured. FQuAD scores tend to continue improving through pretraining. NER levels off relatively early for most of the encoders, while the CamemBERTaV2 NER trajectory continues to improve. The distinction makes it difficult to assign one point at which an encoder has extracted everything useful from a corpus. A checkpoint that performs nearly as well as the final state on NER may still leave room for gains on answer extraction. The authors suggest that the separate handling of content and position could help account for CamemBERTaV2’s continued progress on token labeling. The curve shows where the progress occurred. The proposed mechanism remains an interpretation of that progress.

#### What the corpus change reveals about the learning curve

The comparison between ModernBERT-CV2 and ModernBERT-HQ keeps the ModernBERT architecture and primary pretraining objective in place. On the QA trajectory, the filtered corpus reaches its plateau earlier. This is the clearest benefit of the new data in the main pretraining analysis. A training corpus can change how quickly a system reaches a useful point even when the score after a full run changes little. For a fixed training budget, the comparison concerns the finish. For a team deciding when progress has slowed enough to stop, the path matters too.

The final measurements place a limit on how broadly to read the earlier plateau. FQuAD exact match and XNLI favor the filtered variant, while the initial FQuAD F1 and NER means favor the shared-corpus variant. The MTEB average also favors the filtered variant within the ModernBERT pair, with a different outcome once both variants undergo their long-context continuation. The effects show up in some metrics and stages rather than as a general upward shift across all tasks. The authors raise diminishing returns from further pretraining and benchmark saturation as possible reasons that a substantial change to the corpus produces small differences in the standard final scores.

The corpus swap also changes what the encoders can learn about long documents. The original corpus is dominated by CulturaX-FR, while the filtered collection uses RedPajamaV2 selected with a classifier and perplexity rules. The authors suggest that the filtered collection may supply more coherent and diverse examples for representing longer text. The evidence behind this suggestion is the strong performance of the filtered branch on MLDR before and after continuation, alongside the unusually weak shared-corpus branch. The study gives no definitive explanation for that gap. Source mixture, deduplication, selection rules, and the availability of unique text travel together in the comparison.

#### What is learned from the continuation stage

The before-and-after results show that continued pretraining can improve long-document retrieval for either ModernBERT branch. They also show why a long-input claim has several layers. Raising the maximum input length allows more of a document to reach the encoder. Training at that limit exposes it to a different distribution of sequence lengths. Choosing long documents changes the material available for learning from those lengths. The cooldown changes the updates applied before evaluation. The final MLDR results capture the combined outcome of these changes.

The filtered branch’s result is particularly informative when paired with the final shared-corpus branch. Both have the expanded context window. Both improve on their preceding checkpoints. ModernBERT-HQ-final also surpasses CamemBERTv2 on MLDR, whereas ModernBERT-CV2-final stays behind it. A long-input limit, by itself, therefore gives an incomplete account of the retrieval ranking. The experiment ties the result to the way the branch was trained for long inputs. The drop in the overall MTEB averages at the same time shows that the extra stage brings a benefit concentrated on the dedicated long-document test.

The FQuAD analysis suggests a different question about local and global attention. In extractive QA, the informative match may be between a question at the beginning of the input and a small answer span farther away. A local layer exchanges information within its window. A global layer must do more of the work when the relevant positions are separated by a greater distance. The authors hypothesize that alternating the two kinds of layers can make the signal for the correct start and end positions harder to carry when it is sparse. They contrast this with entity recognition, where nearby words often supply adequate context and supervision can be spread over more token positions. This is an explanation for a task pattern, not a measured effect of removing or moving global layers. The QA gain after continuation is compatible with several changes in the run, including the longer training examples.

#### Retrieval geometry and engineering efficiency

The retrieval experiments show a pronounced weakness of CamemBERTaV2 under the tested embedding procedure. The authors propose that the pooled token representations may do a poor job of forming a single vector for the whole text. Pooling combines representations of individual positions into a representation that can be used to compare complete inputs. A representation can retain useful information at individual positions for span extraction or entity labeling while arranging whole-text vectors poorly for ranking. That distinction is consistent with CamemBERTaV2’s supervised strengths and its poor MTEB retrieval and MLDR scores.

ModernBERT’s global layers offer a way to distribute information across a longer input. The authors regard their interaction with local layers as a plausible reason the encoder can produce useful retrieval representations. CamemBERTv2’s strong embedding results under the same evaluation also matter here. They show that the ability to produce a useful representation in this setup is shared by another architecture. The paper leaves open whether a different pooling strategy or closer study of the geometry of DeBERTaV3’s embeddings would explain or remedy its weakness.

The computation results identify a separate source of practical benefit. FlashAttention and unpadding were available to the ModernBERT implementation used in the study and absent from the DeBERTa implementations compared here. The authors attribute a substantial part of the cost advantage to those engineering choices. GPU-hours reflect the system that actually ran, and that is precisely what matters when comparing the reported training jobs. At the same time, the GPU-hour totals cannot isolate the cost of the attention architecture from that of its implementation. In the discussion, the authors point to implementing FlashAttention for disentangled attention as a direction that could alter the observed tradeoff.

### Limitations

#### Limits the authors state

The authors identify fine-tuning instability as a limitation of the ModernBERT experiments. The evidence is concrete and specific to the observed runs. Some ModernBERT adaptations on FQuAD fail, sensitivity to the learning rate appears during tuning of the final checkpoint, and the inspected failures produce a nonnumeric loss in the first batch. This makes a numerical cause plausible. The authors name the FlashAttention implementation as one possibility, while leaving its role unresolved. A mean score from the selected hyper-parameters describes performance achieved in the evaluation. Reliable adaptation also depends on how often the training procedure can reach such a result.

The authors also question how well the current French benchmarks distinguish closely performing encoders. The corpus change produces an earlier FQuAD plateau and only limited changes in the final standard results. Saturation is one proposed explanation. If the remaining benchmark examples are insensitive to skills improved during pretraining, better text representations could yield little movement in the score. Diminishing returns from additional text is another explanation the authors consider. The reported experiments leave the relative contribution of these explanations open. More discriminating evaluations would be needed to establish what the current ones miss.

The conclusions are drawn from base-sized encoders. The authors explicitly leave larger variants for further evaluation. Changing scale could alter the balance of training costs, the ability to exploit more unique text, and the effectiveness of the attention and pretraining choices. The experiments also use publicly available data, with filtering intended in part to reduce harmful or biased content. The authors acknowledge that biases in those data can survive filtering and be reflected in the trained encoders. The reported downstream metrics measure task performance under the study’s setup. They provide no direct measurement of how much bias the filtering removed.

#### Limits that follow from the experimental design

The matched dataset makes the architecture comparison more interpretable, while the scope of the causal claim is still the full recipe. Pretraining objective, positional treatment, attention pattern, implementation, and the sequence of updates differ across the encoder families. The final shared-corpus runs also differ in how much text they process. Intermediate checkpoints help relate progress to exposure, but they draw on the available training histories, complete with their own settings and schedules. The experiment establishes that the CamemBERTaV2 recipe reaches higher French supervised results earlier under these conditions. The magnitude of a benefit attributable to a particular component remains unmeasured.

The evidence about efficiency also depends on what is counted. The downstream curves give a comparison in pretraining tokens, and the training section supplies accelerator-hours for the reported runs. These measures are useful for different questions. Their ordering can differ because one recipe learns more from a fixed exposure while another processes that exposure more cheaply. A deployment latency comparison would additionally depend on how inference is implemented and on input length. The paper gives its explicit cost totals for pretraining. The broader speed discussion identifies the engineering source of an advantage without supplying a comparable series of inference measurements in this study.

The filtered corpus comparison supports an effect of the whole data preparation strategy. An independent effect for the semantic classifier would require a comparison with the same source mix, deduplication, and size but different classifier filtering. Similarly, testing a pure data-volume effect would require comparable quality rules and source distributions at different volumes. In this study, the filtered corpus changes all those properties together. The earlier FQuAD plateau can be attributed to the switch between the actual corpora under the tested recipe. The screen responsible for the largest share of the change remains an open question.

The continuation stage has a similar interpretive boundary. Both final ModernBERT checkpoints receive additional updates, a larger window, a different distribution of training documents, and the final cooldown. The reported retrieval improvements establish the effect of that combined stage. They do not isolate how much of the gain came from allowing longer inputs at evaluation, learning from longer examples during training, or selecting different text. The evidence for the filtered branch is strongest for the French MLDR test subset, with embeddings adapted using the paper’s French STS procedure. Generalization to other retrieval collections, other languages, or other methods of training and pooling embeddings remains to be evaluated.

Some of the paper’s broad descriptions are best read alongside the task tables. CamemBERTaV2’s French MTEB retrieval and MLDR scores are very low, yet its MTEB pair classification is considerably stronger than those retrieval outcomes might suggest. Its weakness is demonstrated in specific uses of embeddings, while the exact cause remains unresolved. Likewise, the different directions of the FQuAD F1 and exact-match results on the initial corpus comparison matter more than a general statement of QA improvement. The discrepancies in the ModernBERT-CV2 MTEB aggregate and in the account of CLS after continuation further limit precision for those individual results. They leave the main benchmark rankings and the direction of the French MLDR comparison intact.

### What came after

Later studies cite the paper in two different settings. One continues the study of pretraining encoders for a particular language. The other compares Transformer architectures for a particular downstream classification task. The connection to Antoun and colleagues lies in the level at which they make a comparison. A language-focused pretraining study asks how a usable encoder is obtained. A task-focused study asks what happens when encoder choices meet a defined downstream problem.

The German study trains new encoders from scratch and compares ModernGBERT with encoders obtained through LLM2Vec conversion. The comparison sets a language-specific from-scratch approach alongside a route that converts existing systems into encoders. Antoun and colleagues compared ModernBERT with earlier encoder families in French and used a common corpus to make the recipe comparison more interpretable. The German work takes up the broader choice of how to obtain an encoder for a language, with training from scratch and conversion forming the alternatives named in its title. Its citation connects the two studies, while whether it adopted the French study’s matched-data control remains unspecified. [New Encoders for German Trained from Scratch](https://md.research.elamur.ai/free/en/papers/wunderle-2026-new-encoders-german-trained-scratch/)

The Seals-NLP study compares Transformer architectures for polarization detection in SemEval-2026 Task 9. Its focus is a concrete classification task. Antoun and colleagues had shown that the encoder rankings could vary with the task and the way the representation was used. A comparison centered on polarization detection carries that question into a specific application, where the criterion is performance on the shared task. The citation establishes the connection to the earlier architecture study. The later work’s title establishes its task and comparative scope, while the systems it evaluated and their results remain unspecified here. [Seals-NLP at SemEval-2026 Task 9](https://md.research.elamur.ai/free/en/papers/smith-2026-seals-nlp-semeval-2026-task/)

## Cite

Cite as Wissam Antoun, Benoît Sagot and Djamé Seddah. 2025. ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance. Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2025.ijcnlp-long.164](https://doi.org/10.18653/v1/2025.ijcnlp-long.164)

```bibtex
@inproceedings{antoun2025modernbert,
  title = {{ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance}},
  author = {Wissam Antoun, Benoît Sagot and Djamé Seddah},
  booktitle = {Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.ijcnlp-long.164},
  url = {https://doi.org/10.18653/v1/2025.ijcnlp-long.164}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
