ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance
Paper · 2025 · Wissam Antoun, Benoît Sagot and Djamé Seddah
Summary
When an encoder does well on a language benchmark, the score reflects both how it was built and what it read during training. The earlier ModernBERT study reported an advantage over DeBERTaV3 on several benchmarks, but the information about its training corpus left those influences entangled. Antoun and colleagues train ModernBERT from scratch on the public French collection used by two existing encoders. The references are CamemBERTaV2, based on DeBERTaV3, and CamemBERTv2, based on RoBERTa. A separate ModernBERT run uses a larger French collection prepared with stricter filtering. That run asks whether the same design learns differently when the text changes.
On the shared corpus, CamemBERTaV2 leads every directly supervised evaluation. In FQuAD question answering, it achieves 83.04 F1, compared with 81.34 for the shared-corpus ModernBERT. On the French Treebank named entity recognition task, the respective F1 scores are 93.40 and 92.03. The intermediate checkpoints show a DeBERTaV3 advantage earlier in training as well. ModernBERT still places ahead of the RoBERTa reference on the supervised measures. The ranking changes when the encoders must represent texts as vectors for information retrieval. CamemBERTaV2 retrieves poorly under the tested adaptation procedure, and CamemBERTv2 posts the highest overall score on the French embedding suite.
The training costs give a different ranking. ModernBERT uses 1300 H100 GPU-hours to process 1 trillion tokens. CamemBERTaV2 takes around 2700 GPU-hours for one pass over 275B tokens. CamemBERTaV2 gets more out of the text it sees on the supervised tasks, while ModernBERT gets through its training text at substantially lower computational cost. The authors also emphasize ModernBERT’s faster inference and greater input capacity. They continue training both ModernBERT variants with a limit of 8,192 tokens, using long-document data and a schedule that brings the learning rate down at the end. The final filtered variant leads the French long-document retrieval test with 34.32 average NDCG@10, a score that rewards putting relevant documents near the top of the ranking.
The filtered corpus brings forward the point at which ModernBERT’s question-answering performance begins to level off. Its effects on final standard benchmark scores are small and mixed. The authors suggest that the benchmarks may have become too insensitive to distinguish some improvements. They also observe instability during question-answering fine-tuning, where some ModernBERT runs produce a nonnumeric loss on the opening batch. The comparison gives a different answer depending on whether success means learning from fewer tokens, spending fewer accelerator-hours, adapting reliably, or ranking long documents.
Deep dive: ModernBERT or DeBERTaV3? Examining Architecture and Data Influence on Transformer Encoder Models Performance
ModernBERT, DeBERTaV3 and RoBERTa learn from the same French corpus in a study of accuracy, training cost and long-document retrieval. · about 31 minutes to read
The problem and its context
Why the original ranking left a question open
A text encoder gives a downstream application numerical representations of an input. A system identifying names needs a representation for a position in a passage. A review classifier needs information about the review as a whole. A search system needs a way to compare a query against candidate documents. All three applications can start with a pretrained encoder and then adapt it to the output they require. The paper emphasizes the value of encoders in applications that must handle many requests or answer them with low delay. In retrieval-augmented generation, for example, the retrieval component can identify passages for a separate system to use when composing an answer.
The common starting point is the Transformer. Its attention operation lets the representation at one position incorporate information from other positions. A bidirectional encoder can draw on text before and after a position. For an entity label, nearby words might help establish whether a name refers to a person or a place. For a question about a passage, the relevant connection could extend from the wording of the question to a span farther into the input. Architecture determines how those positions exchange information, while training determines what the system learns to do with those connections.
The authors distinguish the performance of a released encoder from the contribution of its design. A report comparing ready-to-use encoders can establish how well each performs in that evaluation. Identifying the source of a score difference requires knowing what else changed. Training corpora can differ in sources, amount of text, repetition, and rules for admitting documents. The same benchmark can consequently favor an encoder because of its training examples, its learning objective, its architecture, or some combination of those influences. In the account given by the authors, the earlier ModernBERT comparison supplied too little information about the training data to decide among those explanations. ModernBERT
The French setting gives the authors a concrete way to revisit the comparison. A suitable DeBERTaV3 reference already exists, and both its pretraining collection and its intermediate checkpoints are public. Access to the collection makes training another encoder on the same material possible. Access to intermediate checkpoints makes it possible to compare capabilities during pretraining, when an endpoint alone would conceal differences in the pace of improvement. A RoBERTa reference trained on the same data gives the authors another point of comparison within the BERT lineage.
What the earlier encoders changed
The paper traces that lineage to BERT. During masked language modeling, the encoder sees a version of a training sequence with selected tokens hidden and learns to recover their identities. The text supplies both the clues and the intended answers, allowing pretraining to make use of passages that carry no labels for a downstream application. BERT also learned from a next-sentence prediction objective. RoBERTa removed that objective and changed the amount of training text and the way the encoder was optimized. The authors describe both as retaining conventional attention and absolute positional embeddings, which supply information about positions in the input sequence. BERT · RoBERTa
With DeBERTa, content and position are represented separately in the attention mechanism. A layer can make use of what is present at a position and of its location through distinct parts of the calculation. The paper calls this disentangled attention and presents it as a way of giving the encoder a finer treatment of context. CamemBERTaV2 inherits that design, together with the changes to pretraining introduced by the next DeBERTa variant. DeBERTa
DeBERTaV3 uses replaced token detection. A generator supplies token substitutions, and a discriminator learns to identify where the text has been altered. A masked-token predictor has to recover the original identity at the selected positions. The discriminator has a different decision to make, whether the supplied item belongs to the original sequence, with supervision also available at unchanged positions. This creates a plausible route to learning more from a given amount of text. DeBERTaV3 also uses gradient-disentangled embedding sharing. Gradients determine how training updates the parameters. The sharing scheme addresses potential conflicts between updates from the generator and discriminator when they draw on common token embeddings. DeBERTaV3
What ModernBERT was designed to make cheaper
ModernBERT continues to learn by recovering masked tokens. A large part of its redesign concerns the work required to process a sequence. Some layers can attend across the entire input. Other layers operate within a window, so positions in those layers can use a neighborhood of tokens without consulting every distant position. A later global layer lets information from different regions interact. The paper cites Gemma 2 in its account of combining these kinds of attention. ModernBERT also uses rotary position embeddings, which incorporate position through rotations in the attention calculation. Gemma 2 · RoFormer
Other improvements affect the execution of the computation. FlashAttention supplies an efficient implementation of attention. Sequence packing groups inputs to make better use of training capacity. Unpadding avoids computation at positions that exist to fill out input shapes. These details help explain why an architecture comparison can concern both the mathematical operations the encoder calls for and the way the hardware carries them out. ModernBERT also changes parts of the computation inside a layer, including its activation and the use of bias terms. FlashAttention-2 · FlashAttention-3
The paper places ModernBERT alongside other efforts to improve the BERT design. MosaicBERT had already combined faster attention and sequence packing with a higher masking rate. NomicBERT used rotary positions, a gated activation, and an input limit of 2048 tokens. NeoBERT explored the relationship between layer count and layer width while also increasing the context limit and the volume of the pretraining corpus. The examples illustrate how an encoder release can put several changes into effect at once. A shared corpus gives the authors a way to hold one consequential part of that package fixed.
The method, step by step
Use the public baseline to define the comparison
The experiment starts with the training collection for CamemBERTaV2. The authors take that corpus as it stands and use it to train a French ModernBERT, which they name ModernBERT-CV2. CamemBERTv2 supplies a RoBERTa comparison on the same collection. This part of the experiment asks what happens when several encoder recipes have the same source of pretraining examples. The baselines enter the study through their available checkpoints, which are saved states of the encoder parameters. The authors can adapt a checkpoint to a downstream task and examine the performance enabled by the training completed up to that point.
A second run, ModernBERT-HQ, uses the same base ModernBERT design with a separately assembled corpus. With both new encoders built and trained using the same main recipe, comparing them shows the effect of replacing one corpus with the other. The authors also take each branch through a further training phase for longer sequences. The pretraining study therefore yields checkpoints that can be compared across encoder families, across data collections within ModernBERT, and before and after continued training within each ModernBERT branch.
Training and comparing the French encoders
The steps in order.
Establish what stays fixed in the shared corpus
The public CamemBERTaV2 collection is reported at 275 billion tokens. CulturaX-FR accounts for most of it, with around 265 billion French tokens assembled from multiple snapshots of OSCAR and mC4. HALvesting adds approximately 4.7 billion tokens from academic and scientific documents, including research papers and theses. French Wikipedia supplies approximately 0.5 billion tokens and is sampled more frequently to increase the representation of general knowledge. The paper treats this mixture as the common training collection for the encoder comparison. mT5
A corpus count characterizes the material from which batches can be assembled. A pretraining token budget counts what travels through the training procedure, including further encounters with the same text. This distinction matters because the experiments preserve the collection while allowing different amounts of exposure to it. CamemBERTaV2 completes a single epoch, meaning one pass through the corpus. ModernBERT-CV2 processes 1T tokens, which the authors describe as three epochs. The comparison of the final checkpoints is thus a shared-source comparison, while the intermediate checkpoints let the authors examine what each run achieves at earlier stages of exposure.
Both ModernBERT variants adopt the CamemBERTaV2 tokenizer. Tokenization converts raw text into units the encoder can process. Holding it fixed across the new runs lets the authors replace the input collection while keeping the preparation of individual text sequences the same. Sharing it with CamemBERTaV2 also provides a common segmentation scheme for that comparison. The base ModernBERT configuration lists a vocabulary size of 32,768 and 418 unused tokens.
Construct the filtered corpus
The other collection contains 1T tokens. Its web component comes from the French portion of RedPajamaV2, with HALvesting and French Wikipedia also included in the collection. In preparing the RedPajamaV2 material, the authors use heuristic screens, semantic filtering, and full deduplication. Heuristic screens apply pre-defined criteria to candidate text. Semantic filtering uses judgments about the text’s content. Deduplication removes repeated material, affecting how much of the collection a training run can read without revisiting the same content. The resulting corpus differs from the reference collection in where the web text came from as well as how it was selected. RedPajama
To build the semantic filter, the authors follow the methodology associated with FineWeb-Edu. They use Llama 3 70B to label 200K samples from RedPajamaV2. The evaluator assigns a low, medium, or high quality label and gives a brief justification. Its instructions cover factual reliability, ease of understanding, coherence, language quality, informational depth, and usefulness to a general audience. A passage can therefore receive a judgment based on several properties at once. A well-organized passage and a useful passage can both satisfy parts of the prompt, while the output for corpus preparation is a single overall label. FineWeb-Edu · Llama 3
The authors use those samples to fine-tune XLM-V-base as the quality classifier. Once adapted, it can label the rest of the candidate collection. The classifier thus scales up the judgments used to prepare the labeled sample. The term high quality has a specific operational meaning in this experiment. It describes text admitted through a preparation process that uses ratings learned from the prompt and other criteria in the corpus pipeline. The downstream comparison tests how useful that collection turns out to be for the encoder.
A statistical score contributes another kind of evidence. RedPajama includes perplexity values from a predictor trained on Wikipedia. Perplexity expresses how surprising a passage is to that predictor. RedPajama groups documents into head, middle, and tail buckets on this basis. The authors admit material from the head or material given a high quality score by the classifier, while excluding tail documents and documents with a low label. Consequently, being in the favored statistical group and receiving a favorable semantic judgment are two routes considered by the selection procedure, subject to the stated exclusions. The experiment compares the output of that combined procedure with the existing CamemBERTaV2 collection.
Train the two ModernBERT encoders
The authors work from the public ModernBERT codebase and use its base configuration. Its 22 layers use a hidden dimension of 768 and 12 attention heads. The hidden size is the width of a token representation passed through the layers. Attention heads give a layer several sets of connections through which it can draw on the input. Global attention occurs every three layers, and the local attention window is 128. Global layers let distant positions interact directly, while the local layers limit how much of the sequence each position can consult at that step.
The appendix specifies different rotary settings for the two kinds of layer. It gives a rotary theta of 160,000 and a local-attention theta of 10,000. These settings govern the positional rotations used by their respective attention computations. The configuration applies LayerNorm before the main block operations and disables linear and normalization biases. The paper describes a gated activation in the architecture discussion, with GeLU listed as the activation in the appendix. The configuration reports an intermediate size of 1,152 and a GLU expansion of 2,304. Together, those details identify the version of ModernBERT being compared, including choices that apply inside the blocks as well as the pattern of attention across them.
Each new encoder trains on 1 trillion tokens in the main phase, with a maximum input length of 1,024 tokens. Both use masked language modeling with a dynamic masking rate of 30%. The encoder sees the surrounding context and predicts the identities of selected tokens. Because masking is dynamic, the selection can change when the same passage appears again. The shared-corpus run can therefore face a different recovery exercise when it encounters text it has already seen. The authors specify the objective in words and report the training settings for their runs.
The main pretraining batch size is 4,608, with a microbatch size of 96. A microbatch is the portion of the larger batch processed together at one time. The appendix lists DecoupledAdamW as the optimizer, the procedure that applies parameter updates. It reports a main learning rate of 8e-4, which sets the scale of those updates, and weight decay of 1e-5, which regulates parameter magnitude. Attention-output dropout is 0.1, while the setting for other layers is 0.0. Dropout omits part of a signal during training. These settings belong to the new ModernBERT runs. The reference encoders come with their own training histories.
For computation, the authors use 48 NVIDIA H100 GPUs with 80GB of memory per accelerator. They use PyTorch’s fully sharded data-parallel training, which distributes training state across devices, and bfloat16 mixed precision, which lets parts of the computation run using a lower-precision numeric format. The appendix also identifies the FlashAttention implementation. These details help define the system behind the paper’s cost figures. Two encoders could have different accelerator requirements because of what their architectures compute, because of how the computations are executed, or because of both.
Save checkpoints and give them a cooldown
The main ModernBERT schedule follows a warmup, a stable period, and a decay, collectively called WSD. In warmup, the learning rate rises. The appendix gives 3 billion tokens for that phase. During the stable portion, the learning rate stays at its main level. In a cooldown it falls, making updates progressively smaller. This schedule gives the authors a way to assess the encoder at different points in the run while allowing intermediate checkpoints to go through a decay before downstream evaluation.
For each intermediate ModernBERT checkpoint, the authors describe a separate cooldown that uses an extra 50 billion tokens and reduces the learning rate to zero. The checkpoint before that step is also a meaningful state. The paper labels points tested before cooldown wsd in its learning-curve figures. The distinction matters because a result after cooldown reflects both the training already embodied in the saved state and the additional updates made during its decay. The available CamemBERTaV2 and CamemBERTv2 checkpoints form the other trajectories in those comparisons.
Question answering and entity recognition are the downstream tasks used to trace progress. For each comparison, the idea is to start from a saved pretraining state and ask how well it can adapt to the task. Pretraining progress here is measured in downstream performance, rather than solely by success on the masked-token exercise. That makes the curves relevant to how soon each encoder becomes useful for the selected applications.
Continue training for longer documents
After the main run, the authors raise the input limit of both ModernBERT branches to 8,192 tokens. They prepare continuation data with longer sequences in mind. For the public-corpus branch, they retain documents longer than 2,048 tokens in full. Shorter documents remain eligible with a 10% retention probability. This gives the encoder more opportunities to use the larger window while preserving some variety in document length.
The filtered branch gets a different long-context subset. The authors increase the sampling of sources rich in long-form material, such as French Wikipedia and academic literature. Among the documents drawn from the HQ corpus, they retain those the semantic filter rates high. By the time both branches have their larger input window, each has also received a different choice of long examples. This is relevant when the two final variants use the same input limit but give different results on long-document search.
The continuation begins with 150 billion tokens at a fixed learning rate. The paper gives the rate as follows.
3 × 10⁻⁴
The value is the learning rate for that stage. The coefficient is 3, × denotes multiplication, and 10⁻⁴ is a power of ten with exponent minus four. The following cooldown uses 100 billion tokens and brings the rate to zero. The main discussion describes the decay as linear, while the appendix lists 1-sqrt (50B tokens delayed) for the final phase. The token budget and phase order agree across the descriptions, with a discrepancy in the stated shape of the final schedule.
The resulting checkpoints are ModernBERT-CV2-final and ModernBERT-HQ-final. The authors take them through the standard downstream evaluations and use them in the long-document retrieval comparison. The French ModernBERT variants are released under the collective name ModernCamemBERT, with intermediate checkpoints and evaluation results. The released checkpoints expose the distinction between the main pretraining runs and the versions that subsequently learned from longer inputs.
Experiments and results
What goes into each score
FQuAD 1.0 measures extractive question answering. The input asks a question about a passage, and the system predicts the start and end of an answer in that passage. F1 rewards overlap with the reference answer by balancing the precision and recall of the predicted text. Exact match, abbreviated EM, requires the answer to match under the benchmark’s scoring procedure. The metrics can move in different directions. A system can return more fully correct answers on some examples while losing partial credit on others.
For entity recognition, the authors use the 2008 French Treebank together with its named-entity annotations. The task is to identify and label entities in the text. Here F1 balances how many predictions are correct against how many of the annotated entities are found. Because the outputs attach to spans in a sentence, this evaluation puts the emphasis on information available at particular positions. Building a Treebank for French
The FLUE benchmarks supply three text classification comparisons. CLS uses Amazon reviews. PAWS-X assesses whether paired sentences are paraphrases. XNLI tests the inference relation between sentences. All three report accuracy, the proportion of examples that receive the correct label. These evaluations place different demands on the encoder. A review is assigned a category, a paraphrase judgment compares two formulations, and the inference task asks how the meaning of one sentence relates to another. FlauBERT
For the embedding comparison, the authors train on the French subset of a translated Semantic Textual Similarity benchmark, or STS. An embedding is a numerical representation used to compare texts, with this training directed at semantic similarity. The French Massive Text Embedding Benchmark, or MTEB, then measures how the resulting representations perform across several kinds of tasks. Its overall average pools those evaluations. The retrieval category, which assesses the usefulness of the representations for finding relevant text, also appears separately in the appendix. MTEB
The standard evaluations use the data splits from the CamemBERTaV2 study. The authors tune settings for the encoders and datasets with 5 seed variations. A seed controls the random choices made during an adaptation run. The main results are averages for the selected settings for each encoder, accompanied by variation across the runs. The MLDR evaluation explicitly uses the French test subset. Its table gives a maximum alongside the highest average over the 5 seeds.
CamemBERTaV2 leads the directly supervised evaluations
The question-answering comparison favors CamemBERTaV2 under both FQuAD scoring rules. Among encoders sharing the pretraining corpus, ModernBERT-CV2 is between the two references. The filtered ModernBERT comes close to ModernBERT-CV2 in F1. Exact match orders the two ModernBERT variants differently.
FQuAD 1.0 question answering, mean F1 by encoder
CamemBERTaV2 leads, and the shared-corpus ModernBERT places above the RoBERTa reference.
The numbers
| System or setting | F1 |
|---|---|
| CamemBERTv2 | 80.39 |
| ModernBERT-HQ | 81.11 |
| ModernBERT-CV2 | 81.34 |
| CamemBERTaV2 (this paper) | 83.04 |
The FQuAD exact-match means are 64.29 for CamemBERTaV2 and 61.35 for CamemBERTv2. ModernBERT-CV2 reaches 61.47, while ModernBERT-HQ reaches 62.07. The corpus swap therefore favors the filtered branch when the answer must match completely, even though average F1 favors the shared-corpus branch. For CamemBERTaV2, the reported variation on F1 is ±0.19. For ModernBERT-CV2, it is ±0.35. The results describe what the selected adaptations achieved across their seeds, an aspect of the evaluation distinct from how often tuning encountered failures.
The French Treebank results give CamemBERTaV2 93.40 F1, followed by ModernBERT-CV2 at 92.03 and CamemBERTv2 at 91.99. ModernBERT-HQ has a mean of 91.80. In this task the two encoders immediately below CamemBERTaV2 have close means, with reported variation of ±0.14 for ModernBERT-CV2 and ±0.96 for CamemBERTv2. The supervised ranking puts shared-corpus ModernBERT ahead of the RoBERTa reference, with a difference that is small in the context of those reported spreads.
CLS review classification follows the same shared-corpus order. CamemBERTaV2 scores 95.63 accuracy, ModernBERT-CV2 scores 95.18, and CamemBERTv2 scores 95.07. In PAWS-X the corresponding accuracies are 93.06, 92.79, and 92.00. XNLI gives CamemBERTaV2 84.82, ModernBERT-CV2 83.28, and CamemBERTv2 81.75. The ordering spans whole-text labels, sentence-pair judgments, and the position-sensitive tasks, even though the score gaps vary across them.
The filtered branch has 83.66 accuracy on XNLI, 92.55 on PAWS-X, and 95.04 on CLS. Taking the main table as the numerical comparison, the change of corpus helps XNLI within the ModernBERT pair and puts the other classification means slightly lower. The surrounding discussion groups CLS among the small improvements, although the listed CLS values favor the shared-corpus variant. Together with the split in the FQuAD outcomes, the table supports a mixed assessment of the final supervised scores from the main training phase.
The embedding results change the ranking
CamemBERTv2 has the best overall French MTEB average, at 51.67 ±0.57. ModernBERT-HQ follows at 49.93 ±0.60. The main downstream table puts ModernBERT-CV2 at 49.44 ±1.36. Its row is reported as 49.49 in the continuation comparison and 49.45 in the detailed embedding breakdown, in both cases with the same ±1.36. The discrepancy leaves the relative positions intact. CamemBERTaV2 is last on the overall average, with 31.15 ±5.26.
The retrieval category is where its weakness is particularly clear. Under the French STS adaptation, CamemBERTaV2 trails encoders that it beat on each directly supervised evaluation. CamemBERTv2 leads retrieval as well as the overall embedding average. The filtered ModernBERT has the higher retrieval score of the two ModernBERT variants at the end of the main training phase.
French MTEB retrieval category, average score by encoder
CamemBERTv2 leads the retrieval comparison, with CamemBERTaV2 well below both ModernBERT variants.
The numbers
| System or setting | Average retrieval score |
|---|---|
| CamemBERTaV2 | 6.80 |
| ModernBERT-CV2 | 32.20 |
| ModernBERT-HQ | 34.20 |
| CamemBERTv2 (this paper) | 39.40 |
Other categories help locate the problem. CamemBERTaV2 scores 35.20 in reranking, where the task is to refine the order of candidate results. ModernBERT-HQ scores 58.60 there, and CamemBERTv2 scores 65.20. In pair classification, the results are considerably closer. CamemBERTaV2 averages 55.60, compared with 56.60 for CamemBERTv2. On the STS category itself, the CamemBERTaV2 result is 52.00 ±20.65, while CamemBERTv2 records 75.60 ±0.55. The especially wide spread on CamemBERTaV2’s similarity tasks is another feature of its profile in this evaluation.
MTEB classification also has a different ranking from the directly adapted FLUE classifiers. ModernBERT-CV2 scores 62.60 for the MTEB classification category, followed closely by CamemBERTv2 at 62.40. CamemBERTaV2 scores 41.00. In FLUE, the encoder is adapted for the classification task being measured. In MTEB, the experiment evaluates representations after adaptation on STS. Performance in the two settings gives evidence about different capabilities, even when the assessment in each case involves assigning categories.
Longer-context training improves long-document rankings
The final checkpoints produce several changes on the standard evaluations. ModernBERT-CV2-final achieves 81.68 F1 and 62.00 EM on FQuAD. ModernBERT-HQ-final posts 82.19 F1 and 62.66 EM. Both branches improve on their pre-continuation scores in both metrics. The results still put the final ModernBERT variants below the FQuAD numbers for CamemBERTaV2 in the main comparison.
For French Treebank entity recognition, the final shared-corpus branch improves to 92.17 F1, while the final filtered branch declines to 91.33. PAWS-X accuracy is 92.71 for ModernBERT-CV2-final and 92.52 for ModernBERT-HQ-final. On XNLI the corresponding accuracies are 82.85 and 83.62. The final CLS values are 94.86 for the shared-corpus branch and 94.92 for the filtered branch. The prose reports a filtered-branch CLS gain after continuation, while the tabulated endpoints place its final score below the initial 95.04. The table also shows both overall MTEB means going down after continuation, to 48.79 for ModernBERT-CV2-final and 49.29 for ModernBERT-HQ-final.
The dedicated long-document test gives a different result for the embeddings. MLDR, the Multi Long Doc Retrieval benchmark, asks the encoder to help rank long documents for a query. The French test subset is evaluated using the same STS-adapted encoders as the embedding comparisons. The metric is normalized discounted cumulative gain, given as NDCG@10. It gives greater weight to relevant documents appearing high in the ranking and scales performance against an ideal ordering at the stated cutoff. The mean and maximum show performance across selected runs and the best result attained, respectively.
French MLDR test subset, average NDCG@10 by encoder
Both ModernBERT branches improve after continuation, and the final filtered branch gives the highest average.
The numbers
| System or setting | NDCG@10 |
|---|---|
| CamemBERTaV2 | 00.91 |
| ModernBERT-CV2 | 10.39 |
| ModernBERT-CV2-final | 22.59 |
| ModernBERT-HQ | 25.80 |
| CamemBERTv2 | 28.37 |
| ModernBERT-HQ-final (this paper) | 34.32 |
The maxima follow the same order as the means at the top of the comparison. ModernBERT-HQ-final reaches 39.07 and CamemBERTv2 reaches 32.59. Before continuation, the filtered branch has a maximum of 31.76. The shared-corpus branch goes from 21.45 to 26.93 after continuation. CamemBERTaV2 has a maximum of 2.44. The final filtered result comes with variation of ±5.44 around its mean, compared with ±2.77 for CamemBERTv2. ModernBERT’s continuation thus produces a clear upward shift in the reported long-document results for both branches, alongside the slight declines in the overall embedding averages.
Throughput and stability measure different costs
The ModernBERT run costs 1300 H100 GPU-hours for the main 1 trillion tokens. A GPU-hour measures accelerator use across the devices in the job. CamemBERTv2 takes approximately 2100 GPU-hours for comparable reported training volume. CamemBERTaV2 requires around 2700 GPU-hours for a single epoch over 275B tokens. These results show ModernBERT’s practical pretraining cost advantage in the implementations used. The paper identifies unpadding and FlashAttention as substantial contributors. The reported GPU-hour numbers concern pretraining, while the inference speed advantage is discussed in connection with the design and its optimizations.
Downstream adaptation has its own cost in experiments that diverge. The authors observe ModernBERT failures on FQuAD and find the final checkpoint sensitive to the learning rate. Their tuning includes rates from 5e-5 to 5e-4, together with variations in schedulers, batch sizes, and seeds. The difficulty persists through the search. On examining affected runs, the authors find NaN in the loss on the opening batch. NaN indicates a numeric calculation has produced an undefined value. In the paper’s divergence figure, the plotted lines trace the maximum score attained at a given step. The first-batch observation is what leads the authors to suspect a numerical problem, possibly involving FlashAttention.
What the ablations show
The shared corpus narrows the explanation to the recipes
The paper compares whole training recipes and stages of training. It offers no component-by-component ablation in which an attention operation, pretraining objective, or software optimization is switched in isolation. Its main control is the use of a single corpus for encoders with different architectures. Holding the collection fixed rules out differences in the identity and mixture of its documents as the reason the DeBERTaV3 reference leads the supervised comparison. The results concern the recipes that trained on that material, including how much of it each processed and how it learned from each sequence.
The CamemBERTv2 comparison sharpens the interpretation. If the study had used only the stronger of the existing French encoders, ModernBERT’s practical contribution might have appeared confined to throughput and input length. Instead, the comparison places the shared-corpus ModernBERT ahead of the RoBERTa reference on the direct downstream tasks and behind the DeBERTaV3 reference. CamemBERTv2’s lead in the embedding suite then shows why moving up the supervised ranking gives an incomplete picture of what changes when one encoder replaces another. The direction of the comparison depends on the task and on how the encoder provides the output.
Several mechanisms could contribute to CamemBERTaV2’s supervised advantage. Its pretraining objective supplies replacement judgments at more of the positions in an example, while its attention mechanism handles content and position separately. Its embedding-sharing scheme was designed to manage how the generator and discriminator learn together. The study compares these choices collectively with masked-token training and ModernBERT’s attention design. The shared-data result gives empirical support to the strength of the DeBERTaV3 recipe, while the contribution of each of its features remains open.
The learning curves distinguish early progress from final scores
The intermediate checkpoints show CamemBERTaV2 reaching stronger FQuAD and entity recognition performance earlier than ModernBERT-CV2. That is the paper’s evidence for sample efficiency. It measures how well downstream adaptation works after different amounts of pretraining exposure. The accelerator-hour comparison measures how quickly the implementations can carry out that exposure. An encoder can lead on one while trailing on the other because needing fewer tokens and processing tokens cheaply are separate properties of a training run.
The curves also show why sample efficiency is tied to the skill being assessed. For question answering, progress generally continues as training advances. On entity recognition, most encoders level off earlier. CamemBERTaV2 is an exception in the NER comparison, where the authors observe continued improvement. They suggest that separating positional and content information could support token-level decisions. The trend establishes that more training helped this particular recipe on the task at the stages shown. It leaves open the effect of giving another recipe the same positional mechanism.
ModernBERT-HQ reaches its FQuAD plateau earlier than ModernBERT-CV2. The value of the corpus change is therefore more apparent along the training trajectory than in a comparison of the final standard scores. Under this recipe, switching corpora can advance the point at which adaptation produces close to the branch’s eventual performance. An experiment concerned only with the final checkpoint would record the small mixed score movements and miss that difference in timing. The study observes the earlier plateau on FQuAD specifically, so the evidence for accelerated convergence is clearest for that task.
The earlier flattening leaves a question about what limits further movement. The encoder might gain less from additional exposure near the end of pretraining. The benchmark might also have limited ability to reveal improvements in a particular kind of language understanding. The authors raise both possibilities. Evidence that the filtered branch learns the measured skill sooner is compatible with either explanation for its eventual score. The plateau supplies a reason to investigate them, while the endpoint metrics alone offer little leverage for deciding between them.
Continuation tests more than context capacity
The before-and-after comparison shows both ModernBERT branches improving on French MLDR. Each final run gives long sequences more opportunity to reach the encoder and gives the encoder practice with such sequences during training. The training examples are selected for the continuation, and the checkpoint receives further updates and a cooldown. The experiment shows the result of completing this procedure. It leaves the share attributable to a wider window, different documents, or extra optimization unresolved.
The relationship between the two branches supports that reading. Their final context limits match, while their long-document retrieval performance differs substantially. ModernBERT-HQ already has the higher MLDR mean before continuation. Afterward it also overtakes CamemBERTv2, while ModernBERT-CV2-final remains behind that reference. The authors say the shared-corpus branch is unexpectedly weak and give no definitive account of the gap. They suggest the filtered branch may have learned from a more coherent and diverse selection of text, owing to its use of semantic and perplexity filtering as well as deduplication. The difference between the branches is consistent with such an account, but the comparison changes several properties of the training material together.
The authors also use the QA results to propose a mechanism for the effect of attention layout. For an extractive answer, a cue in the question near the start of the input may have to connect to the correct span well into the passage. Local attention layers can carry information within their windows, with global layers providing a more direct connection across distant regions. The authors hypothesize that a sparse signal identifying an answer boundary can be difficult to carry through the alternation of layer types. Entity recognition can make more use of nearby words, and annotated entities may supply supervision at more positions than the boundaries of a single answer. The proposed explanation would fit the different task trajectories. The study does not vary the placement of global layers to measure that effect directly.
Pooling and implementation are plausible parts of the explanation
The retrieval results prompt a different architectural hypothesis. Pooling combines the token representations of a passage into a vector for the whole text. The authors suggest that CamemBERTaV2’s token representations may be difficult to pool into vectors that place relevant documents near their queries. A passage can carry good information for a decision about a particular word or span while yielding a less useful whole-text vector. That is consistent with the divergence between its direct task scores and its retrieval results. The study measures the resulting rankings, with the geometry of the embeddings and the effect of alternative pooling left for further investigation.
The authors suggest that ModernBERT’s combination of local and global attention could help it produce useful text embeddings. The global layers offer direct connections across the text, while the local layers concentrate their work on nearby context. This is a proposed explanation for usable retrieval performance under the tested procedure. CamemBERTv2’s embedding results show that another attention design can also produce strong representations under that procedure. The comparison therefore gives a reason to examine how each family combines information across positions, while leaving the success of any particular pooling or attention mechanism to a more targeted experiment.
For throughput, the authors draw attention to an implementation asymmetry. ModernBERT was run with unpadding and FlashAttention, features missing from the DeBERTa implementation in their comparison. Computational efficiency is a property of the runs as executed, and the measured accelerator use makes the advantage meaningful in that setting. Isolating the cost of disentangled attention itself would require a comparison in which implementation support was more closely aligned. The paper points to FlashDeBERTa, which applies FlashAttention to disentangled attention, as a possible direction for reducing the memory and latency costs it discusses.
Limitations
Limits the authors identify
The authors explicitly identify downstream instability as a limitation. The concern arises from observed FQuAD runs, including training losses that become nonnumeric immediately. A poor learning rate can harm a run, but encountering an undefined loss in the opening batch led the authors to suspect a numerical issue in the implementation. They mention FlashAttention as a possible cause. The experiments report neither an isolation test of that component nor a measured failure rate covering all the settings. The resulting evidence supports a stability concern for ModernBERT under the tested setup, with the triggering conditions still uncertain.
The authors also identify possible benchmark saturation. Their evaluation draws on established French tasks, and the larger filtered corpus generally produces small final differences on them. Saturation would mean that the chosen tasks or scoring rules have limited ability to discriminate among encoders around these performance levels. The data comparison itself cannot establish saturation. Changes in the training collection could yield incremental improvements that these benchmarks miss, or the learning recipe could simply extract little additional task-relevant benefit near the end of the run. Both possibilities fit the mixed endpoint results.
The scope is further limited by encoder size. The experiments use base-sized variants, and the authors caution that the relative behavior may differ for larger encoders. A different scale could change how much can be learned from additional unique text, how expensive a particular attention design is, and which task reaches its plateau first. The reported experiments establish a relationship among the selected base French encoders under the training and evaluation conditions studied.
The authors also acknowledge a limit of their corpus screening. Public text can encode social biases, and judgments of document quality leave room for those biases to survive in both the training examples and the resulting encoders. The filtering aims in part to reduce harmful, biased, and low-quality material. The task results reported in the paper address language and retrieval performance. The effect of the filters on particular forms of bias would require its own evaluation.
Limits that follow from the design
The shared corpus controls its contents more closely than it controls training. The models differ in what prediction they learn to make, how their attention layers operate, and the optimization and implementation behind their checkpoints. They also differ in total token exposure. The learning curves help assess the amount of exposure needed to reach particular downstream results, but each curve still comes from a complete training recipe. The results can support a claim about the relative sample efficiency of those recipes. A claim that assigns the difference to replaced token detection alone, or to disentangled attention alone, goes beyond what the controls identify.
The filtered branch presents the corresponding problem for claims about data. The authors change the web source, the number of distinct tokens, the treatment of duplicates, and the rules for selecting text. This is a useful comparison of complete collections because corpus preparation in practice includes all those choices. It gives less precise evidence on the value of the semantic filter in isolation. Comparing that filter with another selector would require holding the other corpus properties steady. The present experiment establishes what happened when ModernBERT switched between the actual collections used, with the contribution of each difference left unmeasured.
The label assigned by the quality classifier also has a narrower meaning than a direct evaluation of correctness or educational value across the corpus. The classification stage approximates the ratings learned from the annotated sample. Its instructions take several properties into account and collapse them to an overall grade. Because the training comparison evaluates the collection assembled using that procedure, it can show how the collection affects the encoder. It does not reveal which of the rating criteria made the most difference to downstream learning.
The continuation phase changes window size, document selection, exposure, and scheduling together. Its long-document results therefore establish the benefit of the combined phase under the reported procedures. They cannot determine how much improvement would have come from increasing the input limit while holding the training text and checkpoint fixed. The paper’s two descriptions of the final cooldown also make the exact decay schedule uncertain. The main results still compare the checkpoints the authors produced, while reconstructing the final phase from the written settings requires resolving that difference.
The retrieval failure is especially well documented for CamemBERTaV2 under the French STS adaptation used here. It appears on both the French MTEB retrieval category and the French MLDR test. That scope matters. A different pooling strategy or adaptation procedure could change how token representations serve a search task. The authors raise precisely that possibility when discussing representation geometry. The pair classification score also shows that the size of CamemBERTaV2’s deficit varies within the same embedding suite. The experiments give reason to question its use for the tested form of retrieval, while leaving its behavior under other embedding methods unresolved.
The training efficiency results have a similarly concrete scope. Aggregate accelerator use describes the runs with their actual hardware and software, including the implementation advantages available to ModernBERT. The figures do not express the amount of training compute each system would need to reach exactly the same downstream score. Nor do they quantify inference latency across equivalent deployments and input lengths. Sample efficiency, training expense, and inference cost therefore rest on different evidence in the paper. The explicit cost figures are strongest as a comparison of the reported pretraining jobs.
Finally, some small score movements should be read with the table inconsistencies in mind. The initial ModernBERT-CV2 embedding average has different final digits across the main and appendix tables. In CLS, the reported means also disagree with prose that describes a gain for the filtered branch. For those comparisons the numeric endpoints give the direction shown in the tables, with the conflicting statements limiting confidence in a more precise account. The central divergence between supervised performance and retrieval, and the improvement of both ModernBERT branches on the long-document test after continuation, hold across the relevant reported comparisons.
What came after
The German encoder study takes up the question of how to obtain a capable encoder for a particular language. It trains new German encoders from scratch and compares ModernGBERT with systems converted through LLM2Vec. This puts language-specific pretraining alongside conversion as alternative ways of obtaining an encoder. The French study compares established encoder designs and training objectives around a common corpus. The German paper shifts the comparison to the route by which the encoder itself is obtained. It cites the French study, while the relationship established by its title concerns the comparison of those routes. New Encoders for German Trained from Scratch
The Seals-NLP study compares Transformer architectures for polarization detection in SemEval-2026 Task 9. Here the choice of architecture is examined within a particular downstream application. The connection to Antoun and colleagues lies in the task dependence of encoder evaluation. The French experiments assess several kinds of output and find that the ranking changes when they move from direct supervised adaptation to embedding-based retrieval. The Seals-NLP paper considers architectural choice within the defined polarization task, giving that comparison a narrower target. Its citation establishes the connection, and its title identifies the shared-task setting and comparative aim. Seals-NLP at SemEval-2026 Task 9
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.
@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}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/antoun-2025-modernbert-or-debertav3-examining-architecture/