/ Модель

Характеристики

Контекст
192 токена
Параметры
3,7 млн
Лицензия
CC BY 4.0
Архитектура
t5 · dense
Библиотека
transformers
Опубликована
21 окт 2026

thai-english-bidirectional-thai-name-transliteration-t5

ПереводТекст → текст5 профессий
31скачиваний за 30 дней0лайковвеса обновлены21 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Символьная модель T5 преобразует тайские личные имена между тайским письмом и латиницей в обоих направлениях.

Это компактная символьная модель T5 для двусторонней транслитерации тайских личных имён между тайским письмом и латиницей. Модель разработана авторами исследования «Thai Proper Name Transliteration with Encoder-Decoder Models Augmented with Phonetically-Aligned Data» и обучена с нуля; в карточке указано около 7,6 млн параметров, а в метаданных — 3,7 млн. Архитектура — T5 encoder-decoder с четырьмя слоями энкодера и декодера, скрытым размером 256 и посимвольной токенизацией.

Модель предназначена для преобразования тайских имён в латинское написание и обратного подбора возможных тайских написаний по латинице. Она подходит для поиска и сопоставления сущностей, связывания записей и устранения дублей в системах с именами на разных письменностях. Обучение сочетает небольшой набор естественных вариантов написания, размеченных носителем тайского языка, и крупный отфильтрованный корпус шумных пар имён.

Модель не предназначена для общего перевода с тайского на английский, транслитерации предложений или произвольного текста. При преобразовании латиницы в тайское письмо теряются орфографические сведения, поэтому полезно рассматривать список нескольких лучших вариантов; результаты для официальных документов требуют проверки человеком. Модель доступна по лицензии CC BY 4.0.

Сценарии применения

  • романизация тайских личных имён для поиска по латинскому написанию
  • подбор тайских написаний по латинице
  • сопоставление записей об одном человеке в разных системах
  • устранение дублей тайских имён, записанных разными способами

Ограничения

Обратное преобразование с латиницы неоднозначно: несколько тайских написаний могут соответствовать одной романизации, поэтому предпочтительно проверять несколько лучших вариантов. Модель обучена на тайских личных именах, не следует RTGS и может хуже работать на общих словах, топонимах, иностранных именах и фразах.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Бенчмарки пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь рядом с другими моделями теста

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы по шкале 0–100.

Для каких профессий подходит5

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Thai-English Bi-directional Thai Name Transliteration T5

A compact character-level T5 model that transliterates Thai proper names between Thai and Latin script, in both directions, with one shared model.

Proper-name transliteration writes a name in a different script while keeping how it sounds. Thai names are hard to transliterate both ways:

  • Many-to-one: distinct Thai spellings can share one romanization. For example, "Sirikarn" can be ศิริกานต์, สิริกาญจน์, or สิรีกานต์.
  • One-to-many: one Thai name can have several accepted Latin spellings. For example, สิรีกานต์ can be "Sirikarn", "Sireekan", or "Sireekarn".

Earlier systems mostly target standardized Thai-to-Latin romanization under RTGS (Charoenporn et al., 1999; Aroonmanakun & Rivepiboon, 2004; Chiu et al., 2007). Personal names, however, often follow spellings people choose themselves rather than RTGS.

This model treats both directions as one unified task. It is trained on two datasets:

  • a small gold-standard set of natural romanizations written by a native Thai speaker;
  • a large silver-standard set of noisy, phonetically aligned name pairs, filtered by a learned trust score.

This is the final ("Small") model from the paper Thai Proper Name Transliteration with Encoder-Decoder Models Augmented with Phonetically-Aligned Data.

Model description

  • Architecture: original T5 encoder–decoder (Raffel et al., 2020) with ReLU feed-forward layers, trained from scratch (T5ForConditionalGeneration)
    • 4 encoder layers, 4 decoder layers
    • Hidden size 256, FFN size 1024
    • 4 attention heads
    • Tied input/output embeddings
    • ~7.6M parameters
  • Tokenizer & vocabulary:
    • Character-level: one token per Unicode code point. This avoids out-of-vocabulary words and needs no Thai word segmenter.
    • One shared vocabulary of 234 tokens: special tokens, the direction tokens, 64 Thai and 24 Latin base characters, and other characters that occur at least 5 times in the silver data. Rarer characters map to <unk>.
  • Special task tokens:
    • <2en>: Thai → Latin (romanization)
    • <2th>: Latin → Thai (transliteration to Thai)
  • Directionality: both directions are trained. Each Thai–Latin pair becomes one TH–EN example and one EN–TH example.

