La Boétie

Tokemon.Morphological Hebrew tokenizer and Aramaic tokenizer for LLMs.

Tokemon is a Hebrew tokenizer for LLMs and other AI pipelines, and it covers Aramaic. It processes Semitic text around the root. On Tanakh it uses 1.30 tokens per morphological word and keeps 98.07% of roots intact. Normal Hebrew round trips with zero loss.

Semitic Tokenizer · V1 · Hebrew and Aramaic, live · lossless · root aware · 16,384 tokens vocabulary

tokemon@laboetie ~ tokenize

בראשית ברא אלהים את השמים

Fertility
1.30
tokens per word, up to 1.6× tighter than ChatGPT's tokenizer
Roots
98.07%
preserved
Round trip
100%
lossless, including final letter forms

0 failures

Lossless on 286M words

Round trip verified across all 6,205 texts.

Hebrew tokenizer benchmarks on real corpora

1.30

tokens / word

Fertility on Tanakh

Tokens per morphological word on Tanakh, measured against gold. Counted per running word on the same text, today’s ChatGPT tokenizer (o200k) spends 2.76 tokens and the older cl100k over 6. Tokemon spends 1.76 and keeps the root visible, against 1.75 for a Hebrew trained BPE (byte pair encoding) tokenizer.

98.07%

root preservation

Roots kept intact

We measured this on Tanakh against gold morphological lemmas.

100%

lossless round trip

Round trip fidelity

Every sequence decodes back to the exact original Hebrew, and final letter forms come back as written. We verified this with zero failures across roughly 1.8 million words of biblical, mishnaic, halakhic and held out talmudic text.

16,384

tokens

Frozen vocabulary

The inventory and its ids stay fixed. We promote the most frequent whole words to single tokens. Each id stays under the two byte ceiling.

We measure fertility on the full Tanakh of 306,785 words with a fully lossless round trip. Fertility holds across registers at 1.52 on Mishneh Torah and 1.63 on the Mishnah. Held out Gemara scores 1.76 tokens per word on a Talmud Bavli tractate excluded from training. We score root preservation against gold morphological lemmas.

How BPE splits Hebrew and Aramaic

Byte pair tokenizers were tuned for English. In Hebrew and Aramaic a three letter root runs through a pattern, and prefixes and suffixes attach to the result. BPE splits that structure into arbitrary fragments and removes the features that make the language learnable.

One root across four inflected forms

כ · ת · בktb · to write

A byte tokenizer gives these forms no shared unit for the root. Tokemon treats the root as one unit, so a model has the relationship from the first token.

כָּתַבkatav · he wrote
כְּתִיבָהketivah · writing
הִכְתִּיבhikhtiv · he dictated
מִכְתָּבmikhtav · a letter

The three properties of root aware tokenization

Morphology aware

The root across inflected forms

Hebrew and Aramaic build meaning from a root threaded through a pattern. Tokemon encodes that shared root as one stable unit of meaning across every inflected form, where a byte tokenizer outputs noise.

Lossless

Exact text reconstruction

Tokenize and detokenize normal Hebrew with zero drift. The detokenized text keeps its final letter forms. A byte tokenizer can output a medial letter in place of a final. Your pipeline stays free of silent corruption.

Compact

Tokens per word and context length

The vocabulary is fixed at 16,384 tokens. The most frequent whole words are promoted to single tokens, so common words cost one token. At around 1.3 tokens per word, the same text uses far less of your context window. Inference runs faster and costs less at the same fidelity.

Language coverage: Hebrew, Aramaic and the roadmap

Live now

Hebrew

Tokemon covers Biblical, Mishnaic, Rabbinic and modern Hebrew. Normal Hebrew round trips to identical text, including final letter forms.

Aramaic

The same tokenizer handles Talmudic and Targumic Aramaic. Root preservation on Talmudic Aramaic reaches 99.85% of token mass.

On the roadmap

Arabic

Arabic shares the root and pattern morphology and comes next on the Semitic line.

Judeo-Arabic

Its Hebrew script over an Arabic substrate makes it a natural extension.

Greek

We are developing a separate lexeme and stem aware tokenizer.

Loanwords

Foreign and technical words written in Hebrew letters will get first class handling.

Throughput and reproducibility at corpus scale

