mmBERT-CJKE-base
mmBERT-CJKE-base is a 312M-parameter multilingual encoder for Korean, Chinese, Japanese and English (CJK+E). It is jhu-clsp/mmBERT-base (ModernBERT architecture) with its Gemma 2 tokenizer replaced by the Gemma 3 tokenizer (262K vocab) and then continued pre-training on 30B tokens of CJK+E text. The tokenizer swap fixes Gemma 2's prefix-space handling, which does not match how Chinese, Japanese and Korean text is segmented, and makes Korean tokenization 27% more efficient while preserving the base model's knowledge.
| mmBERT-base (original) | mmBERT-CJKE-base | |
|---|---|---|
| Tokenizer | Gemma 2 (256K) | Gemma 3 (262K) |
| Korean tokens for the same text | 44 | 32 (−27.3%) |
| Chinese tokens for the same text | 25 | 22 (−12.0%) |
| Japanese / English | 31 / 25 | 31 / 25 (unchanged) |
| KLUE-NER F1 (Korean, boundary-sensitive) | 0.8921 | 0.9025 (+1.04 pp) |
| KLUE-TC / CLUE-TNEWS / JGLUE-MARC / XNLI | 0.817 / 0.549 / 0.956 / 0.819 | 0.811 / 0.548 / 0.956 / 0.818 (parity) |
| Parameters | 307M | 312M |
| Max positions | 8,192 | 8,192 |
Developed by Warp Space Inc. (CaveduckAI). The model is the backbone for the lightweight classification, moderation and decision models that run inside the Caveduck AI character platform.
Why swap the tokenizer?
mmBERT-base is a strong multilingual encoder, but it inherits the Gemma 2 tokenizer, which inserts a prefix space in front of tokens. Chinese and Japanese have no spaces, and Korean spacing differs from English, so token boundaries end up misaligned with word boundaries. This hurts tasks where boundaries matter (NER, POS tagging, span detection) and wastes context on Korean text. The mmBERT authors note this limitation and recommend the Gemma 3 tokenizer.
We replaced the tokenizer with FOCUS initialization (new embeddings initialized from overlapping tokens and sub-token averages) and a two-stage continued pre-training recipe (embeddings first, then the full model), following MATT and Bielik v3. The standard benchmarks staying at parity with the base model is the evidence that the swap caused no catastrophic forgetting; the gains show up in token efficiency and boundary-sensitive tasks.
Training
| Stage 1 (embedding stabilization) | Stage 2 (full adaptation) | |
|---|---|---|
| Trainable | token embeddings + MLM head (body frozen) | all parameters |
| Tokens | 2B | 30B (1 epoch) |
| LR / schedule | 1e-4, cosine | 8e-5, cosine |
- Objective: masked language modeling (MLM), sequence length 512, batch 64 sequences/step (≈1M tokens/step), bf16, FlashAttention-2.
- Hardware: 4× NVIDIA H200 (DDP), kt cloud AI Nexus. Stage 2 took about 1.9 days (~4.5 s/step).
- Loss: 3.33 → 2.06 (end of stage 1) → 1.65 (end of stage 2).
- Framework: PyTorch, 🤗 Transformers 4.57, 🤗 Datasets.
Data (30B tokens)
| Language | Tokens | Sources |
|---|---|---|
| Korean | 9.0B | FineWeb2 (kor_Hang), Wikipedia |
| Chinese (Simplified) | 7.5B | FineWeb2 (cmn_Hani), Wikipedia |
| Japanese | 7.5B | FineWeb2 (jpn_Jpan), Wikipedia |
| English | 6.0B | FineWeb-edu (score ≥ 2) |
Web and Wikipedia are mixed 85/15 for ko/zh/ja. A 5B-token pilot run (R1) with the same recipe was used to validate the pipeline before the 30B run (R2 = this model).
Evaluation
Fine-tuning protocol: 20k training samples per task, 3 epochs, batch 32, best of two learning rates (3e-5, 5e-5),
evaluated on 3k held-out samples. Same protocol for every model. Raw results are in evaluation/.
| Task | Lang | Metric | mmBERT-base | R1 (5B pilot) | mmBERT-CJKE-base (R2, 30B) |
|---|---|---|---|---|---|
| KLUE-TC | ko | macro F1 | 0.817 | 0.810 | 0.811 |
| KLUE-NER | ko | F1 | 0.8921 | – | 0.9025 |
| CLUE-TNEWS | zh | acc | 0.549 | 0.541 | 0.548 |
| JGLUE-MARC-ja | ja | acc | 0.956 | 0.959 | 0.956 |
| XNLI | multi | acc | 0.819 | 0.818 | 0.818 |
Reading the table. Sentence-level classification is at parity with the base model (differences are within seed noise, ±0.6 pp). The boundary-sensitive KLUE-NER improves by 1 pp, consistent with the tokenizer now aligning with Korean word boundaries. We also ran a 30B-token comparison with an alternative CJK tokenizer (Trillion); it regressed on every task, so Gemma 3 was kept.
Tokenizer efficiency
Measured on identical texts (tokens per text, lower is better):
| Language | Gemma 2 (mmBERT-base) | Gemma 3 (this model) | Change |
|---|---|---|---|
| Korean | 44 | 32 | −27.3% |
| Chinese | 25 | 22 | −12.0% |
| Japanese | 31 | 31 | 0% |
| English | 25 | 25 | 0% |
Fewer tokens means more Korean text fits in the same context window and faster inference on Korean inputs.
Usage
from transformers import AutoTokenizer, AutoModelForMaskedLM
import torch
repo = "CaveduckAI/mmBERT-cjke-base"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForMaskedLM.from_pretrained(repo, dtype=torch.bfloat16)
text = "서울은 대한민국의 <mask>이다."
inputs = tok(text, return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
mask_idx = (inputs.input_ids == tok.mask_token_id).nonzero(as_tuple=True)[1]
print(tok.decode(logits[0, mask_idx].argmax(-1)))
For downstream tasks use AutoModelForSequenceClassification / AutoModelForTokenClassification as with any
ModernBERT checkpoint. Install flash-attn for the fastest path; the model falls back to SDPA otherwise.
The checkpoint is stored in bfloat16; the MLM head is tied to the input embeddings.
Intended use and limitations
- Intended as a base encoder for fine-tuning (classification, NER, span detection, cross-encoder scoring, embeddings after contrastive training) on Korean, Chinese, Japanese and English text.
- Not a sentence-embedding model out of the box; it was trained with MLM only.
- Continued pre-training used sequence length 512. The architecture and the base model support 8,192 positions, but long-context behaviour was not re-validated here.
- Chinese data is Simplified only; Traditional Chinese was not targeted.
- The web corpora (FineWeb2, FineWeb-edu) may contain biased or offensive content; apply your own filtering for sensitive applications.
License
- Model weights and code: MIT, the same license as the base model
jhu-clsp/mmBERT-base. - Tokenizer: derived from google/gemma-3-4b-pt. The tokenizer files are subject to the Gemma Terms of Use. mmBERT-base itself redistributes the Gemma 2 tokenizer under the same arrangement.
Acknowledgements
This model was trained on GPU resources provided through the 2026 High-Performance Computing Support Program of the National IT Industry Promotion Agency (NIPA), operated by the Korea Association for ICT Promotion (KAIT), on kt cloud AI Nexus (4× H200). (본 모델은 정보통신산업진흥원(NIPA) 「2026년 고성능컴퓨팅 지원사업」의 지원(운영기관 한국정보통신진흥협회, kt cloud AI Nexus H200 4장)을 받아 학습되었습니다.)
Citation
@misc{mmbert-cjke-base-2026,
title = {mmBERT-CJKE-base: a Korean/Chinese/Japanese/English encoder via tokenizer swap and continued pre-training of mmBERT},
author = {Choi, Young and Warp Space Inc.},
year = {2026},
url = {https://huggingface.co/CaveduckAI/mmBERT-cjke-base}
}
Please also cite the base model:
@misc{marone2025mmbert,
title = {mmBERT: A Modern Multilingual Encoder with Annealed Language Learning},
author = {Marone, Marc and Weller, Orion and Fleshman, William and Yang, Eugene and Lawrie, Dawn and Van Durme, Benjamin},
year = {2025},
url = {https://arxiv.org/abs/2509.06888}
}
한국어 요약
mmBERT-CJKE-base는 jhu-clsp/mmBERT-base의 Gemma 2 토크나이저를 Gemma 3 토크나이저(262K vocab)로 교체하고, 한·중·일·영 30B 토큰으로 연속 사전학습한 다국어 인코더(312M)입니다. 동일 문장 기준 한국어 토큰 수가 27% 줄었고(44→32), 토큰 경계에 민감한 KLUE-NER F1이 0.8921→0.9025로 올랐으며, 문장 분류 벤치마크(KLUE-TC·CLUE·JGLUE·XNLI)는 원본과 동률을 유지해 토크나이저 교체로 인한 지식 손실이 없음을 확인했습니다. 분류·개체명 인식·스팬 검출·리랭킹 등 파인튜닝용 기반 모델로 쓰도록 만들었습니다.