AksharaLP-Kosh-1.2M
The smallest Hindi transliterator we measured.
0.78 MB, running in a browser tab.
Romanized Hindi → Devanagari, entirely on-device.
1.2M parameters, a 180,000-word lexicon, a reverse-channel student and the JavaScript runtime in one 777,970-byte download.
⚠️ Research and evaluation only. These weights are released under CC BY-SA 4.0 and derive in part from CC-BY-SA 4.0 data, so they carry share-alike terms. They are not offered for commercial use. For commercial Hindi transliteration, use AksharaLP-1M-v2 (Apache-2.0, 7.92 MB, 70.04% top-1) instead.
| 0.78 MB | 68.09% | 85.29% | 91.21% | 1,205,249 | 0 |
|---|---|---|---|---|---|
| whole download, gzipped | top-1 · Aksharantar Hindi test | top-3 | top-8 | parameters in total | network calls after load |
Typing on a QWERTY keyboard, Hindi usually gets written in Latin letters: "kal meeting hai, kaise ho?". AksharaLP-Kosh turns that into Devanagari — कल मीटिंग है, कैसे हो? — with no server, no GPU and no network. It transliterates (changes script); it does not translate.
Everything in this repository is one self-contained system: four data files plus a dependency-free JavaScript runtime. There is no second download, no dictionary pack to fetch later, no cache to warm.
Recorded from the live demo Space: the model decodes each word in a Web Worker inside the browser tab, offline, with no request leaving the page.
Why it is the smallest of its kind
Every claim in this section is a number from the same scored test run, or simple arithmetic on it.
| # | Claim | The number |
|---|---|---|
| 1 | One download, nothing deferred. | 777,970 bytes gzipped (0.78 MB) contains the forward model, the 180,000-word lexicon, the reverse-channel student, the reranker and the runtime. No second fetch, no dictionary pack, no cache warming. |
| 2 | Most accurate model under 1 MB on this benchmark. | 68.09% top-1 at 0.78 MB, against 65.89% at 0.87 MB for the next smallest system we measured. |
| 3 | Smallest system measured that crosses 68% top-1. | The next smallest above it in this family is AksharaLP-1M at 4.53 MB (70.37% on its own card), about 5.8× the download; then AksharaLP-1M-v2 at 7.92 MB (70.04%), about 10×. IndicXlit's full package is about 404 MB (69.33%), about 500×. |
| 4 | Best top-8 recall in its size class. | 91.21% against 87.29% for the other sub-megabyte system. Not the best overall — AksharaLP-1M-v2 reaches 93.63%. |
| 5 | About 87 points of top-1 per MB of download. | IndicXlit full is about 0.17, AksharaLP-1M-v2 about 8.8. A ratio derived from the table below, not a published metric. |
| 6 | +8.93 points over IndicXlit's standalone model at 1/59th of its size. | 68.09% against 59.16% (beam 8), and +9.21 over beam 4. It lands within 1.24 points of IndicXlit's full package, which ships a 358 MB rescoring dictionary. |
| 7 | A 988,928-parameter transformer inside 375 KB of weights. | 3.06 bits per parameter, via 3-bit quantisation-aware training plus an arithmetic coder (XQC1). The 180,000-word lexicon adds 285 KB, about 1.6 bytes per word (WLC1). |
Stated plainly: a large part of that accuracy comes from lexicon coverage. With every one of the 9,991 test reference words removed from the list, the same model scores 32.70% top-1. Out-of-list words — new names, slang, rare spellings — are where it fails, and IndicXlit's full package still leads top-1 by 1.24 points. This is the smallest system we measured that reaches this accuracy; it is not a claim to be the smallest transliteration model in existence, nor the most accurate.
Benchmarks
One scored run per system, on the same machine, with the same scoring script (Unicode NFC; punctuation and danda normalised). Aksharantar Hindi test set: 9,991 unique romanized words. Brackets are 95% bootstrap intervals over words.
| System | Download | Top-1 % | Top-3 % | Top-8 % | Top-1 per MB |
|---|---|---|---|---|---|
| AksharaLP-Kosh-1.2M (this release) | 0.78 MB | 68.09 [67.20, 69.00] | 85.29 | 91.21 | 87.5 |
| Sub-megabyte reference transliterator (third party, unnamed here) | 0.87 MB | 65.89 [64.97, 66.83] | 82.56 | 87.29 | 75.6 |
| AksharaLP-1M-v2 (commercial, Apache-2.0) | 7.92 MB | 70.04 [69.16, 70.90] | 88.31 | 93.63 | 8.8 |
| IndicXlit, model only, beam 8 | 46.0 MB fp32 | 59.16 [58.14, 60.13] | 79.95 | 88.29 | 1.29 |
| IndicXlit, model only, beam 4 | 46.0 MB fp32 | 58.88 [57.89, 59.82] | 79.49 | 82.60 | 1.28 |
| IndicXlit, full package | 404 MB fp32 + 358 MB dictionary | 69.33 [68.44, 70.23] | 85.40 | 88.29 | 0.17 |
Paired bootstrap over words, 2,000 resamples, seed 0:
| Comparison | Gap in top-1 points | 95% CI |
|---|---|---|
| Kosh − IndicXlit model only (beam 8) | +8.93 | [8.02, 9.85] |
| Kosh − IndicXlit model only (beam 4) | +9.21 | [8.31, 10.14] |
| Kosh − IndicXlit full package | −1.24 | [−2.03, −0.46] |
| Kosh − sub-megabyte reference | +2.20 | [1.51, 2.89] |
| Kosh − Kosh with test references removed from the lexicon | +35.39 | [34.50, 36.30] |
Validation, not test. Every choice that shaped the system — lexicon size, reranker fit, decoding settings — was made on Aksharantar Hindi validation data and internal dev spellings. Validation scores over 5 seeds: 67.60 / 86.34 / 91.95 top-1 / 3 / 8. The test set was scored once, after the release build was frozen, and will not be reused.
Leak check. 0 of the 9,991 test romanisations appear in the 180,000-word lexicon; 7,492 of the 10,112 test references (74.1%) do. Nothing was added or removed for the check — those are the shipped files. That 74.1% coverage is exactly why the ablation above matters, and it is the honest limit of the headline number.
What the fold columns mean. 71.44% top-1 is the same system scored with common spelling variants folded together (nukta, anusvara, final-vowel forms), and 86.75 / 92.10 are its top-3 / top-8. It is reported for context, not used as the headline.
Real outputs
Produced by the runtime and the files in this repository, word by word, on the released bundle. Failures are included and not edited. Standard spellings are given in the last column so you can check them yourself.
| You type | Kosh writes | Standard | |
|---|---|---|---|
namaste |
नमस्ते | नमस्ते | ✅ |
dhanyavaad |
धन्यवाद | धन्यवाद | ✅ |
mujhe |
मुझे | मुझे | ✅ |
bhasha |
भाषा | भाषा | ✅ |
akshar |
अक्षर | अक्षर | ✅ |
kya |
क्या | क्या | ✅ |
accha |
अच्छा | अच्छा | ✅ |
kitna |
कितना | कितना | ✅ |
bhai |
भाई | भाई | ✅ |
theek |
ठीक | ठीक | ✅ |
cricket |
क्रिकेट | क्रिकेट | ✅ |
doctor |
डॉक्टर | डॉक्टर | ✅ |
school |
स्कूल | स्कूल | ✅ |
SBI |
एसबीआई | एसबीआई | ✅ |
bharat |
भरत | भारत | ❌ — standard spelling is rank 2 |
chai |
चाई | चाय | ❌ — standard spelling is rank 4 |
paani |
पाणी | पानी | ❌ — standard spelling is rank 2 |
hai |
हाई | है | ❌ — standard spelling is rank 3 |
kal |
काल | कल | ❌ — standard spelling is rank 2 |
nhi |
एनएचआई | नहीं | ❌ — chat spelling; standard is rank 4 |
ghr |
जीएचआर | घर | ❌ — chat spelling; standard is rank 3 |
Top-5 candidates for a sample of words, so you can see what the suggestion bar would get:
| Input | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
kaise |
कैसे | केसे | कइसे | कईसे | कैसै |
namaste |
नमस्ते | नामस्ते | नमास्ते | नमसते | नाश्ते |
ho |
हो | हों | हॉ | एचओ | हौ |
bahut |
बहुत | बहत | बहूत | बहोत | बेहट |
meeting |
मीटिंग | मिटिंग | मेटिंग | मैटिंग | मीटिग |
Boht |
बोहत | बोहट | बोह्ट | बोह्त | बॉट |
These are the shape of the failure mode: short words with many valid readings (hai, kal, chai) and chat abbreviations
(nhi, ghr) go wrong at rank 1, while the right answer is usually still in the top 5. Longer, well-formed words are reliable.
How 988,928 parameters fit in 375 KB
Three compressions, stacked, each of them reversible inside the browser:
- 3-bit, trained that way. Quantisation-aware training at 3 bits per weight, with a shared 256-entry log-spaced fp16 scale codebook. The forward transformer ends up at 3.06 bits per parameter.
- XQC1 entropy coding. A context-mixing arithmetic coder over the quantised integers, with a pure-JavaScript decoder — no WASM, no native code. The same idea, WLC1, codes the word list: front-coding, 16 log-frequency bands, a bit-level model with cross-word context, reaching about 1.6 bytes per word for 180,000 words.
- One file set, no pack. The lexicon, the reverse student, the reranker and the runtime all travel beside the weights, so a device is ready after a single 0.78 MB download.
| Part | On disk | gzipped | What it is |
|---|---|---|---|
xlit.xqc |
378,336 B (369 KB) | 375,140 B (366 KB) | forward transformer, 988,928 params, 3-bit QAT |
words.wlc |
284,746 B (278 KB) | 284,854 B (278 KB) | 180,000-word Devanagari lexicon, WLC1 |
rev.xqc |
96,530 B (94 KB) | 93,817 B (92 KB) | reverse-channel student, 215,168 params, 3-bit |
params.json |
11,910 B (12 KB) | 4,935 B (5 KB) | decode settings + 1,153-weight reranker |
aksharalp_tiny.min.mjs |
47,833 B (47 KB) | 19,224 B (19 KB) | the whole runtime, zero dependencies |
| Total | 819,355 B | 777,970 B (0.78 MB) | one download, nothing deferred |
aksharalp_tiny.browser.min.mjs is also here (46,176 B). It is the same runtime with a loadTiny() helper and the
Node-only loaders removed — an alternative to aksharalp_tiny.min.mjs, not an extra download. Pick one; the 0.78 MB total counts
one runtime, and either fits the number above.
How it works
- Candidates. For one romanised word, four generators propose spellings: a free beam over the character transformer, a beam
constrained to the 180,000-word lexicon trie, consonant-skeleton lookups for vowel-ambiguous spellings, and letter-name
acronyms (
SBI→ एसबीआई). - Reverse channel. A 215,168-parameter student model scores each candidate by asking how likely the original roman string was, given that Devanagari spelling — teacher-forced natural log-probability, its length-normalised form, and the max-relative versions of both: 4 features.
- Reranker. A 34-feature, hid-32 tanh MLP with 1,153 weights, fitted only on Aksharantar Hindi validation data, orders the candidate list. This is what turns a 32.70% raw-lexicon system into 68.09%.
| Component | Shape | Parameters |
|---|---|---|
| Forward transformer | d=128, 4 heads, 3 encoder + 2 decoder layers, FFN 384 | 988,928 |
| Reverse student | d=64, 4 heads, 2 + 2 layers, FFN 192 | 215,168 |
| Reranker | 34 → 32 (tanh) → 1 | 1,153 |
| Total | 1,205,249 |
There is no sentence-level n-gram language model in this release. Decoding is word by word; the runtime's
sentence path is not used here, and the demo calls word() for each token.
Quickstart
Browser (ES module)
# one download: 0.78 MB total (see the file table above)
huggingface-cli download sourojitdotcom/AksharaLP-Kosh-1.2M --local-dir kosh
<script type="module">
import { Tiny } from "./kosh/aksharalp_tiny.min.mjs";
const base = "./kosh/";
const bytes = async (f) => new Uint8Array(await (await fetch(base + f)).arrayBuffer());
const [xqc, wlc, rev, params] = await Promise.all([
bytes("xlit.xqc"), bytes("words.wlc"), bytes("rev.xqc"),
fetch(base + "params.json").then((r) => r.json()),
]);
const kosh = new Tiny({ xqc, wlc, rev, params }); // construct once, reuse
kosh.word("kaise", 5);
// → [{text:"कैसे",score:9.42}, {text:"केसे",score:…}, …] top-5 for one word
</script>
Serve the files from your own origin. huggingface.co returns JavaScript files as text/plain, so a browser refuses to load
them directly as a module (import … from "https://huggingface.co/…/aksharalp_tiny.min.mjs" fails on MIME type). Download the
repository and serve it yourself (python3 -m http.server is enough; any static host works), or import the module through a CDN
that serves it as text/javascript.
If you would rather not write the four fetches, aksharalp_tiny.browser.min.mjs in this repository is the same runtime with a
loadTiny(base) helper added and the Node-only loaders removed (46 KB minified):
import { loadTiny } from "./kosh/aksharalp_tiny.browser.min.mjs";
const kosh = await loadTiny("./kosh/"); // fetches the four data files, returns a ready engine
Call word() once per romanised token. It is the only decoding path this bundle supports: the reverse channel and the 34-feature
reranker are wired inside it, so pass words, not sentences. Cost is a few hundred milliseconds per word on one CPU thread (see
Limitations). Run it in a Web Worker if you need the UI to stay responsive — that is exactly what the demo Space does.
Node.js (≥ 18)
import { loadTinyDir } from "./aksharalp_tiny.min.mjs";
const kosh = await loadTinyDir("./"); // the same four files, from disk
console.log(kosh.word("dhanyavaad", 3).map((x) => x.text)); // [ 'धन्यवाद', 'धन्यावाद', 'धन्यवाद्' ]
Tiny and loadTinyDir are exported from aksharalp_tiny.min.mjs itself; only loadTinyDir touches node:fs, so bundlers that
target the browser should strip it (or use the browser bundle above, which has it removed).
What is not here
There is no Python package in this repository. The shipped runtime is the JavaScript module — the same one the demo Space runs — so the four data files plus that module are the complete system. A separate PyTorch reference decoder exists for parity testing (JavaScript and Python agree on top-1 for 300/300 validation words); it is not part of this download.
Why this is groundbreaking
The interesting part here is not one Hindi model. It is that the whole thing is a recipe. A frequency lexicon, a distilled forward model, a small reverse student and a reranker fitted on validation put a language into under a megabyte. Hindi is the first language through it. Every other language with a roman input habit, a monolingual corpus and a teacher model can follow the same path — and the runtime and the coders do not change. Only the four artefacts do.
- Any language, same architecture. The coders, the quantisation and the browser runtime are language-independent. Adding Marathi, Bengali, Telugu or Tamil means retraining two small models and rebuilding a lexicon — not writing new infrastructure.
- Truly offline, by construction. 0.78 MB is small enough to ship inside an app, a kiosk, a robot or a field device, and the whole pipeline runs on a single CPU thread with no network call and no server cost per keystroke. That is what makes native-language input viable where connectivity is not.
- Native-language interaction for robotics and field science. A robot, a drone ground station or a field instrument that accepts spoken or typed local-language input needs the transliteration step on-device. 0.78 MB fits in the same envelope as the rest of an embedded stack, and the vocabulary can be specialised to a domain by rebuilding the lexicon.
- Data-sensitive environments. Hospitals, banks, government offices and defence systems can offer local-language input without sending keystrokes to a third-party API. The model is a file, not a service, so nothing leaves the device.
- Defence and disconnected operations. A sub-megabyte model can be pre-loaded on issued hardware and updated by file transfer, which suits environments where cloud dependency is a liability rather than a convenience.
- A path to a hundred languages. If each language costs under a megabyte, a hundred of them together still fit in the space of one conventional model.
None of this is claimed as deployed. What is measured is Hindi at 68.09% top-1 in 0.78 MB. Everything above is the shape of what the recipe makes possible, and the next languages are the test of it.
Limitations
- Hindi only, word by word. This release handles Hindi in Latin letters. There is no sentence-level context model: each token is decided on its own, so agreement across a sentence is not modelled.
- Speed. 262.6 ms per word (p50) and 357.1 ms (p95) in Node on one CPU thread over the first 1,000 test words, with about 4.6 s to load and decode the files. Batched Python is far faster (21.6 ms per word) but the browser path is the shipped one. That is fine for a suggestion bar after a word is finished; it is not a keystroke-by-keystroke experience.
- The lexicon carries much of the accuracy. Remove the test references from the word list and top-1 falls to 32.70% — the ablation is in the benchmark table. Names, slang, agglutinated forms and rare spellings are where this model loses.
- IndicXlit full package is ahead on top-1 by 1.24 points [−2.03, −0.46], at roughly 500× the download.
- Short ambiguous words.
hai,kal,chai,paanican pick a valid but non-standard spelling at rank 1. Check the top-5. - Chat spellings are weak. Abbreviations like
nhi,thk,ghrare read as letter names (एनएचआई, टीएचके, जीएचआर); the standard spelling is usually rank 2–4 rather than rank 1. - The test set is spent. It was scored once. Future numbers for this model must come from a held-out set or a new collection.
- Research licence. CC BY-SA 4.0, share-alike, evaluation-oriented. Not cleared for commercial deployment; use AksharaLP-1M-v2 for that.
Intended use
- Research on extreme model compression: 3-bit QAT, entropy coding, distillation, and what a reranker can recover from a frequency lexicon.
- Evaluation of on-device transliteration under a hard size budget, especially where offline operation is a requirement.
- Prototyping Hindi input for browsers, kiosks and embedded devices, inside a research or evaluation context.
Not intended for: commercial products, safety-critical input, or any use that requires the accuracy of a full-size system.
Licence and attribution
CC BY-SA 4.0, research and evaluation only. Weights, lexicon and runtime in this repository are released under
Creative Commons Attribution-ShareAlike 4.0 International (full text in
LICENSE). The training data includes CC-BY-SA 4.0 material, so derivatives inherit share-alike terms. Do not assume
commercial clearance; for commercial Hindi transliteration, use
AksharaLP-1M-v2, which is Apache-2.0.
If you redistribute this model or a derivative, keep the attribution header in the runtime and include NOTICE and LICENCES.
Please use this attribution text:
AksharaLP-Kosh-1.2M by Sourojit Dhua — https://huggingface.co/sourojitdotcom/AksharaLP-Kosh-1.2M
Research use only, CC BY-SA 4.0.
Data and teachers
| Source | Licence | Used for |
|---|---|---|
| Aksharantar, AI4Bharat | CC0 (mined portion) / CC-BY (manually collected portion), including Dakshina-derived pairs under CC-BY-SA 4.0 | romanised ↔ Devanagari training pairs, and the validation split the reranker was fitted on |
| IndicCorp v2, AI4Bharat | CC0 | frequency source for the 180,000-word Hindi lexicon |
| IndicXlit, AI4Bharat | MIT | distillation teacher for the forward model; also the comparison baseline scored above |
| Dakshina, Google Research | CC-BY-SA 4.0 | romanised Hindi data included via Aksharantar |
LICENCES carries the full text of each, and NOTICE carries the attribution notices.
Fonts used in the demo Space (Inter, Noto Sans Devanagari) are under the SIL Open Font License 1.1. No other parties are involved in this release beyond the data and teacher credits above.
Citation
@software{dhua_aksharalp_kosh_2026,
author = {Dhua, Sourojit},
title = {{AksharaLP-Kosh-1.2M}: a 0.78 MB Research Hindi Transliterator},
year = {2026},
version = {1.0.0},
url = {https://huggingface.co/sourojitdotcom/AksharaLP-Kosh-1.2M},
note = {Research use only, CC BY-SA 4.0}
}
If you use the training data or the teacher, cite them too:
@inproceedings{roark-etal-2020-processing,
title = {Processing {C}onstituency {P}arsing and {T}ransliteration for {I}ndic {L}anguages},
author = {Roark, Brian and Wolf-Sonkin, Lawrence and Kirov, Christo and Mielke, Sabrina J. and Johny, Cibu and Demirsahin, Isin and Hall, Keith},
booktitle = {Proceedings of the 12th Language Resources and Evaluation Conference},
year = {2020}
}
@misc{aksharantar2022,
title = {Aksharantar: Open Indic-language Transliteration Datasets},
author = {Madhani, Yash and others},
year = {2022},
note = {AI4Bharat}
}
The AksharaLP family
| Model | Download | Top-1 | Licence | Note |
|---|---|---|---|---|
| AksharaLP-Kosh-1.2M | 0.78 MB | 68.09% | CC BY-SA 4.0, research | this release: one download, no pack |
| AksharaLP-1M-v2 | 7.92 MB | 70.04% | Apache-2.0 | commercial; 0.57 MB core + 7.35 MB dictionary pack, sentence-level bigram LM |
| AksharaLP-1M | 4.53 MB | 70.37% | Apache-2.0 | first release; 1.5M-word dictionary pack, lower chat-spelling accuracy |
Kosh, v2 and IndicXlit rows in the benchmark table above were all scored by us with the same harness. The AksharaLP-1M row is quoted from that model's own card (4.53 MB download, 70.37% top-1) and was not re-scored for this release, so treat it as context rather than a like-for-like measurement.
Kosh is not a replacement for v2. It is the smallest member of the family, and the one that proves the recipe: on this benchmark it gives up 1.95 points of top-1 to a model more than ten times its size, and does it in a single download with no server, no pack and no network.
AksharaLP · Kosh 1.0.0 · built 2026-11-04 · questions and feedback: open a discussion on this repository.
- Downloads last month
- -
Datasets used to train sourojitdotcom/AksharaLP-Kosh-1.2M
ai4bharat/Aksharantar
Space using sourojitdotcom/AksharaLP-Kosh-1.2M 1
Evaluation results
- Top-1 accuracy on Aksharantar (Hindi test)test set self-reported68.090
- Top-3 accuracy on Aksharantar (Hindi test)test set self-reported85.290
- Top-8 accuracy on Aksharantar (Hindi test)test set self-reported91.210