Tokenization has long been a silent bottleneck in natural language processing pipelines. While language models grow in size and complexity, the stage of converting text into tokens remained a minor step, rarely optimized with the same rigor as training or inference. Gigatoken, a Byte-Pair Encoding (BPE) tokenizer written in Rust and released under an MIT license by Marcel Rød, a PhD student at Stanford, breaks that paradigm. Its performance is so disruptive that it deserves the attention of any professional working with large text volumes, from AI teams to companies that need to process data at industrial scale.
The published benchmarks are striking: on a machine with two AMD EPYC 9565 CPUs (144 cores total), Gigatoken achieves a processing speed of 24.53 GB/s on the 11.9 GB owt_train.txt corpus using the GPT-2 tokenizer. For context, OpenAI’s tiktoken reaches 36.0 MB/s, and HuggingFace tokenizers 24.8 MB/s. This represents a 681x and 989x advantage respectively. On a 16-core Apple M4 Max, the same workload runs at 8.79 GB/s, i.e., 1,268 times faster than HuggingFace tokenizers and 140 times faster than tiktoken. On a consumer AMD Ryzen 7 9800X3D, performance is 6.27 GB/s, outperforming HuggingFace by 106x and tiktoken by 68x. These numbers are not artifacts of a specific configuration or a single vocabulary: Gigatoken supports 23 tokenizer families in its published tests, including GPT-2, Llama 3 and 4, Qwen 2 to 3.6, DeepSeek V3/R1/V4, GLM 4 and 5, Kimi K2, Nemotron 3, Phi-4, OLMo 2/3, ModernBERT, Gemma, and Mistral.
How does Gigatoken achieve such acceleration? The secret does not lie in a faster BPE merge algorithm, but in two optimizations that most tokenizers take for granted: pretokenization and pretoken caching. Traditional pretokenization delegates to a regex engine, introducing considerable latency. Gigatoken rewrites it entirely by hand. The optimization log documents a fascinating evolution: starting from a fancy-regex implementation achieving 47 MiB/s, moving to a hand-crafted state machine at 380 MiB/s, then to a winnow combinator with NEON SIMD (462 MiB/s), then to a direct iterator with a 256-byte lookup table and SWAR technique (830 MiB/s), and finally to ILP exploitation with two simultaneous cursors reaching 1,049 MiB/s. The bottleneck at 840 MiB/s was not bandwidth but latency: each token depended on the previous one in a serial chain of about 25-27 cycles. Running two independent cursors from a safe split point allows the out-of-order processor to interleave both streams, effectively doubling throughput. Overall, pretokenization improves 22.3x compared to a regex implementation.
The second improvement is pretoken caching. If a word has been tokenized before, its encoding is retrieved from memory instead of being recalculated. Although implementing this cache is complex (the vocabulary grows quickly and word distribution follows a long tail), Gigatoken minimizes memory impact and maintains performance. Additionally, interaction with Python is minimized and threads are designed to interfere as little as possible with each other.
It is important to note that the gains are not universal. For SentencePiece vocabularies —such as those of Gemma or CodeLlama— improvements range from 7x to 22x, orders of magnitude lower than the 1,000x for BPE. And WordPiece is not supported. On the other hand, Gigatoken offers a compatibility mode that wraps an existing HuggingFace or tiktoken tokenizer, preserving exact output, though with a performance penalty of roughly 200-300x (due to Python overhead). The spectacular numbers correspond to the native API, where Rust reads files directly.
An independent verification on KrabArena, on a virtual machine with 4 vCPU Intel Xeon at 2.20 GHz and a 174 MB sample of OpenWebText, confirmed the results: Gigatoken 0.9.0 achieved a median of 277.8 MB/s, compared to 10.62 MB/s for tiktoken and 3.33 MB/s for tokenizers. All trials validated 35,356 documents, demonstrating that the performance trend scales with core count.
For companies developing language models or processing large corpora, Gigatoken is a game changer. Reducing tokenization time from hours to minutes, or minutes to seconds, significantly accelerates experimentation and deployment cycles. At Q2BSTUDIO, we understand that efficiency at every stage of the AI pipeline is critical. That is why we offer custom software services that integrate solutions like Gigatoken into production environments, optimizing from data ingestion to cloud inference. Our team combines expertise in artificial intelligence, cybersecurity, and cloud computing (AWS/Azure) to ensure that your projects are not only fast, but also secure and scalable.
Furthermore, fast tokenization has direct implications in areas such as process automation and business analytics. When processing millions of documents to feed BI dashboards (Power BI) or to train conversational AI agents, every millisecond counts. Gigatoken allows these workloads to run in less time and with lower resource consumption, translating into cost savings in cloud infrastructure. At Q2BSTUDIO, we help companies design architectures that leverage these cutting-edge technologies, whether through custom Python integrations, dedicated server deployments, or serverless cloud solutions.
In conclusion, Gigatoken proves that there is still room for radical improvements in components that were considered mature. Its Rust-based approach, SWAR and ILP set a new standard in BPE tokenization. For any organization seeking to maximize the performance of its natural language processing systems, evaluating this tool and, with the support of a technology partner like Q2BSTUDIO, integrating it securely and efficiently into workflows is well worth the effort.




