---
title: "Morphological Hebrew tokenizer and Aramaic tokenizer for LLMs."
description: "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."
canonical: "https://laboetie.io/products/tokemon"
language: en
---
# Tokemon: Morphological Hebrew tokenizer and Aramaic tokenizer for LLMs.

## Benchmarks

- Fertility on Tanakh: 1.30 tokens / word. 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.
- Roots kept intact: 98.07% root preservation. We measured this on Tanakh against gold morphological lemmas.
- Round trip fidelity: 100% lossless round trip. 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.
- Frozen vocabulary: 16,384 tokens. 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.

## Principles

### 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.

### 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.

### 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.

## 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.

## Languages

- 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.


## 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.

| Feature | English | Hebrew and Aramaic |
|---|---|---|
| Word formation | Adds pieces around a stem | Threads a root through a pattern |
| Conjunctions and prepositions | Separate words | Often attached letters |
| Bytes per letter in UTF-8 | One | Two, and more with vowel marks |
| Final letter forms | None | Five letters change shape at word end |
| Vowel marks | None | Optional 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.

| Measure | Question | Tokemon on Tanakh |
|---|---|---|
| Fertility | How many tokens per word? | 1.30 per morphological word, 1.76 per running word |
| Root preservation | Do roots stay visible? | 98.07% |
| Round trip | Does 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 building | Fit |
|---|---|
| A model trained from scratch on Hebrew or Aramaic | Strong |
| A research corpus needing exact round trips | Strong |
| A pipeline where a root must stay visible | Strong |
| An app calling a hosted model | The hosted model uses its own tokenizer, so Tokemon cannot change it |
| Maximum compression on modern text | A Hebrew BPE may suit you better |
| Word splitting for search | A simple rule based library is enough |

A tokenizer and a model are tied together: replacing it means training or adapting a model. [Bayaga](https://laboetie.io/lab/bayaga) is the studio's own Hebrew and Aramaic model work.

## Tokemon or a word splitter

| Tool | Output | Reversible? | Use |
|---|---|---|---|
| Rule based splitter | Words and punctuation | Usually not exactly | Search, simple analysis |
| Morphological analyser | Lemmas and tags | Not the goal | Linguistics |
| BPE | Token ids | Yes, at byte level | General model training |
| Tokemon | Token ids with root awareness | Yes, on normal Hebrew | Models 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](https://laboetie.io/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.


## Frequently asked 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.