Intended use

Primary use cases

  • Thai → Latin romanization of Thai personal names, for cross-lingual information retrieval, entity linking, and data pipelines that need Latin-script names.
  • Latin → Thai recovery of Thai spellings from romanized names, for back-transliteration, record linkage, and deduplication across systems. The n-best list gives plausible Thai spellings to choose from.

What the model is not for

  • General Thai–English translation
  • Transliteration of full sentences or arbitrary text
  • High-stakes decisions without human review, for example official documents or passports

Input and output format

Very important: you must prepend a direction token to the input.

Thai → Latin (romanization)

  • Input: <2en> followed by a Thai name
  • Example input string: "<2en>อรรถพล"
  • Output (top candidate): "atthaphon" (top 3: atthaphon, atphon, attapon)

Latin → Thai

  • Input: <2th> followed by a Latin-script name, lowercased (see Lowercase input only)
  • Example input string: "<2th>attapol"
  • Output (top candidate): "อรรถพล"

The tokenizer appends <eos> automatically. Latin output is lowercase, matching the training data. Names are short, and generation is capped at 24 output tokens (characters).

Lowercase input only

The model only understands lowercase Latin letters. It was trained on lowercase romanizations, and uppercase letters (apart from a stray A and B) are not in its vocabulary. An uppercase letter becomes <unk>, so the model effectively never sees it:

Input given to the modelWhat the model actually readsTop output
Thikhumporn (not lowercased)<unk>hikhumporn, i.e. "hikhumporn"หิคุมพร ✗
thikhumporn (lowercased)thikhumpornทิฆัมพร ✓

Every uppercase letter must be lowercased before the name enters the model. The tokenizer in this repo does this for you: it includes a Lowercase normalizer, so Thikhumporn, THIKHUMPORN, and thikhumporn all give the same result. If you use the raw checkpoint, a different tokenizer, or your own preprocessing, call name.lower() first. Lowercasing has no effect on Thai characters.

Quickstart

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

model_id = "Sira-D/thai-english-bidirectional-thai-name-transliteration-t5"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id).eval()


def translit_thai_to_latin(name_thai: str) -> str:
    inputs = tokenizer("<2en>" + name_thai.strip(), return_tensors="pt")
    with torch.no_grad():
        output = model.generate(**inputs, num_beams=5, num_return_sequences=1,
                                length_penalty=0.7, max_new_tokens=24)
    return tokenizer.decode(output[0], skip_special_tokens=True)


def translit_latin_to_thai(name_latin: str) -> str:
    inputs = tokenizer("<2th>" + name_latin.strip().lower(), return_tensors="pt")
    with torch.no_grad():
        output = model.generate(**inputs, num_beams=5, num_return_sequences=1,
                                length_penalty=0.7, max_new_tokens=24)
    return tokenizer.decode(output[0], skip_special_tokens=True)


print(translit_thai_to_latin("อรรถพล"))   # atthaphon
print(translit_latin_to_thai("attapol"))  # อรรถพล
print(translit_latin_to_thai("Thikhumporn"))  # ทิฆัมพร  (lowercased to "thikhumporn" first)

Getting ranked alternatives

Many romanizations map to several valid Thai spellings, so it helps to ask for several candidates. The paper reports top-3 accuracy with beam search: 5 beams, top 3 returned, length penalty 0.7. These are also the defaults in generation_config.json.

def ranked_transliterations(name: str, direction: str = "<2th>", k: int = 3):
    text = direction + (name.strip().lower() if direction == "<2th>" else name.strip())
    inputs = tokenizer(text, return_tensors="pt")
    with torch.no_grad():
        outputs = model.generate(**inputs, num_beams=max(5, k), num_return_sequences=k,
                                 length_penalty=0.7, max_new_tokens=24)
    return tokenizer.batch_decode(outputs, skip_special_tokens=True)


print(ranked_transliterations("wongduean", "<2th>"))  # ['วงศ์เดือน', 'วงษ์เดือน', 'วงเดือน']
print(ranked_transliterations("sirikan", "<2th>"))    # ['ศิริกาญจน์', 'ศิริกานต์', 'สิริกาญจน์']

