Fill-Mask
Transformers
Safetensors
modernbert
mmbert
encoder
masked-lm
cjk
korean
chinese
japanese
continued-pretraining
tokenizer-swap
duckbert
Instructions to use CaveduckAI/DuckBERT-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CaveduckAI/DuckBERT-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="CaveduckAI/DuckBERT-base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("CaveduckAI/DuckBERT-base") model = AutoModelForMaskedLM.from_pretrained("CaveduckAI/DuckBERT-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Rename to DuckBERT-base
Browse files
README.md
CHANGED
|
@@ -12,9 +12,9 @@ base_model: jhu-clsp/mmBERT-base
|
|
| 12 |
datasets:
|
| 13 |
- HuggingFaceFW/fineweb-2
|
| 14 |
- wikimedia/wikipedia
|
| 15 |
-
- HuggingFaceFW/fineweb-edu-score-2
|
| 16 |
- HPLT/HPLT2.0_cleaned
|
| 17 |
- mlfoundations/dclm-baseline-1.0
|
|
|
|
| 18 |
tags:
|
| 19 |
- modernbert
|
| 20 |
- mmbert
|
|
@@ -27,126 +27,117 @@ tags:
|
|
| 27 |
- multilingual
|
| 28 |
- continued-pretraining
|
| 29 |
- tokenizer-swap
|
|
|
|
| 30 |
---
|
| 31 |
|
| 32 |
-
#
|
| 33 |
|
| 34 |
-
**
|
| 35 |
-
It
|
| 36 |
-
Gemma 2 tokenizer
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
fine-tuning tasks the model is above the base model on 12 and 0.7 points higher on average; English is about
|
| 40 |
-
1 point lower (see [Evaluation](#evaluation)).
|
| 41 |
|
| 42 |
-
| | mmBERT-base (original) | **
|
| 43 |
|---|---|---|
|
| 44 |
| Tokenizer | Gemma 2 (256K) | **Gemma 3 (262K)** |
|
| 45 |
| Korean tokens for the same text | 44 | **32 (โ27.3%)** |
|
| 46 |
| Chinese tokens for the same text | 25 | **22 (โ12.0%)** |
|
| 47 |
| Japanese / English | 31 / 25 | 31 / 25 (unchanged) |
|
| 48 |
| Korean + Japanese + Chinese, 14 fine-tuning tasks (avg ร100) | 81.6 | **82.3** |
|
| 49 |
-
| English, 2 fine-tuning tasks (avg ร100) | **83.6** | 82.3 |
|
| 50 |
| KLUE-NER F1 (Korean) | 89.7 | **91.2** |
|
|
|
|
|
|
|
| 51 |
| Parameters | 307M | 312M |
|
| 52 |
| Max positions | 8,192 | 8,192 |
|
| 53 |
|
| 54 |
Developed by [Warp Space Inc.](https://caveduck.io) (CaveduckAI). The model is the backbone for the
|
| 55 |
-
lightweight classification, moderation and
|
|
|
|
| 56 |
|
| 57 |
## Why swap the tokenizer?
|
| 58 |
|
| 59 |
mmBERT-base is a strong multilingual encoder, but it inherits the Gemma 2 tokenizer, which inserts a prefix space in
|
| 60 |
front of tokens. Chinese and Japanese have no spaces, and Korean spacing differs from English, so token boundaries end
|
| 61 |
-
up misaligned with word boundaries. This hurts tasks where boundaries matter (NER,
|
| 62 |
wastes context on Korean text. The mmBERT authors note this limitation and recommend the Gemma 3 tokenizer.
|
| 63 |
|
| 64 |
-
|
| 65 |
-
sub-token averages
|
| 66 |
-
|
| 67 |
-
fine-tuning tasks, so the swap caused no forgetting in the target languages. The cost we measured is about 1 point
|
| 68 |
-
on English (see [Evaluation](#evaluation)).
|
| 69 |
|
| 70 |
## Training
|
| 71 |
|
| 72 |
| | Stage 1 (embedding stabilization) | Stage 2 (full adaptation) | Stage 3 (domain-augmented) |
|
| 73 |
|---|---|---|---|
|
| 74 |
-
| Trainable | token embeddings + MLM head
|
| 75 |
| Tokens | 2B | 30B | 100B |
|
| 76 |
-
| LR
|
|
|
|
| 77 |
|
| 78 |
-
- **Objective**: masked language modeling
|
| 79 |
-
- **Hardware**: 4ร NVIDIA H200 (DDP)
|
| 80 |
-
- **
|
| 81 |
- **Framework**: PyTorch, ๐ค Transformers, ๐ค Datasets.
|
| 82 |
|
| 83 |
### Data
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
| 88 |
-
|
|
| 89 |
-
| Korean | 9.0B | FineWeb2 (`kor_Hang`), Wikipedia |
|
| 90 |
-
| Chinese (Simplified) | 7.5B | FineWeb2 (`cmn_Hani`), Wikipedia |
|
| 91 |
-
| Japanese | 7.5B | FineWeb2 (`jpn_Jpan`), Wikipedia |
|
| 92 |
-
| English | 6.0B | FineWeb-edu (score โฅ 2) |
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
The AI Hub data was built through projects of the National Information Society Agency of Korea (NIA).
|
| 97 |
|
| 98 |
## Evaluation
|
| 99 |
|
| 100 |
-
Both models were measured
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
Raw results are in [`evaluation/`](./evaluation).
|
| 106 |
|
| 107 |
### Averages
|
| 108 |
|
| 109 |
-
| | mmBERT-base | **
|
| 110 |
|---|---|---|---|
|
| 111 |
-
| Korean (5 tasks) | 87.1 | **87.9** | +0.
|
| 112 |
-
| Japanese (4 tasks) | 87.0 | **87.
|
| 113 |
| Chinese (5 tasks) | 71.7 | **72.5** | +0.8 |
|
| 114 |
| Korean + Japanese + Chinese (14 tasks) | 81.6 | **82.3** | +0.7 |
|
| 115 |
| English (2 tasks) | **83.6** | 82.3 | -1.3 |
|
| 116 |
|
| 117 |
### Per task
|
| 118 |
|
| 119 |
-
| Task | Lang | Metric | mmBERT-base | **
|
| 120 |
|---|---|---|---|---|---|
|
| 121 |
-
| KLUE-TC (topic classification) | ko | macro F1 | 81.
|
| 122 |
| KLUE-NLI | ko | acc | 84.4 | **85.8** | +1.4 |
|
| 123 |
| KLUE-STS | ko | Pearson | 91.5 | **92.5** | +1.0 |
|
| 124 |
| KLUE-NER | ko | F1 | 89.7 | **91.2** | +1.5 |
|
| 125 |
-
| WikiAnn ko (NER) | ko | F1 | **88.5** | 87.9 | -0.
|
| 126 |
| JGLUE MARC-ja | ja | acc | 95.9 | **96.1** | +0.2 |
|
| 127 |
| JGLUE JNLI | ja | acc | 91.1 | **92.1** | +1.0 |
|
| 128 |
| JGLUE JSTS | ja | Pearson | **92.2** | 91.9 | -0.3 |
|
| 129 |
| WikiAnn ja (NER) | ja | F1 | 68.8 | **70.2** | +1.4 |
|
| 130 |
-
| CLUE TNEWS | zh | acc | 54.6 | **55.8** | +1.
|
| 131 |
| CLUE OCNLI | zh | acc | 74.3 | **74.6** | +0.3 |
|
| 132 |
| CLUE CMNLI | zh | acc | 78.5 | **79.0** | +0.5 |
|
| 133 |
-
| CLUE AFQMC | zh | acc | 74.0 | **75.0** | +
|
| 134 |
| WikiAnn zh (NER) | zh | F1 | 77.2 | **78.2** | +1.0 |
|
| 135 |
-
| XNLI en | en | acc | **84.1** | 82.
|
| 136 |
| WikiAnn en (NER) | en | F1 | **83.1** | 81.8 | -1.3 |
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
Both English tasks are about 1 point lower. The last training stage did not include languages outside
|
| 141 |
-
Korean, Chinese, Japanese and English; on XNLI with 15 languages mixed into one input the model scores
|
| 142 |
-
79.7 against 82.1 for the base model.
|
| 143 |
|
| 144 |
-
###
|
| 145 |
|
| 146 |
-
A second suite with inputs up to 8,192 tokens (
|
| 147 |
-
|
| 148 |
|
| 149 |
-
| Task | Lang | Metric | mmBERT-base | **
|
| 150 |
|---|---|---|---|---|---|
|
| 151 |
| KoBEST COPA | ko | macro F1 | 72.9 | **76.7** | +3.8 |
|
| 152 |
| KoBEST HellaSwag | ko | macro F1 | 80.0 | **80.5** | +0.5 |
|
|
@@ -160,11 +151,31 @@ option). Training sets were sub-sampled and each task was run once, so treat it
|
|
| 160 |
| C3 (multiple-choice reading) | zh | acc | 72.6 | **73.8** | +1.2 |
|
| 161 |
| CMRC 2018 | zh | F1 | 87.9 | **88.9** | +1.0 |
|
| 162 |
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
### Tokenizer efficiency
|
| 170 |
|
|
@@ -185,31 +196,31 @@ Fewer tokens means more Korean text fits in the same context window and faster i
|
|
| 185 |
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 186 |
import torch
|
| 187 |
|
| 188 |
-
repo = "CaveduckAI/
|
| 189 |
tok = AutoTokenizer.from_pretrained(repo)
|
| 190 |
model = AutoModelForMaskedLM.from_pretrained(repo)
|
| 191 |
|
| 192 |
-
text = "
|
| 193 |
inputs = tok(text, return_tensors="pt")
|
| 194 |
with torch.no_grad():
|
| 195 |
logits = model(**inputs).logits
|
| 196 |
mask_idx = (inputs.input_ids == tok.mask_token_id).nonzero(as_tuple=True)[1]
|
| 197 |
-
print(tok.decode(logits[0, mask_idx].argmax(-1)))
|
| 198 |
```
|
| 199 |
|
| 200 |
For downstream tasks use `AutoModelForSequenceClassification` / `AutoModelForTokenClassification` as with any
|
| 201 |
ModernBERT checkpoint. Install `flash-attn` for the fastest path; the model falls back to SDPA otherwise.
|
| 202 |
-
The checkpoint is stored in
|
| 203 |
-
`<bos> text <eos>` format as mmBERT-base.
|
| 204 |
|
| 205 |
## Intended use and limitations
|
| 206 |
|
| 207 |
- 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.
|
| 208 |
- Not a sentence-embedding model out of the box; it was trained with MLM only.
|
| 209 |
- Continued pre-training used sequence length 512. The architecture supports 8,192 positions and the model runs at that length.
|
| 210 |
-
- English fine-tuning accuracy is about 1 point below the base model
|
| 211 |
-
- Korean
|
| 212 |
-
-
|
|
|
|
| 213 |
- The web corpora may contain biased or offensive content; apply your own filtering for sensitive applications.
|
| 214 |
|
| 215 |
## License
|
|
@@ -225,14 +236,21 @@ of the National IT Industry Promotion Agency (NIPA), operated by the Korea Assoc
|
|
| 225 |
on kt cloud AI Nexus (4ร H200).
|
| 226 |
(๋ณธ ๋ชจ๋ธ์ ์ ๋ณดํต์ ์ฐ์
์งํฅ์(NIPA) ใ2026๋
๊ณ ์ฑ๋ฅ์ปดํจํ
์ง์์ฌ์
ใ์ ์ง์(์ด์๊ธฐ๊ด ํ๊ตญ์ ๋ณดํต์ ์งํฅํํ, kt cloud AI Nexus H200 4์ฅ)์ ๋ฐ์ ํ์ต๋์์ต๋๋ค.)
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
## Citation
|
| 229 |
|
| 230 |
```bibtex
|
| 231 |
-
@misc{
|
| 232 |
-
title = {
|
| 233 |
author = {Choi, Young and Warp Space Inc.},
|
| 234 |
year = {2026},
|
| 235 |
-
url = {https://huggingface.co/CaveduckAI/
|
| 236 |
}
|
| 237 |
```
|
| 238 |
|
|
@@ -249,9 +267,8 @@ Please also cite the base model:
|
|
| 249 |
|
| 250 |
## ํ๊ตญ์ด ์์ฝ
|
| 251 |
|
| 252 |
-
|
| 253 |
-
Gemma 3 ํ ํฌ๋์ด์ (262K vocab)๋ก ๊ต์ฒดํ๊ณ , ํยท์คยท์ผยท์
|
| 254 |
-
๋์ผ ๋ฌธ์ฅ ๊ธฐ์ค ํ๊ตญ์ด ํ ํฐ ์๊ฐ 27% ์ค์
|
| 255 |
-
|
| 256 |
-
๋ถ๋ฅยท๊ฐ์ฒด๋ช
์ธ์ยท
|
| 257 |
-
ํ์ต์๋ AI Hub ํ๊ตญ์ด ๋ง๋ญ์น(ํ๊ตญ์ง๋ฅ์ ๋ณด์ฌํ์งํฅ์ ์ฌ์
๊ฒฐ๊ณผ๋ก ๊ตฌ์ถ๋ ๋ฐ์ดํฐ)๋ฅผ ํ์ฉํ์ต๋๋ค.
|
|
|
|
| 12 |
datasets:
|
| 13 |
- HuggingFaceFW/fineweb-2
|
| 14 |
- wikimedia/wikipedia
|
|
|
|
| 15 |
- HPLT/HPLT2.0_cleaned
|
| 16 |
- mlfoundations/dclm-baseline-1.0
|
| 17 |
+
- HuggingFaceFW/fineweb-edu-score-2
|
| 18 |
tags:
|
| 19 |
- modernbert
|
| 20 |
- mmbert
|
|
|
|
| 27 |
- multilingual
|
| 28 |
- continued-pretraining
|
| 29 |
- tokenizer-swap
|
| 30 |
+
- duckbert
|
| 31 |
---
|
| 32 |
|
| 33 |
+
# DuckBERT-base
|
| 34 |
|
| 35 |
+
**DuckBERT-base** is a 312M-parameter encoder for **Korean, Chinese, Japanese and English**.
|
| 36 |
+
It starts from [jhu-clsp/mmBERT-base](https://huggingface.co/jhu-clsp/mmBERT-base) (ModernBERT architecture), replaces the
|
| 37 |
+
Gemma 2 tokenizer with the **Gemma 3 tokenizer (262K vocab)**, and continues masked-language-model pre-training for
|
| 38 |
+
**132B tokens**. Korean text takes **27% fewer tokens**, and the model is ahead of mmBERT-base on **12 of 14** Korean,
|
| 39 |
+
Japanese and Chinese fine-tuning tasks (see [Evaluation](#evaluation)).
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
| | mmBERT-base (original) | **DuckBERT-base** |
|
| 42 |
|---|---|---|
|
| 43 |
| Tokenizer | Gemma 2 (256K) | **Gemma 3 (262K)** |
|
| 44 |
| Korean tokens for the same text | 44 | **32 (โ27.3%)** |
|
| 45 |
| Chinese tokens for the same text | 25 | **22 (โ12.0%)** |
|
| 46 |
| Japanese / English | 31 / 25 | 31 / 25 (unchanged) |
|
| 47 |
| Korean + Japanese + Chinese, 14 fine-tuning tasks (avg ร100) | 81.6 | **82.3** |
|
|
|
|
| 48 |
| KLUE-NER F1 (Korean) | 89.7 | **91.2** |
|
| 49 |
+
| KoBEST COPA (Korean commonsense) | 72.9 | **76.7** |
|
| 50 |
+
| JCommonsenseQA (Japanese) | 78.8 | **82.2** |
|
| 51 |
| Parameters | 307M | 312M |
|
| 52 |
| Max positions | 8,192 | 8,192 |
|
| 53 |
|
| 54 |
Developed by [Warp Space Inc.](https://caveduck.io) (CaveduckAI). The model is the backbone for the
|
| 55 |
+
lightweight classification, moderation and sequence-labeling models that run inside the Caveduck AI character platform.
|
| 56 |
+
This repository was previously named `CaveduckAI/mmBERT-cjke-base`; the old id redirects here.
|
| 57 |
|
| 58 |
## Why swap the tokenizer?
|
| 59 |
|
| 60 |
mmBERT-base is a strong multilingual encoder, but it inherits the Gemma 2 tokenizer, which inserts a prefix space in
|
| 61 |
front of tokens. Chinese and Japanese have no spaces, and Korean spacing differs from English, so token boundaries end
|
| 62 |
+
up misaligned with word boundaries. This hurts tasks where boundaries matter (NER, span detection, segmentation) and
|
| 63 |
wastes context on Korean text. The mmBERT authors note this limitation and recommend the Gemma 3 tokenizer.
|
| 64 |
|
| 65 |
+
Swapping a tokenizer breaks the embedding table, so the new embeddings are initialized from overlapping tokens and
|
| 66 |
+
sub-token averages and the model is then pre-trained further, embeddings first and the full model afterwards, until the
|
| 67 |
+
knowledge of the original model is carried over to the new vocabulary.
|
|
|
|
|
|
|
| 68 |
|
| 69 |
## Training
|
| 70 |
|
| 71 |
| | Stage 1 (embedding stabilization) | Stage 2 (full adaptation) | Stage 3 (domain-augmented) |
|
| 72 |
|---|---|---|---|
|
| 73 |
+
| Trainable | token embeddings + MLM head | all parameters | all parameters |
|
| 74 |
| Tokens | 2B | 30B | 100B |
|
| 75 |
+
| LR | 1e-4, cosine | 8e-5, cosine | 8e-5, then decayed over the last 20B |
|
| 76 |
+
| Mask rate | 30% | 30% | 30%, then 15% over the last 20B |
|
| 77 |
|
| 78 |
+
- **Objective**: masked language modeling, sequence length 512, about 1M tokens per step, bf16 autocast, FlashAttention-2.
|
| 79 |
+
- **Hardware**: 4ร NVIDIA H200 (DDP) on kt cloud AI Nexus, about 600k tokens/s.
|
| 80 |
+
- **Held-out MLM loss** (mean over the four languages): 1.65 after stage 2, **1.22** after stage 3.
|
| 81 |
- **Framework**: PyTorch, ๐ค Transformers, ๐ค Datasets.
|
| 82 |
|
| 83 |
### Data
|
| 84 |
|
| 85 |
+
| Stage | Sources |
|
| 86 |
+
|---|---|
|
| 87 |
+
| Stage 1โ2 (32B) | FineWeb2 (`kor_Hang`, `cmn_Hani`, `jpn_Jpan`), Wikipedia (ko/zh/ja), FineWeb-edu (English) |
|
| 88 |
+
| Stage 3 (100B) | FineWeb2 and HPLT v2 (Korean, Chinese, Japanese web), DCLM-baseline (English), AI Hub Korean corpora (books, stories, classical literature) |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
The AI Hub corpora were built through projects of the National Information Society Agency of Korea (NIA).
|
| 91 |
+
(AI Hub ๋ฐ์ดํฐ๋ ํ๊ตญ์ง๋ฅ์ ๋ณด์ฌํ์งํฅ์(NIA)์ ์ฌ์
๊ฒฐ๊ณผ๋ก ๊ตฌ์ถ๋ ๋ฐ์ดํฐ๋ฅผ ํ์ฉํ์ต๋๋ค.)
|
|
|
|
| 92 |
|
| 93 |
## Evaluation
|
| 94 |
|
| 95 |
+
Both models were measured with one protocol: load the weights in fp32, fine-tune with the tokenizer files shipped in
|
| 96 |
+
each repository, 20k training samples per task, 3 epochs, batch 32, best of two learning rates (3e-5, 5e-5), inputs
|
| 97 |
+
truncated at 512 tokens, evaluated on up to 3k held-out samples. Scores are ร100 and come from a single seed, so
|
| 98 |
+
differences below about 0.5 on one task are noise. These are model-to-model comparisons under a reduced protocol and
|
| 99 |
+
are **not comparable to leaderboard numbers**. Raw results are in [`evaluation/`](./evaluation).
|
|
|
|
| 100 |
|
| 101 |
### Averages
|
| 102 |
|
| 103 |
+
| | mmBERT-base | **DuckBERT-base** | ฮ |
|
| 104 |
|---|---|---|---|
|
| 105 |
+
| Korean (5 tasks) | 87.1 | **87.9** | +0.8 |
|
| 106 |
+
| Japanese (4 tasks) | 87.0 | **87.6** | +0.6 |
|
| 107 |
| Chinese (5 tasks) | 71.7 | **72.5** | +0.8 |
|
| 108 |
| Korean + Japanese + Chinese (14 tasks) | 81.6 | **82.3** | +0.7 |
|
| 109 |
| English (2 tasks) | **83.6** | 82.3 | -1.3 |
|
| 110 |
|
| 111 |
### Per task
|
| 112 |
|
| 113 |
+
| Task | Lang | Metric | mmBERT-base | **DuckBERT-base** | ฮ |
|
| 114 |
|---|---|---|---|---|---|
|
| 115 |
+
| KLUE-TC (topic classification) | ko | macro F1 | 81.3 | **82.3** | +1.0 |
|
| 116 |
| KLUE-NLI | ko | acc | 84.4 | **85.8** | +1.4 |
|
| 117 |
| KLUE-STS | ko | Pearson | 91.5 | **92.5** | +1.0 |
|
| 118 |
| KLUE-NER | ko | F1 | 89.7 | **91.2** | +1.5 |
|
| 119 |
+
| WikiAnn ko (NER) | ko | F1 | **88.5** | 87.9 | -0.6 |
|
| 120 |
| JGLUE MARC-ja | ja | acc | 95.9 | **96.1** | +0.2 |
|
| 121 |
| JGLUE JNLI | ja | acc | 91.1 | **92.1** | +1.0 |
|
| 122 |
| JGLUE JSTS | ja | Pearson | **92.2** | 91.9 | -0.3 |
|
| 123 |
| WikiAnn ja (NER) | ja | F1 | 68.8 | **70.2** | +1.4 |
|
| 124 |
+
| CLUE TNEWS | zh | acc | 54.6 | **55.8** | +1.2 |
|
| 125 |
| CLUE OCNLI | zh | acc | 74.3 | **74.6** | +0.3 |
|
| 126 |
| CLUE CMNLI | zh | acc | 78.5 | **79.0** | +0.5 |
|
| 127 |
+
| CLUE AFQMC | zh | acc | 74.0 | **75.0** | +1.0 |
|
| 128 |
| WikiAnn zh (NER) | zh | F1 | 77.2 | **78.2** | +1.0 |
|
| 129 |
+
| XNLI en | en | acc | **84.1** | 82.9 | -1.2 |
|
| 130 |
| WikiAnn en (NER) | en | F1 | **83.1** | 81.8 | -1.3 |
|
| 131 |
|
| 132 |
+
All four KLUE tasks, all five Chinese tasks and three of four Japanese tasks are above the base model. English is about
|
| 133 |
+
1 point lower: the last training stage is weighted toward Korean, Chinese and Japanese.
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
+
### Commonsense reasoning and reading comprehension
|
| 136 |
|
| 137 |
+
A second suite with inputs up to 8,192 tokens (multiple choice scored per option, extractive QA scored over whole
|
| 138 |
+
documents). Training sets were sub-sampled and each task was run once, so treat it as indicative.
|
| 139 |
|
| 140 |
+
| Task | Lang | Metric | mmBERT-base | **DuckBERT-base** | ฮ |
|
| 141 |
|---|---|---|---|---|---|
|
| 142 |
| KoBEST COPA | ko | macro F1 | 72.9 | **76.7** | +3.8 |
|
| 143 |
| KoBEST HellaSwag | ko | macro F1 | 80.0 | **80.5** | +0.5 |
|
|
|
|
| 151 |
| C3 (multiple-choice reading) | zh | acc | 72.6 | **73.8** | +1.2 |
|
| 152 |
| CMRC 2018 | zh | F1 | 87.9 | **88.9** | +1.0 |
|
| 153 |
|
| 154 |
+
The largest gains are on commonsense reasoning (KoBEST COPA, KoBEST WiC, JCommonsenseQA), which we attribute to the
|
| 155 |
+
book and story corpora added in stage 3. Korean extractive QA is slightly below the base model: the Gemma 3 tokenizer
|
| 156 |
+
saves Korean tokens partly by merging a noun with the particle that follows it, so a span model cannot always cut the
|
| 157 |
+
answer exactly at a token boundary.
|
| 158 |
+
|
| 159 |
+
### Downstream example: sequence labeling vs. LLMs and other encoders
|
| 160 |
+
|
| 161 |
+
A sequence labeler (DuckBERT-base + Linear + CRF) that segments AI character responses into dialogue, narration and
|
| 162 |
+
speaker-prefix spans was compared on the same 120 held-out responses (30 each in Korean, English, Japanese and
|
| 163 |
+
Traditional Chinese) with 21 general-purpose LLMs (2-shot prompts) and with seven public multilingual encoders
|
| 164 |
+
fine-tuned on the same data with the same recipe.
|
| 165 |
+
|
| 166 |
+
| Model | span F1 (micro, 120 samples) | span F1 (validation set, 3,322 samples) | Max input |
|
| 167 |
+
|---|---|---|---|
|
| 168 |
+
| **DuckBERT-base** | **0.994** | **0.966** | 8,192 |
|
| 169 |
+
| mmBERT-base | 0.992 | 0.965 | 8,192 |
|
| 170 |
+
| mDeBERTa-v3 base | 0.989 | 0.959 | 512 |
|
| 171 |
+
| XLM-R large | 0.989 | 0.957 | 512 |
|
| 172 |
+
| XLM-R base | 0.986 | 0.956 | 512 |
|
| 173 |
+
| mBERT | 0.988 | 0.946 | 512 |
|
| 174 |
+
| Best LLM (DeepSeek V4 Pro, 2-shot) | 0.970 | n/a | n/a |
|
| 175 |
+
| GPT-5.5 (2-shot) | 0.966 | n/a | n/a |
|
| 176 |
+
|
| 177 |
+
Inference cost of the labeler is about USD 0.001 per 1,000 responses on a single RTX A5000, against USD 0.06 for the
|
| 178 |
+
cheapest LLM tested and USD 18.5 for GPT-5.5.
|
| 179 |
|
| 180 |
### Tokenizer efficiency
|
| 181 |
|
|
|
|
| 196 |
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
| 197 |
import torch
|
| 198 |
|
| 199 |
+
repo = "CaveduckAI/DuckBERT-base"
|
| 200 |
tok = AutoTokenizer.from_pretrained(repo)
|
| 201 |
model = AutoModelForMaskedLM.from_pretrained(repo)
|
| 202 |
|
| 203 |
+
text = "์์ธ์ ๋ํ๋ฏผ๊ตญ์ <mask>์ด๋ค."
|
| 204 |
inputs = tok(text, return_tensors="pt")
|
| 205 |
with torch.no_grad():
|
| 206 |
logits = model(**inputs).logits
|
| 207 |
mask_idx = (inputs.input_ids == tok.mask_token_id).nonzero(as_tuple=True)[1]
|
| 208 |
+
print(tok.decode(logits[0, mask_idx].argmax(-1)))
|
| 209 |
```
|
| 210 |
|
| 211 |
For downstream tasks use `AutoModelForSequenceClassification` / `AutoModelForTokenClassification` as with any
|
| 212 |
ModernBERT checkpoint. Install `flash-attn` for the fastest path; the model falls back to SDPA otherwise.
|
| 213 |
+
The checkpoint is stored in fp32; the MLM head is tied to the input embeddings.
|
|
|
|
| 214 |
|
| 215 |
## Intended use and limitations
|
| 216 |
|
| 217 |
- 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.
|
| 218 |
- Not a sentence-embedding model out of the box; it was trained with MLM only.
|
| 219 |
- Continued pre-training used sequence length 512. The architecture supports 8,192 positions and the model runs at that length.
|
| 220 |
+
- English fine-tuning accuracy is about 1 point below the base model.
|
| 221 |
+
- Languages other than Korean, Chinese, Japanese and English were not part of continued pre-training; on a mixed 15-language XNLI input the model scores 79.7 against 82.1 for mmBERT-base. Use mmBERT-base for broad multilingual coverage.
|
| 222 |
+
- Korean extractive QA is slightly below the base model because of the coarser Korean tokenization (see Evaluation).
|
| 223 |
+
- Chinese web data is Simplified; Traditional Chinese was not specifically targeted.
|
| 224 |
- The web corpora may contain biased or offensive content; apply your own filtering for sensitive applications.
|
| 225 |
|
| 226 |
## License
|
|
|
|
| 236 |
on kt cloud AI Nexus (4ร H200).
|
| 237 |
(๋ณธ ๋ชจ๋ธ์ ์ ๋ณดํต์ ์ฐ์
์งํฅ์(NIPA) ใ2026๋
๊ณ ์ฑ๋ฅ์ปดํจํ
์ง์์ฌ์
ใ์ ์ง์(์ด์๊ธฐ๊ด ํ๊ตญ์ ๋ณดํต์ ์งํฅํํ, kt cloud AI Nexus H200 4์ฅ)์ ๋ฐ์ ํ์ต๋์์ต๋๋ค.)
|
| 238 |
|
| 239 |
+
## Acknowledgements
|
| 240 |
+
|
| 241 |
+
This model was trained on GPU resources provided through the **2026 High-Performance Computing Support Program**
|
| 242 |
+
of the National IT Industry Promotion Agency (NIPA), operated by the Korea Association for ICT Promotion (KAIT),
|
| 243 |
+
on kt cloud AI Nexus (4ร H200).
|
| 244 |
+
(๋ณธ ๋ชจ๋ธ์ ์ ๋ณดํต์ ์ฐ์
์งํฅ์(NIPA) ใ2026๋
๊ณ ์ฑ๋ฅ์ปดํจํ
์ง์์ฌ์
ใ์ ์ง์(์ด์๊ธฐ๊ด ํ๊ตญ์ ๋ณดํต์ ์งํฅํํ, kt cloud AI Nexus H200 4์ฅ)์ ๋ฐ์ ํ์ต๋์์ต๋๋ค.)
|
| 245 |
+
|
| 246 |
## Citation
|
| 247 |
|
| 248 |
```bibtex
|
| 249 |
+
@misc{duckbert-base-2026,
|
| 250 |
+
title = {DuckBERT-base: a Korean/Chinese/Japanese/English encoder via tokenizer swap and continued pre-training of mmBERT},
|
| 251 |
author = {Choi, Young and Warp Space Inc.},
|
| 252 |
year = {2026},
|
| 253 |
+
url = {https://huggingface.co/CaveduckAI/DuckBERT-base}
|
| 254 |
}
|
| 255 |
```
|
| 256 |
|
|
|
|
| 267 |
|
| 268 |
## ํ๊ตญ์ด ์์ฝ
|
| 269 |
|
| 270 |
+
DuckBERT-base๋ [jhu-clsp/mmBERT-base](https://huggingface.co/jhu-clsp/mmBERT-base)์ Gemma 2 ํ ํฌ๋์ด์ ๋ฅผ
|
| 271 |
+
Gemma 3 ํ ํฌ๋์ด์ (262K vocab)๋ก ๊ต์ฒดํ๊ณ , ํยท์คยท์ผยท์ 132B ํ ํฐ์ผ๋ก ์ฐ์ ์ฌ์ ํ์ตํ ์ธ์ฝ๋(312M)์
๋๋ค.
|
| 272 |
+
๋์ผ ๋ฌธ์ฅ ๊ธฐ์ค ํ๊ตญ์ด ํ ํฐ ์๊ฐ 27% ์ค์๊ณ (44โ32), ํยท์คยท์ผ 14๊ฐ ๋ฏธ์ธ์กฐ์ ๊ณผ์ ํ๊ท ์ 81.6์์ 82.3์ผ๋ก ์ฌ๋ผ 14๊ฐ ์ค 12๊ฐ ๊ณผ์ ์์ ์๋ณธ์ ๋์์ต๋๋ค.
|
| 273 |
+
KLUE-NER F1์ 89.7์์ 91.2๋ก, KoBEST COPA๋ 72.9์์ 76.7๋ก ์ฌ๋์ต๋๋ค. ์์ด ๊ณผ์ ๋ ์ฝ 1์ ๋ฎ์ต๋๋ค(์์ธํ ์์น๋ Evaluation).
|
| 274 |
+
๋ถ๋ฅยท๊ฐ์ฒด๋ช
์ธ์ยท๊ตฌ๊ฐ ๊ฒ์ถยท๋ฆฌ๋ญํน ๋ฑ ํ์ธํ๋์ฉ ๊ธฐ๋ฐ ๋ชจ๋ธ๋ก ์ฐ๋๋ก ๋ง๋ค์์ต๋๋ค.
|
|
|
evaluation/{2026-11_mmbert-cjke-base_finetune_17tasks.json โ 2026-11_duckbert-base_finetune_17tasks.json}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"model": "CaveduckAI/
|
| 3 |
"measured": "2026-11",
|
| 4 |
"protocol": "fp32 load, 20k train samples, 3 epochs, batch 32, best of lr 3e-5/5e-5, max 512 tokens, up to 3k eval samples, single seed",
|
| 5 |
"results": [
|
|
|
|
| 1 |
{
|
| 2 |
+
"model": "CaveduckAI/DuckBERT-base",
|
| 3 |
"measured": "2026-11",
|
| 4 |
"protocol": "fp32 load, 20k train samples, 3 epochs, batch 32, best of lr 3e-5/5e-5, max 512 tokens, up to 3k eval samples, single seed",
|
| 5 |
"results": [
|