Perplexity AI open-sourced a Rust Unigram tokenizer under MIT license at github.com/perplexityai/pplx-garden, with reported 5.5× p50 latency reduction over the HuggingFace tokenizers crate. Concrete numbers on 514 tokens (512 + BOS/EOS): 349µs HuggingFace vs 63µs Perplexity. At 16K tokens, the reference implementation does 299,171 allocations; the Perplexity version does zero. Production claim is 5-6× CPU utilization reduction on rerankers scoring hundreds of candidate documents per request, where GPU compute finishes in single-digit milliseconds and tokenization becomes the bottleneck.
The engineering pattern is the substance under the speedup. HashMap-based trie traversal gets replaced with a double-array trie (Aoe, 1989), which packs the trie into two contiguous integer arrays for cache-friendly indexing. Add bitmap-based byte validation to skip invalid prefix paths early, and a 2MB huge-page backing to keep the trie out of TLB-thrashing territory. Unigram tokenization itself runs a most-probable-path Viterbi over the learned log-probabilities of each vocabulary token — different from BPE's iterative merge — so the trie pattern fits Unigram naturally. The cost is memory: the trie grows from ~9MB to ~50MB. No quality regression reported; output is token-exact against the reference.
The ecosystem read for builders running reranker or embedding stacks: tokenization is a measurable bottleneck in CPU-bound paths and most teams have not instrumented it. If your reranker fans out to 200 candidate documents per query, tokenization runs 200× per request — a few hundred microseconds becomes tens of milliseconds, which on GPU-served inference is the same as the model itself. The narrow caveat: Perplexity's tokenizer targets XLM-RoBERTa's 250K-token SentencePiece Unigram vocabulary, so it benefits Unigram-vocab users (most rerankers and many multilingual embedders) but does not help BPE-tokenized stacks (most current frontier LLMs). The bigger lesson — Rust + double-array trie + huge-page backing + zero-allocation paths — is portable to any tokenizer hot path, and probably worth replicating for BPE tokenizers if your CPU budget is tight.
If you run reranker or embedding inference Monday morning: instrument tokenizer wall-clock against your inference wall-clock; if tokenization is more than 20% of the latter, this matters. If you use Unigram-vocab models specifically: pplx-garden is a drop-in candidate for replacing HuggingFace's crate. The 50MB memory cost is the tradeoff to budget for.
