ModernCamemBERT-bio is a French biomedical encoder built by continued pretraining of
ModernCamemBERT
using a
CLM detour
recipe. Instead of standard MLM continued pretraining, we temporarily switch to causal language modeling (CLM) before returning to MLM. This produces lasting representational changes in early transformer layers that improve downstream biomedical performance by +2.8pp on average across 8 French biomedical tasks.
The model uses the ModernBERT architecture with FlashAttention, rotary positional embeddings (RoPE), alternating local/global attention, and unpadding, supporting
8,192-token context
, critical for long clinical documents that exceed the 512-token limit of previous French biomedical models.
ModernCamemBERT-bio is trained in two phases, initialized from
ModernCamemBERT
:
Phase 1 (CLM detour, 10B tokens):
The bidirectional attention mask is replaced with a causal mask, and the model is trained with next-token prediction. This dense training signal (100% of positions) deeply modifies early transformer layers for domain adaptation.
Phase 2 (MLM decay, 1B tokens):
Bidirectional attention is restored, and the model is trained with masked language modeling at 15% masking. The learning rate decays from peak to 10% following a 1-sqrt schedule.
Both phases use the same data mix (11B tokens total). Training used AdamW (lr=2e-4, beta1=0.9, beta2=0.98), bf16 mixed precision, global batch size of 384 sequences (~3.1M tokens), on 4× H100 80GB GPUs with
Composer
. Total training time: ~4 hours wall-clock (16 GPU-h, 0.46 kg CO₂eq).
Why a CLM Detour?
CLM supervises every token position, producing dense gradient updates that deeply modify early transformer layers (layers 0-7). These changes persist through the MLM decay phase, even when the decay matches the CLM phase in length. We provide causal evidence through freeze interventions: freezing early layers during CLM eliminates the downstream benefit (the model matches the MLM baseline), while freezing mid layers preserves it (double dissociation). See our paper for the full mechanistic analysis.
Evaluation
French biomedical benchmark results (8 tasks, 9 seeds per model, macro-averaged F1):
Model
Ctx
FrACCO-30
FrACCO-100
CANTEMIST
DISTEMIST
MedDialog
DiaMed
EMEA
Medline
Avg
ModernCamemBERT-bio-base
8192
74.8
60.1
71.0
25.5
63.6
67.4
68.6
61.9
61.6
MLM baseline (ours)
8192
69.9
56.8
64.9
23.5
62.5
63.4
68.5
61.4
58.9
ModernCamemBERT
8192
70.1
55.3
63.3
20.2
60.6
56.4
68.0
59.7
56.7
DrBERT
512
53.0
35.6
37.9
21.4
63.6
57.0
69.6
62.8
50.1
CamemBERT-bio
512
41.9
20.1
12.8
9.6
38.6
47.7
70.8
65.2
38.3
ModernCamemBERT-bio-base outperforms the matched MLM baseline on all 8 tasks (+2.8pp, binomial p=0.004).
Intended Use
This model is designed for French biomedical and clinical NLP tasks:
Named entity recognition (diseases, chemicals, procedures)
Trained on French biomedical text; not suitable for other languages without further adaptation.
Encoder model: produces contextualized representations, does not generate text.
Clinical text may contain sensitive patterns; users are responsible for compliance with applicable regulations.
License
Apache 2.0
Citation
@misc{touchent2026causallanguagemodelingdetour,
title={A Causal Language Modeling Detour Improves Encoder Continued Pretraining},
author={Rian Touchent and Eric de la Clergerie},
year={2026},
eprint={2605.12438},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2605.12438},
}
Acknowledgments
This work was performed using HPC resources from GENCI-IDRIS (Grant 2024-AD011014393R2).
Runs of almanach ModernCamemBERT-bio-base on huggingface.co
377
Total runs
11
24-hour runs
18
3-day runs
3
7-day runs
74
30-day runs
More Information About ModernCamemBERT-bio-base huggingface.co Model
ModernCamemBERT-bio-base huggingface.co is an AI model on huggingface.co that provides ModernCamemBERT-bio-base's model effect (), which can be used instantly with this almanach ModernCamemBERT-bio-base model. huggingface.co supports a free trial of the ModernCamemBERT-bio-base model, and also provides paid use of the ModernCamemBERT-bio-base. Support call ModernCamemBERT-bio-base model through api, including Node.js, Python, http.
ModernCamemBERT-bio-base huggingface.co is an online trial and call api platform, which integrates ModernCamemBERT-bio-base's modeling effects, including api services, and provides a free online trial of ModernCamemBERT-bio-base, you can try ModernCamemBERT-bio-base online for free by clicking the link below.
almanach ModernCamemBERT-bio-base online free url in huggingface.co:
ModernCamemBERT-bio-base is an open source model from GitHub that offers a free installation service, and any user can find ModernCamemBERT-bio-base on GitHub to install. At the same time, huggingface.co provides the effect of ModernCamemBERT-bio-base install, users can directly use ModernCamemBERT-bio-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
ModernCamemBERT-bio-base install url in huggingface.co: