A lot of Hindi is typed in English letters: "kaise ho", "aaj office mein meeting hai". Turning that into Devanagari, कैसे हो and आज ऑफिस में मीटिंग है, is called transliteration. The tools that do it well usually run on a server, or carry a word list of hundreds of megabytes.
Lekhani is our attempt to do it from a file small enough to sit inside a web page: 0.87 MB in all, running on your own device, so nothing you type is sent anywhere. Lekhani (लेखनी) is Hindi for "pen".
What we built
- A small model: an encoder-decoder transformer with 811,904 parameters (2 + 2 layers, width 128), trained from random weights and stored at 4 bits.
- A word list: 200,000 common Hindi words, released under CC0.
- A runner: 5 KB of JavaScript with no dependencies. It runs in any modern browser, or in Node 18 and newer.
- 871,248 bytes to download in total. In Chromium on a Mac mini it starts in 0.2 s once the files are downloaded, uses about 23 MB of memory and takes 18 ms a word.
- Open: Apache-2.0 for the model and the runner, CC0 for the word list.
Why it is harder than it looks
There is no single way to write a Hindi word in English letters. People type the same word in many ways, and a transliterator has to land on the one right spelling. These are Lekhani's own outputs:
| What people type | Lekhani writes |
|---|---|
| kaise · kaisay · kaisey | कैसे |
| nahi · nahin | नहीं |
| pyaar · pyar | प्यार |
| zindagi · jindagi | जिंदगी |
| office · meeting | ऑफिस · मीटिंग |
English words used in Hindi matter as much as Hindi ones, because that is how people chat.
How it fits in 0.87 MB
The model reads a word letter by letter and proposes its 8 best spellings. The word list then moves a common real word up when the model is unsure. A word that is not in the list, such as a name, still works from the model alone; the list only re-ranks the model's choices.
The model learned from about 4.3 million pairs of romanised and Devanagari words. They come from AI4Bharat's Aksharantar (its CC0 and CC-BY parts) and from a teacher: AI4Bharat's IndicXlit wrote the many ways people type common Hindi words, and the Hindi spellings of English words. No test word was in the training pairs.
The result
We scored every system ourselves on the Aksharantar Hindi test: 9,991 romanised words, top-1 exact match against any reference spelling, one script and the same words for every system, measured on 28 October 2026.
| System | What you download or hold | Aksharantar Hindi | Hinglish chat set (of 122) |
|---|---|---|---|
| Lekhani | 0.87 MB | 65.9% | 112 |
| IndicXlit, model on its own | 11.5M parameters | 58.9% | 102 |
| IndicXlit, full Python package | the model + a 4.2M-word list, 358 MB in memory | 68.7% | 112 |
- Against IndicXlit's model on its own: +7.0 points (paired 95% interval +6.1 to +8.0).
- Against IndicXlit's full package: -2.8 points (-3.6 to -2.1). The package is more accurate, if you can hold its 358 MB word list.
- The Hinglish chat set is our own: 122 words people type in chat, checked word by word by a native Hindi speaker. Lekhani gets 112, level with IndicXlit's package. It is too small to call a few words' difference.
- Every other open transliterator we ran on the same test, word by word, scored far lower. The best was a 15M model at 48.6%.
Why the size matters
The AI models you hear about are huge and run in data centres. A transliterator that lives in a web page or an app needs the opposite: it should load in a blink, work without a server, and keep what people type on their own device.
At 0.87 MB, Lekhani is small enough to add to a search box, a form, a chat app or a notes page without a backend, and it keeps working offline once it has loaded. The model gives every user its 8 candidates, so a keyboard can show the runners-up as suggestions.
Where it falls short
- About one word in three on this test is wrong at top-1. The test is hard, with many rare words and names. On everyday chat words it does much better (41 of 44 in our chat set), but it still makes mistakes there.
- Some common words come out wrong:
achabecomes अच् (it should be अच्छा;acchaworks),kalbecomes काल (कल is its second choice), anddelhibecomes देल्ही (it should be दिल्ली). - No sentence context. It writes one word at a time, so
main(I) andmein(in) both become में. One tap on a suggestion fixes it. - IndicXlit's full package is 2.8 points more accurate on the main test.
- Hindi only, Latin letters to Devanagari only. Speed is measured on one Mac mini; phones are not measured yet.
Try it
- In your browser: udgamlabs.com/models/lekhani
- Model and files: huggingface.co/udgamlabs/Lekhani
- Code and examples: github.com/udgamlabs/lekhani
If you type Hindi in English letters, tell us which words it gets wrong; they are what we want to fix next.
Thank you to AI4Bharat for Aksharantar, IndicXlit and IndicCorp, which this work stands on, and to the CMU Pronouncing Dictionary for English words.