File size: 6,750 Bytes
941602b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7c499f3
941602b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b27955f
941602b
b27955f
941602b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# Keural Tokenizer

**Keural Tokenizer** is the official tokenizer used for training the **Keural Foundation Model**, a large-scale Mixture-of-Experts (MoE) language model architecture designed for enterprise AI, long-context reasoning, and multilingual language understanding.

This repository provides the tokenizer used during the **pretraining stage of the Keural model**, including configuration files, vocabulary, and metadata required to reproduce tokenization behavior during training and inference.

---

# Overview

Large Language Models rely heavily on efficient tokenization.
The Keural tokenizer was designed with the following goals:

* Efficient token representation for large-scale training
* Balanced multilingual support
* Compatibility with scientific, web, and code corpora
* High vocabulary capacity for long-context modeling
* Robust normalization and byte fallback support

The tokenizer was trained using the **SentencePiece Unigram model** on a curated multilingual corpus.

---

# Tokenizer Specifications

| Property        | Value                 |
| --------------- | --------------------- |
| Tokenizer Type  | SentencePiece Unigram |
| Vocabulary Size | 131072 tokens         |
| Normalization   | NFKC                  |
| Byte Fallback   | Enabled               |
| Digit Splitting | Enabled               |
| Unknown Token   | `<unk>`               |
| Padding Token   | `<pad>`               |
| BOS Token       | `<bos>`               |
| EOS Token       | `<eos>`               |

The tokenizer supports multilingual text including:

* English
* Korean
* Scientific documents
* Literature
* Programming languages
* Web-scale data

---

# Training Corpus

The tokenizer was trained on a **54.77 GB multilingual corpus** consisting of multiple domains to ensure robust token coverage.

### Domain Distribution

| Domain              | Description                    |
| ------------------- | ------------------------------ |
| Web Text            | Large-scale English web corpus |
| Scientific Papers   | ArXiv and PubMed datasets      |
| Literature          | PG19 and BookCorpus            |
| Wikipedia           | Clean Korean Wikipedia         |
| Source Code         | Large-scale code repositories  |
| Korean Web Data     | Korean web text corpora        |
| Multilingual Corpus | CC100 Korean                   |

The dataset pipeline was designed to reduce noise while preserving linguistic diversity across domains.

---

# Tokenizer Files

This repository contains the following tokenizer artifacts:

```text
keural_tokenizer.model
keural_tokenizer.vocab
tokenizer_config.json
tokenizer_metadata.json
tokenizer.sha256
```

### File Description

**keural_tokenizer.model**
Binary SentencePiece tokenizer model used for tokenization.

**keural_tokenizer.vocab**
Vocabulary mapping tokens to IDs.

**tokenizer_config.json**
Tokenizer configuration used during model training.

**tokenizer_metadata.json**
Metadata including training corpus information.

**tokenizer.sha256**
Checksum file for verifying tokenizer integrity.

---

# Example Usage

### Using SentencePiece

```python
import sentencepiece as spm

sp = spm.SentencePieceProcessor()
sp.load("keural_tokenizer.model")

tokens = sp.encode("Keural is a foundation model.", out_type=int)
print(tokens)
```

### Using HuggingFace Transformers

```python
from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("mkd-ai/keural-tokenizer")

tokens = tokenizer("Keural foundation model tokenizer example")
print(tokens)
```

---

# Model Compatibility

This tokenizer is used for training the **Keural Foundation Model**, which uses the following architecture:

| Parameter                | Value                          |
| ------------------------ | ------------------------------ |
| Architecture             | Transformer Mixture-of-Experts |
| Hidden Size              | 4096                           |
| Layers                   | 32                             |
| Attention Heads          | 32                             |
| Experts per Layer        | 32                             |
| Active Experts per Token | 4                              |
| Context Length           | 4096 (scalable)                |
| Vocabulary Size          | 131072                         |

Estimated model capacity:

* Total parameters: ~120B
* Active parameters per token: ~13B

---

# Context Length Roadmap

The Keural model is designed to scale context length progressively using **YaRN positional scaling**.

| Stage   | Context Length |
| ------- | -------------- |
| Stage 1 | 4096           |
| Stage 2 | 8192           |
| Stage 3 | 32768          |
| Stage 4 | 131072         |
| Stage 5 | 262144         |
| Stage 6 | 524288         |
| Stage 7 | 1,048,576      |

This staged context expansion enables efficient training while supporting ultra-long context inference.

---

# Training Pipeline

The tokenizer was trained as part of the Keural dataset pipeline, which includes:

* Streaming dataset ingestion
* Text normalization and cleaning
* Multithreaded tokenization
* Domain-based token balancing
* Fault-tolerant dataset checkpointing
* Large-scale corpus collection

The dataset preparation pipeline is available in the Keural model repository.

---

# Roadmap

The Keural project roadmap includes the following stages.

### Stage 1 — Tokenizer Development

* Multilingual tokenizer training
* Vocabulary optimization
* Token coverage validation

### Stage 2 — Dataset Preparation

* Large-scale corpus collection
* Domain balancing
* Token budget enforcement

### Stage 3 — Foundation Model Training

* Mixture-of-Experts transformer architecture
* Long-context support
* Distributed GPU training

### Stage 4 — Instruction Tuning

* Alignment with instruction datasets
* conversational fine-tuning
* domain adaptation

### Stage 5 — Deployment

* vLLM inference support
* enterprise deployment
* retrieval-augmented reasoning

---

# Hardware Environment

Tokenizer development and dataset processing were performed on a high-performance server environment:

* CPU: 32 cores
* RAM: ~480 GB
* Storage: NVMe SSD
* GPU: 2 H200 class GPUs used during model training (not yet)

---

# License

This tokenizer is part of the **Keural Foundation Model project**.

Usage and distribution may be subject to project licensing terms.

---

# Organization

Developed by

**MKD Corp AI Research**

Republic of Korea

---

# Citation

If you use the Keural tokenizer in research, please cite the Keural project repository.

```bibtex
@misc{keural_tokenizer,
  title={Keural Tokenizer},
  author={MKD Corp AI Research, Md. Najmul Hossain},
  year={2026},
  url={https://huggingface.co/mkd-ai/keural-tokenizer}
}
```