For Latin → Thai the gap between top-1 and top-3 accuracy is large (0.56 vs. 0.81). The correct spelling is usually among the candidates, but the Latin input often lacks the information needed to rank it first.

Data and quality scoring (summary)

The training data comes from two complementary corpora built from the same pool of names. Both corpora and the experiment code will be released when the paper is accepted.

Gold-standard corpus

  • 3,269 Thai names. For each name, a native Thai annotator wrote up to three Latin spellings that a person with that name would likely use. This targets natural personal preference, not strict RTGS.
  • Split 9:1 by unique Thai name:
    • train: 2,944 rows, 6,595 name–romanization pairs, 13,190 directional examples;
    • dev: 323 names for TH–EN, 747 pairs for EN–TH.

Silver-standard corpus

  • Thai–Latin name pairs collected from:
    • Thai government-announcement PDFs and social-media pages where people give their names in both scripts;
    • automatic transliteration engines: Mondonomo's universal transliteration model, PyThaiNLP ROYIN (Phatthiyaphaibun et al., 2023), TLTK 1.2.1, Google Input Tools, and Microsoft Azure Translator.
  • A random-forest classifier gives each pair a continuous trust score in [0, 1]. It has 500 trees, depth 10, and 0.85 accuracy on 3,079 hand-labelled pairs. Its features are:
    • count_th / count_latin: how often the exact Thai and Latin forms occur in the scraped records;
    • phonetic distance: PanPhon weighted feature edit distance (Mortensen et al., 2016) between the CharsiuG2P IPA forms (Zhu et al., 2022);
    • RTGS similarity: Levenshtein distance to the RTGS romanization of the Thai name.
  • After removing any pair whose Thai name appears in the gold set (to prevent dev leakage), 3,437,253 pairs remain.

Training pipeline (mixed → gold)

  1. Mixed pre-training for 10 epochs at learning rate 5e-4 on gold data plus silver pairs with trust score ≥ 0.3.
  2. Gold fine-tuning on gold data only. The learning rate and epoch count were picked from the grid {1e-4, 3e-4} × {5, 10, 15} by dev-set exact-match accuracy.

Other settings: AdamW (Loshchilov & Hutter, 2019), batch size 256, weight decay 0.01, label smoothing 0.1, gradient clipping 1.0, dropout 0.1, seed 42. Training ran on a single NVIDIA L4 GPU. The checkpoint's full training config is in training_config.json.

Evaluation

Results on the gold-standard dev split:

ModelTH–EN CERTH–EN accTH–EN acc@3EN–TH CEREN–TH accEN–TH acc@3
TLTK (RTGS)0.03660.8854––––
GPT-5 (zero-shot)–––0.17910.49260.7390
Gold-only baseline (Very Small)0.03880.82970.91020.27480.28780.5047
Very Small, mixed → gold, thr 0.30.01250.92260.98450.17510.52070.7617
This model (Small, mixed → gold, thr 0.3)0.01210.93500.98760.14630.56490.8086
Medium, mixed → gold, thr 0.30.01810.91020.97520.18010.46700.7309
  • TH–EN is scored once per Thai name against all of its annotated romanizations (multi-reference).
  • EN–TH is scored against the single Thai spelling paired with each romanization.
  • Accuracy@3 counts a hit if any of the top-3 beam outputs matches exactly.

Limitations

  • Latin → Thai loses information. A romanization drops Thai orthographic detail: consonant choice (จ vs. ช), vowel length (-ชัน vs. -ชาญ), and silent letters (์). Many outputs that the metric counts wrong are still valid Thai names. Prefer the ranked n-best list over the single top output.
  • Domain: the model is trained on Thai personal names. Expect worse results on common nouns, place names, foreign names, or phrases.
  • Romanization style: outputs follow common personal-name spelling habits from the gold annotations. They do not follow RTGS or any other formal standard.
  • Data noise and bias: the silver data comes from web scraping and automatic engines. It is filtered but still noisy, and its biases and coverage gaps may show up in the outputs.
  • Evaluation scope: results come from one annotator's gold dev split of 323 names. Use human review for high-stakes or irreversible decisions.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
T5ForConditionalGeneration
Ревизия весов
a156d14

0 моделей