Fill-Mask
Transformers
Safetensors
French
modernbert
biomedical
clinical
encoder
Eval Results (legacy)
Instructions to use almanach/ModernCamemBERT-bio-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use almanach/ModernCamemBERT-bio-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="almanach/ModernCamemBERT-bio-large")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("almanach/ModernCamemBERT-bio-large") model = AutoModelForMaskedLM.from_pretrained("almanach/ModernCamemBERT-bio-large") - Notebooks
- Google Colab
- Kaggle
Fixes: citation, grant, training time, eval table bolds, terminology cleanup
Browse files
README.md
CHANGED
|
@@ -188,14 +188,14 @@ outputs = model(**inputs)
|
|
| 188 |
|
| 189 |
ModernCamemBERT-bio-large is trained in two phases, initialized from [ModernCamemBERT-large](https://huggingface.co/almanach/moderncamembert-large):
|
| 190 |
|
| 191 |
-
* **Phase 1
|
| 192 |
-
* **Phase 2
|
| 193 |
|
| 194 |
-
Both phases use the same data mix (27.5B 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](https://github.com/mosaicml/composer). Total training time: ~
|
| 195 |
|
| 196 |
### Why a CLM Detour?
|
| 197 |
|
| 198 |
-
CLM supervises every token position, producing dense gradient updates that deeply modify early transformer layers. These changes persist through the MLM decay phase
|
| 199 |
|
| 200 |
## Evaluation
|
| 201 |
|
|
@@ -243,14 +243,14 @@ Apache 2.0
|
|
| 243 |
## Citation
|
| 244 |
|
| 245 |
```bibtex
|
| 246 |
-
@
|
| 247 |
title={A Causal Language Modeling Detour Improves Encoder Continued Pretraining},
|
| 248 |
author={Touchent, Rian and de la Clergerie, {\'E}ric},
|
| 249 |
-
|
| 250 |
-
|
| 251 |
}
|
| 252 |
```
|
| 253 |
|
| 254 |
## Acknowledgments
|
| 255 |
|
| 256 |
-
This work was performed using HPC resources from GENCI-IDRIS (Grant 2024-
|
|
|
|
| 188 |
|
| 189 |
ModernCamemBERT-bio-large is trained in two phases, initialized from [ModernCamemBERT-large](https://huggingface.co/almanach/moderncamembert-large):
|
| 190 |
|
| 191 |
+
* **Phase 1 (CLM detour, 25B 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.
|
| 192 |
+
* **Phase 2 (MLM decay, 2.5B 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.
|
| 193 |
|
| 194 |
+
Both phases use the same data mix (27.5B 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](https://github.com/mosaicml/composer). Total training time: ~81 hours wall-clock (324 GPU-h, 9.25 kg CO₂eq).
|
| 195 |
|
| 196 |
### Why a CLM Detour?
|
| 197 |
|
| 198 |
+
CLM supervises every token position, producing dense gradient updates that deeply modify early transformer layers. These changes persist through the MLM decay phase, even when the decay matches the CLM phase in length. The Large model retains 67.2% CKA divergence from its MLM counterpart, compared to 56.5% for Base, showing that the effect scales with model capacity. See our paper for the full mechanistic analysis.
|
| 199 |
|
| 200 |
## Evaluation
|
| 201 |
|
|
|
|
| 243 |
## Citation
|
| 244 |
|
| 245 |
```bibtex
|
| 246 |
+
@article{touchent2026clmdetour,
|
| 247 |
title={A Causal Language Modeling Detour Improves Encoder Continued Pretraining},
|
| 248 |
author={Touchent, Rian and de la Clergerie, {\'E}ric},
|
| 249 |
+
year={2026},
|
| 250 |
+
journal={arXiv preprint}
|
| 251 |
}
|
| 252 |
```
|
| 253 |
|
| 254 |
## Acknowledgments
|
| 255 |
|
| 256 |
+
This work was performed using HPC resources from GENCI-IDRIS (Grant 2024-AD011014393R2).
|