mengsay's picture
v1: add generator_v2/train_v2_s4
13da4e1 verified
|
Raw History Blame Contribute Delete
11.1 kB
---
pretty_name: Samdei Type Pretraining Data
license: cc-by-sa-4.0
language:
- km
task_categories:
- translation
tags:
- transliteration
- romanization
- romanized-khmer
- khmer
- synthetic
size_categories:
- 10M<n<100M
multilinguality: monolingual
source_datasets:
- extended|HPLT/HPLT2.0_cleaned
- extended|HuggingFaceFW/fineweb-2
- extended|wikimedia/wikipedia
- extended # + ALT (Asian Language Treebank, NICT), downloaded from NICT, not from the Hub
annotations_creators:
- machine-generated
language_creators:
- found
- machine-generated
configs:
- config_name: generator_v2
default: true
data_files:
- split: train
path:
- generator_v2/train_v2_s3.parquet
- generator_v2/train_v2_s4.parquet
- split: validation
path: generator_v2/train_v2_s3.dev.parquet
- config_name: generator_v1
data_files:
- split: train
path:
- generator_v1/train_web_s1.parquet
- generator_v1/train_web_s2.parquet
- split: validation
path: generator_v1/train_web_s1.dev.parquet
- config_name: llm_chat_sentences
data_files:
- split: train
path: llm/train_gemma_s1.parquet
- config_name: llm_romanized
data_files:
- split: train
path: llm/train_gemrom.parquet
---
# Samdei Type Pretraining Data
These are the exact **pretraining (stage-1)** pairs of the Samdei Type romanized-Khmer → Khmer-script converters: 25.8M (romanized input, Khmer target) pairs. Every **Khmer target is real text**: 1.41M sentences from HPLT v2, FineWeb-2, Khmer Wikipedia and ALT, plus 2,483 chat sentences written by Gemma 4. The **romanized input** is made by a rule-based generator that spells each piece of a sentence as one of four typing personas would type it, and for a small part by Gemma 4.
They trained the pretrained checkpoints [`samdei/samdei-type-base-pretrained`](https://huggingface.co/samdei/samdei-type-base-pretrained) and [`samdei/samdei-type-mini-pretrained`](https://huggingface.co/samdei/samdei-type-mini-pretrained), from which Samdei Type Base and Mini were fine-tuned. The data of the later stages is in [`samdei/samdei-type-finetuning-data`](https://huggingface.co/datasets/samdei/samdei-type-finetuning-data).
**v1 (2026-11-24)** adds `generator_v2/train_v2_s4`, the second sample of the second generator version, on which Base v1 was pretrained. The rest is unchanged; the dataset of the first release is at revision [`v0.1`](https://huggingface.co/datasets/samdei/samdei-type-pretraining-data/tree/v0.1).
Paper: [technical report](https://github.com/Samdei-Labs/samdei-type/blob/main/paper/samdei-type.pdf). Inference code: [github.com/Samdei-Labs/samdei-type](https://github.com/Samdei-Labs/samdei-type). Test set: [`samdei/samdei-type-bench`](https://huggingface.co/datasets/samdei/samdei-type-bench).
## Configs and files
The data is organized by what it is, not by model. `recipes.json` gives the exact mix of each v1 model (files, repeats, steps, learning rate), read from the training arguments stored in the checkpoints; the v0.1 mixes are in `recipes.json` at revision `v0.1`.
| Config | Files (rows) | What it is | Used by |
|---|---|---|---|
| `generator_v2` (default) | `train_v2_s3` (6,501,912), `train_v2_s4` (6,499,553) | web sentences and the chat sentences, spelled twice by the second generator version (two independent samples) | Mini (`train_v2_s3`); Base v1 |
| `generator_v1` | `train_web_s1` (6,289,947), `train_web_s2` (6,288,484) | web sentences, spelled twice by the first generator version (two independent samples) | Base v0.1; the v0.1 channel model (`train_web_s1`) |
| `llm_chat_sentences` | `train_gemma_s1` (189,431) | the 2.4k LLM-written chat sentences, spelled by the first generator version, ×40 | Base v0.1; the v0.1 channel model |
| `llm_romanized` | `train_gemrom` (5,715) | Gemma 4 romanizations of 2,000 real sentences (×3 copies with random casing) | Mini and Base v1 (listed ×3 in their mixes); the v0.1 channel model |
| Model | Stage-1 mix | Pairs |
|---|---|---|
| Base v1 (18.2M) | `train_v2_s3` + `train_v2_s4` + `train_gemrom` ×3 | 13,018,610 |
| Mini (7.1M) | `train_v2_s3` + `train_gemrom` ×3 (75k steps in v1, 40k in v0.1) | 6,519,057 |
| Base v0.1 | `train_web_s1` + `train_web_s2` + `train_gemma_s1` | 12,767,862 |
| v0.1 channel model (Khmer → Latin, used in Base v0.1's reranker) | `train_web_s1` + `train_gemma_s1` + `train_gemrom` | 6,485,093 |
**Why two generator versions.** Base v0.1 was pretrained first, with the first generator version. The second version adds:
- English chat words and place names inserted on both sides;
- standalone place-name pairs (`persona` = `place`);
- sentence-final punctuation dropped from both sides together.
It came out of the errors of the first models. Mini was pretrained with it, and since v1 Base is too; all later stages use it. Both versions are here, so the pretraining of both releases can be reproduced exactly.
**Validation splits** are synthetic: held-out sentences spelled by the same generator, monitored during training. Checkpoints were selected on separate evaluation sets, which are not part of this dataset.
```
generator_v1/ train_web_s1.parquet train_web_s2.parquet train_web_s1.dev.parquet
generator_v2/ train_v2_s3.parquet train_v2_s4.parquet train_v2_s3.dev.parquet
llm/ train_gemma_s1.parquet train_gemrom.parquet
recipes.json
```
## Columns
| Column | Content |
|---|---|
| `latin` | romanized input, as the model saw it |
| `khmer` | Khmer-script target, normalized with `khnormal`; English words, digits and brand names are copied from the input |
| `persona` | `formal`, `careful`, `mixed` or `lazy` (the generator's typing personas, from standard spelling to heavy chat shortcuts and typos); `place` (gazetteer pair); `gemrom0`–`gemrom3` (Gemma 4 with one of four style prompts) |
| `source` | where the Khmer target comes from: `hplt`, `fineweb2`, `wikipedia`, `alt` (a piece of a web sentence); `gemma` (a piece of an LLM-written chat sentence); `gazetteer`; `gemrom_<x>` (a whole sentence from `<x>`, romanized by Gemma 4) |
## How to load
```python
from datasets import load_dataset
ds = load_dataset("samdei/samdei-type-pretraining-data", "generator_v2", split="train")
print(ds[0]) # {'latin': ..., 'khmer': ..., 'persona': ..., 'source': ...}
```
To rebuild a mix exactly, read `recipes.json` and concatenate its files in order, with repeats.
## How the pairs were made
1. **Khmer targets.**
- 1.41M web sentences: HPLT v2 802k (3 of 13 shards of khm_Khmr), FineWeb-2 280k, Khmer Wikipedia 306k (20231101 dump) and the Khmer side of ALT 22k.
- Each sentence is normalized with `khnormal`, split and deduplicated.
- Lines with URLs or e-mail-like strings, and lines that are mostly Latin, are dropped.
- Sentences that overlap an evaluation set are removed before any pair is made.
- 2,483 chat sentences were written by Gemma 4 12B, run locally, across 50 chat domains and 4 registers.
2. **The persona generator:**
1. It cuts each sentence into pieces of 1–12 words (mostly 5–6) with `khmercut`.
2. It pronounces each word with Google's Khmer pronunciation lexicon (62k words, CC BY 4.0); rule-based G2P covers the rest.
3. It spells the piece in a sampled persona: formal 8%, careful 32%, mixed 40%, lazy 20%. Personas differ in spelling choices (`nh / ny / gn`, final consonants, vowels) and in how often they use a hand-written chat lexicon (`knhom`, `kyom` or `nh` for ខ្ញុំ).
4. It adds noise: glued or split words, dropped vowels, k/g and t/d swaps, mistyped keys.
3. **LLM romanizations.** Gemma 4 12B romanized real sentences "the way Cambodians type on Messenger", with 4 style prompts. The Khmer side stays the original sentence.
**Test separation.**
- Every sentence of every evaluation set, including Samdei Type Bench, is removed from the corpus and banned in the generator.
- No Samdei Type Bench message equals a training target. The only shared strings are common single words.
**Reproducibility.** These files are the exact pairs the released models were trained on, so training can be repeated without regenerating them. The data generator and the training code are not public; the released code ([github.com/Samdei-Labs/samdei-type](https://github.com/Samdei-Labs/samdei-type)) is for inference only.
## Limitations
- **Synthetic inputs.** No row is real typing; romanizations follow our four personas and one LLM.
- **Pieces, not messages.** Inputs are short (median 26 characters, at most 132).
- **Web noise.** About 1.5% of HPLT lines are misordered text extracted from PDFs.
- **Personal data.** Web text may contain names, phone numbers or other personal data of the original authors. Lines with URLs or e-mail-like strings were dropped, but no other personal-data filter was run. To have a row removed, open a discussion in the [Community tab](https://huggingface.co/datasets/samdei/samdei-type-pretraining-data/discussions).
- **LLM text.** The Gemma-written chat sentences and romanizations can contain mistakes.
## License and attribution
**CC BY-SA 4.0** ([license text](https://creativecommons.org/licenses/by-sa/4.0/)). The rows contain pieces of the source sentences, so the source licenses travel with them: Khmer Wikipedia's share-alike terms set the license of the whole set, and rows from the other sources also stay under their own terms below.
| Source | Side | License |
|---|---|---|
| HPLT v2 (`HPLT/HPLT2.0_cleaned`, khm_Khmr) | Khmer | CC0 packaging; Common Crawl terms of use apply to the text |
| FineWeb-2 (`HuggingFaceFW/fineweb-2`, khm_Khmr) | Khmer | ODC-By 1.0; Common Crawl terms of use apply to the text |
| Khmer Wikipedia (`wikimedia/wikipedia`, 20231101.km) | Khmer | CC BY-SA 4.0 (share-alike) |
| Asian Language Treebank (ALT), Khmer side | Khmer | CC BY 4.0 |
| LLM-written chat sentences (ours, Gemma 4) | Khmer | CC BY 4.0 (Gemma 4: Apache-2.0) |
| Gemma 4 romanizations (ours) | Latin | Apache-2.0 model output; Khmer side as its source |
| Google Khmer pronunciation lexicon | Latin (generator) | CC BY 4.0 |
| Chat lexicon, place names, English chat words (ours) | Latin (generator) | CC0 |
Rows whose `source` is `wikipedia` or `gemrom_wikipedia` carry Wikipedia's share-alike terms. They are about 19% of `train_web_s1`, `train_web_s2`, `train_v2_s3` and `train_v2_s4`.
**Changes to the source text.** The sentences were normalized with `khnormal`, filtered and deduplicated; the generator cut them into pieces of 1–12 words. Each Khmer target is paired with a romanization in the `latin` column (see "How the pairs were made").
## Citation
```bibtex
@misc{samdei-type-2026,
title = {Samdei Type: Separating What Is Written from How It Is Spelled for Romanized Khmer Transliteration},
author = {Mengsay Loem},
year = {2026},
note = {Technical report},
url = {https://github.com/Samdei-Labs/samdei-type/blob/main/paper/samdei-type.pdf}
}
```
Contact: open a discussion in this repository's [Community tab](https://huggingface.co/datasets/samdei/samdei-type-pretraining-data/discussions).