~1000x faster than HuggingFace's tokenizers, drop-in replacement. Tokenize your text data at GB/s! Note that both HF tokenizers and tiktoken are already running multithreaded Rust! Gigatoken is the fastest tokenizer for language modeling. It supports a wide range of CPU hardware, and nearly all commonly used tokenizers. Gigatoken can be used with its own API, or in compatibility mode with HuggingFace Tokenizers or Tiktoken. Compatibility Mode (Easiest) import gigatoken as gt # Minimum change from existing HuggingFace tokenizers usage (compatibility mode) hf_tokenizer = ... tokenizer = gt.Tokenizer(hf_tokenizer).as_hf() # tokenizer can be used in the same contexts as hf_tokenizer tokens = tokenizer.encode_batch(["This is a test string", "And here is another"]) # OR with tiktoken tiktokenizer = ... tokenizer = gt.Tokenizer(tiktokenizer).as_tiktoken() # Now works like existing tiktoken tokenizers tokens = tokenizer.encode_batch(["This is a test string", "And here is another"]) A substantial amount of effort has been put into making sure the outputs match exactly with what you would get with HuggingFace Tokenizers in this setting, but this is at a non-negligible cost to performance. You can still expect way faster performance across the board, but not quite the 1000x you will get with the Gigatoken API. import gigatoken as gt tokenizer = gt.Tokenizer("Qwen/Qwen3-8B") # Accepts HF model names file_source = gt.TextFileSource(["owt_train.txt"], separator=b"<|endoftext|>") tokens = tokenizer.encode_files(file_source) Using the Gigatoken API lets the Rust implementation read data directly, and skips as much overhead as possible while allowing for maximum parallelism. Keep in mind that passing Python data structures through this API still incurs the overhead of reading from Python. Q: Did you just way over-optimize for a specific CPU and tokenizer? How is it so fast? No, I way over-optimized for every combination of these! The results are very consistent across CPUs (modern x...
First seen: 2026-07-22 17:49
Last seen: 2026-07-23 15:05