Tok'n'Roll: token-perfect LLM tokenizers in pure Java, up to 4x faster than HF in Python
mukel90 · reddit · 2026-12-01
Quixotic AI released Tok'n'Roll, a tokenizer written 100% in Java (no Unsafe), compiled via GraalVM Native Image into a shared library usable from Python via pip install toknroll.
- Token-perfect: verified against HF tokenizers, llama.cpp and tiktoken across Gemma, Mistral, Qwen, gpt-oss, Llama, DeepSeek, Kimi, GLM, MiniMax and more
- Fast: author's benchmark shows up to 4.0x vs HF tokenizers 1.0 rc5 (Laguna XS 2.1), 3.3x on Qwen 3.6, mostly 1.5-1.7x elsewhere
- Light: 5.6 MB wheel, zero dependencies, no JVM; fetches only the tokenizer, not full weights
- Supports HF and GGUF tokenizers, local or remote
The author's motivation: mainstream Python tokenization libs are thin Rust wrappers that lean heavily on unsafe, which he finds hard to justify. Available for Linux/Windows x86-64-v3 and macOS arm64.
More from Infra
- How HF kernels replace torch ops: SiLU case with compiled implementations — tomaarsen · 2026-12-03
- Sentence Transformers to default to optimized kernels for faster embeddings — tomaarsen · 2026-12-03
- Oppenheimer models Starlink at 100M broadband and 500M mobile subs by 2030 — XFreeze · 2026-12-03
- Building a GPU Simulator to Optimize Kernels Without Real Hardware — hargup13 · 2026-12-03
- 70.9 tok/s peak decode on an 8GB RTX 4060 with speculative decoding and GSQ quants — AIFlow_ML · 2026-12-03
- Grafting 168 attention tensors gets Caveling-2-Mini to ~95 tok/s on an RX 7900 XT — BitterNocturne · 2026-12-03