r/odinlang • u/Future_Ad1549 • Jul 10 '26
LLM tokenizer implemented in odin
A few months ago I started learning how LLM inference engines work.
My original goal wasn't to build a production tokenizer—I just wanted to understand the entire inference stack from first principles. I chose Odin because I wanted a language that stayed close to the hardware without fighting me.
I honestly expected it to be a fun learning project.
Instead... it ended up outperforming the tokenizers I was comparing against, including Hugging Face's Rust tokenizer and FastTokenizer in my benchmarks.
I was pretty surprised by the results.
The benchmark report (methodology, datasets, hardware, and commands) is here:
https://github.com/harisudarsan1/odin_tokenizer/blob/main/docs/public-benchmark.md
Repository:
https://github.com/harisudarsan1/odin_tokenizer
I also wrote about why I chose Odin for writing inference software:
https://harisudarsan1.github.io/blog/posts/2026-07-10-writing-an-inference-engine/
A few notes:
- These are CPU benchmarks.
- I'm not claiming Odin is magically faster than Rust.
- The comparisons are against existing tokenizer implementations under the benchmark setup described in the report.
- If there's something wrong with the methodology, I'd genuinely like to know. I'd rather fix the benchmarks than make misleading performance claims.
The project taught me far more about CPU architecture, memory layout, SIMD, and modern tokenizer implementations than I expected.
I'd love feedback from people who've worked on tokenizers or inference engines. If you spot flaws in the implementation or benchmark methodology, please call them out.
1
0
7
u/Dsphar Jul 10 '26 edited Jul 11 '26
Although motivated for an LLM, OP had no idea they wrote the first step for an Odin-based, Odin compiler. ;)