← Blog
Project

AkaraAlpha

An efficient romanized Khmer to Khmer script transliteration model

Parameters 78.7K
CER 15.07%
License MIT

Overview#

Cambodians routinely type Khmer using the Latin alphabet — brodae for ប្រដែ — because romanized input is faster and more widely supported than Khmer keyboards. AkaraAlpha converts that romanized text back into correct Khmer script.

The system is an attention-based bidirectional GRU encoder-decoder, deliberately small at 78,705 parameters, paired with a Khmer dictionary post-processing step that guarantees every output is a real word.

Dataset#

Training used the Khmer Text Transliteration Dataset (Chhunneng, 2023), which provides parallel romanized–Khmer pairs.

  • Total samples: 28,569
  • Train / validation split: 22,855 (80%) / 5,714 (20%)
  • Format: parallel text pairs (brodae: ប្រដែ)

The data contains 77 unique Khmer characters and 26 unique Latin characters. Maximum sequence length is 25 characters for romanized input and 24 for Khmer output.

Histograms of word length for romanized Khmer input and Khmer script output
Figure 1 — Word length distribution across romanized Khmer and Khmer script.

Architecture#

Diagram of the attention-based bidirectional GRU encoder-decoder architecture
Figure 2 — The proposed attention-based bidirectional gated recurrent unit architecture.

The encoder uses a bidirectional GRU, processing the input from both directions. This matters for transliteration specifically: the correct Khmer character for a given Latin grapheme often depends on characters that come after it, not just before, so a unidirectional pass loses information.

Each input character is mapped through an embedding layer into a 32-dimensional dense vector before the GRU encodes it into a hidden state carrying both forward and backward context.

The decoder is a GRU that emits one Khmer character at a time. At each step it takes the previously predicted token and the projected encoder hidden state; an additive attention mechanism combines the encoder outputs with the decoder's current state into a context vector, letting the model focus on the relevant part of the input. That context is concatenated with the decoder output and passed through a dense softmax layer.

Embedding dimension32
GRU units64
AttentionAdditive
Total parameters78,705
OptimizerAdam
LossSparse categorical crossentropy
Epochs50, batch size 64

Post-processing#

Raw model output can be phonetically plausible but orthographically wrong. Rather than growing the model, AkaraAlpha adds a lexical validation layer.

The model generates three candidates via beam search, which are cross-referenced against a standard Khmer dictionary. If no exact match exists, a Levenshtein-distance fallback corrects the prediction to the closest valid word within a 2-character edit limit. Every final output is therefore a real Khmer word.

End-to-end pipeline from romanized input through beam search, dictionary lookup and Levenshtein correction
Figure 3 — End-to-end inference pipeline. Input flows through the encoder-decoder to produce three beam-search candidates, which pass through a lexical validation layer that cross-references a Khmer dictionary and recovers the closest orthographically valid entry via Levenshtein distance.

Results#

Character Error Rate on the validation set, against standalone baselines trained on the same data — lower is better:

ModelCER (%)Parameters
RNN102.4142,609
GRU51.6446,385
LSTM31.7858,417
Attention BiLSTM18.2696,753
Transformer17.78248,337
AkaraAlpha15.0778,705

AkaraAlpha reaches the lowest error rate while using under a third of the Transformer baseline's parameters.

Charts comparing character error rate across architectures and the accuracy-latency tradeoff across beam widths
Figure 4 — (a) Standalone model architectures compared by Character Error Rate. (b) Trade-off between Top-1 accuracy and inference latency across beam widths. The dotted line marks the 100ms real-time threshold, identifying k=5 as the practical operating point.

Beam width trades accuracy against latency:

ConfigurationTop-1Top-K hitLatency (ms/word)
Greedy44.44%44.44%21.92
k=370.06%78.72%66.03
k=573.60%83.41%94.15
k=774.87%85.60%122.10
k=1075.85%87.37%167.21

k=5 is the recommended operating point: a 29.16 percentage-point absolute accuracy gain over greedy decoding while staying under the 100ms threshold for real-time interaction. Beyond that, returns diminish as latency exceeds what feels responsive while typing.

Charts of the gap between top-1 and top-k accuracy, and of latency growth across beam widths
Figure 5 — (a) The gap between primary prediction (Top-1) and system recall (Top-K); at k=5 beam search adds 9.81 percentage points of recall. (b) The efficiency frontier relating accuracy gains to inference latency.