Tokemon tokenizes a whole tradition of texts end to end. Its hot path runs on par with SentencePiece, and its parallel emitter processes entire corpora in minutes. For training, it writes every token two bytes wide in a memory mappable format.

2.9 MB/s

Warm throughput

On par with SentencePiece on the hot path.

6.4 s

Full Talmud Bavli

Eight workers tokenize the entire Bavli in this time.

~17 min

Whole Sefaria corpus

286M words, 515.8M tokens and 6,205 texts processed end to end.

0 failures

Lossless on 286M words

Round trip verified across all 6,205 texts.

2 bytes

Per token (uint16)

Compact on disk and memory mappable for training.

Deterministic

Context free

A surface form gets a bit for bit identical analysis on every run.

The tokenize and detokenize interface

Tokemon exposes a tokenizer interface that takes text, returns token ids and offers a lossless path back. You can use it in place of a BPE or SentencePiece tokenizer without changing the rest of your stack.

REST

POST /v1/tokenize
{ "text": "בְּרֵאשִׁית בָּרָא אֱלֹהִים" }

→ { "tokens": [ ... ], "count": 5, "fertility": 1.30 }

Python

from tokemon import Tokenizer

tok = Tokenizer.load("hebrew-aramaic-v1")
ids = tok.encode("בְּרֵאשִׁית בָּרָא אֱלֹהִים")
text = tok.decode(ids)   # exact round trip
On this page

What a tokenizer does

A language model reads numbers. A tokenizer cuts text into pieces called tokens and gives each one an id. The model sees that sequence of ids, and a decoder turns the ids back into text.

Tokenization sets how much a text costs, how much fits in the context window and which patterns a model can see. Every provider bills by tokens, so a language that needs more tokens per word costs more to use.

Why Semitic languages need different treatment

Most tokenizers use byte pair encoding, or BPE. It learns the most frequent sequences of bytes in a training corpus and merges them. On English, with spaces between words and spelling that keeps words whole, this works well.

Hebrew and Aramaic build words differently. A root of usually three consonants runs through a pattern, and prefixes attach directly to the word.

FeatureEnglishHebrew and Aramaic
Word formationAdds pieces around a stemThreads a root through a pattern
Conjunctions and prepositionsSeparate wordsOften attached letters
Bytes per letter in UTF-8OneTwo, and more with vowel marks
Final letter formsNoneFive letters change shape at word end
Vowel marksNoneOptional marks on consonants

A BPE tokenizer sees bytes, so the shared root of four related words has no shared token. Multibyte letters can also be cut in the middle, which explains why some tokenizers show broken characters in streams.

How to read the benchmark

Three measures matter, and each answers a different question.

MeasureQuestionTokemon on Tanakh
FertilityHow many tokens per word?1.30 per morphological word, 1.76 per running word
Root preservationDo roots stay visible?98.07%
Round tripDoes the text come back exactly?100%

Compare like with like. Fertility per morphological word and per running word are different counts, since one running word can hold several morphological words. On running Tanakh text, today's o200k encoding spends 2.76 tokens and the older cl100k spends 6.01.

Compression alone can mislead. A BPE trained on Hebrew can compress diverse later texts about 12 to 35 percent tighter than Tokemon. Tokemon gives up that compression to keep morphology and the lossless guarantee.

Who should use it

You are buildingFit
A model trained from scratch on Hebrew or AramaicStrong
A research corpus needing exact round tripsStrong
A pipeline where a root must stay visibleStrong
An app calling a hosted modelThe hosted model uses its own tokenizer, so Tokemon cannot change it
Maximum compression on modern textA Hebrew BPE may suit you better
Word splitting for searchA simple rule based library is enough

A tokenizer and a model are tied together: replacing it means training or adapting a model. Bayaga is the studio's own Hebrew and Aramaic model work.

Tokemon or a word splitter

ToolOutputReversible?Use
Rule based splitterWords and punctuationUsually not exactlySearch, simple analysis
Morphological analyserLemmas and tagsNot the goalLinguistics
BPEToken idsYes, at byte levelGeneral model training
TokemonToken ids with root awarenessYes, on normal HebrewModels for Semitic text

Data preparation notes

  • Decide how to treat vowel marks and cantillation before training.
  • Keep one normalisation for training and inference.
  • Store ids as two byte integers, which suits memory mapped training.
  • Hold out a register you care about, such as Talmudic text.
  • Test the round trip on your own corpus before you train.

