Zig-based high-performance tokenizer 'ztok' released
·2026.05.22 17:49
Key point
ztok, a multithreaded Zig-based tokenizer that is 2 to 5 times faster than existing tiktoken and Hugging Face tokenizers, has been released.
Details
Implemented in the Zig language, ztok is a high-performance, format-agnostic tokenizer library designed for local AI pipelines.
Key features:
- Broad compatibility: Automatically detects and loads
.tiktoken, Hugging Facetokenizer.json, SentencePiece.model, TokenMonster, Mistral Tekken, and more. - High performance: For the same vocabulary, it delivers about 2x faster speed than tiktoken on a single thread, and 3.8-5.5x faster in batch processing.
- Drop-in replacement: Guarantees bit-for-bit identical results to existing tiktoken, HF, and SentencePiece, allowing immediate replacement.
- Multi-language support: Supports 8 language bindings including Python, Node, Rust, Go, Java, .NET, Swift, and Ruby via C ABI.
- Practical use: Optimized for token-limited window processing for RAG (Retrieval-Augmented Generation) and dataset tokenization tasks.
This project is distributed under the AGPL-3.0 license.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.