Tokemon's analysis is context free and deterministic: one surface form gets the same analysis on each run. It does not choose between meanings by context, which remains the model's job.

Next step

Send a brief with your corpus, its size and the model you plan to train. Read the benchmark figures above against your own text before you decide.

Hebrew tokenizer questions

What is a Hebrew tokenizer?

A Hebrew tokenizer splits Hebrew text into units a program can process. A rule based word splitter returns words and punctuation as text spans. A subword tokenizer for LLMs returns token ids that a model reads and that decode back to text. Tokemon is the second kind. It returns ids from a fixed vocabulary of 16,384 tokens, keeps 98.07% of roots intact on Tanakh and covers Aramaic.

What is Tokemon?

Tokemon is a tokenizer for Hebrew and Aramaic that is aware of how those languages are built. A byte tokenizer splits text into arbitrary fragments. Tokemon recognizes the root carried through a word and keeps it intact, with 98.07% root preservation on Tanakh. It tokenizes and detokenizes with a fully lossless round trip.

How does it compare to tiktoken, SentencePiece and BPE?

On the same normalized running text, the Tanakh, Tokemon spends 1.76 tokens per word. The tiktoken encodings behind ChatGPT (both byte level BPE) spend 2.76 for today’s o200k and 6.01 for the older cl100k. Across registers Tokemon runs 1.3 to 1.6 times tighter than o200k and about three times tighter than cl100k. At the same 16,384 token budget, a BPE trained on Hebrew lands at 1.75 and a SentencePiece unigram at 1.81. Tokemon is the only one of these that keeps the root in the stream and round trips losslessly.

When does a BPE trained on Hebrew beat Tokemon?

On lexically diverse later texts, the Hebrew BPE compresses about 12 to 35 percent tighter than Tokemon. Tokemon gives up that compression to keep the morphology and the lossless guarantee. On the Tanakh the two essentially tie, at 1.75 and 1.76 tokens per word on the same budget of 16,384 tokens. Tokemon suits a pipeline that needs the root in the token stream and an exact path back to the text.

Is the round trip lossless?

Yes, on Hebrew as it is normally written. Every token sequence decodes back to the exact original text with its final letter forms, where naive tokenizers can leave a medial letter in place of a final. Our word by word round trip of entire corpora, roughly 1.8 million words across biblical, mishnaic, halakhic and held out talmudic text, returned zero failures.

Which languages does it support today?

Hebrew and Aramaic are live across biblical, mishnaic, rabbinic, talmudic and targumic registers. Root preservation on Talmudic Aramaic reaches 99.85% of token mass. Arabic, Judeo-Arabic and a separate Greek tokenizer are on the roadmap. The same roadmap adds first class handling of loanwords written in Hebrew letters.

Does it handle modern Hebrew?

Yes. Normal modern Hebrew round trips to identical text, including final letter forms. The limit concerns the vocabulary of text with borrowed modern terminology: foreign words written in Hebrew letters with no Semitic root to recover. On that text, an all purpose subword tokenizer with a large multilingual vocabulary can compress more tightly than Tokemon does. First class handling of loanwords is on the roadmap.

How fast is it, and is it safe to run at scale?

The hot path sustains 2.9 MB/s and runs on par with SentencePiece. With eight workers the parallel emitter tokenizes the entire Talmud Bavli in 6.4 seconds and the full 286 million word Sefaria corpus in about 17 minutes. That whole corpus of 6,205 texts round trips with zero failures. Deterministic, context free tokenization makes runs reproducible bit for bit.

How do I integrate it into my pipeline?

Tokemon exposes a tokenizer interface that takes text, returns token ids and offers a lossless path back. You can call it over REST or from Python. You can use it in place of a BPE or SentencePiece tokenizer without changing the rest of your stack. Tokens are two bytes wide and memory mappable for training.

Why do fewer tokens per word matter?

On the Tanakh, Tokemon spends 1.76 tokens per running word where today’s ChatGPT tokenizer spends 2.76 and the older cl100k over 6. The same text uses far less of your context window, which extends effective context and speeds up inference at lower cost. Fidelity holds because the round trip stays lossless.

Bring Tokemon into your pipeline

The technical report holds the full benchmarks. The integration section shows the REST and Python calls.