GigaToken: The 1000x Faster Tokenizer That Actually Works
If you have ever trained a language model, you have waited for tokenization. Not in the abstract sense — literally staring at a progress bar while HuggingFace’s tokenizers chew through terabytes of text. Tokenization is the unglamorous first step that nobody optimizes because it is “fast enough.” It turns out it was not.
Marcel Rød open-sourced GigaToken in late July 2026, and the claim is audacious: 1000x faster than HuggingFace’s tokenizers, with byte-for-byte identical output. Drop-in replacement. pip install gigatoken and your existing code runs — it just runs a thousand times faster.
The project hit 3,500 GitHub stars in its first week. The reason is not hype. The benchmarks are real, they are reproducible, and they expose how much performance has been left on the table in one of the most foundational operations in NLP.
The numbers that matter
On a standard benchmark using OpenWebText (a representative sample of web-scraped text data), GigaToken consistently hits gigabytes per second of throughput while HuggingFace’s tokenizers — which are already multithreaded Rust under the hood — stay in the tens of megabytes per second range.
The gap varies by tokenizer type, but the pattern is consistent:
| Tokenizer | GigaToken | HuggingFace | Speedup |
|---|---|---|---|
| GPT-2 (BPE) | 7.66 GB/s | 46.8 MB/s | 164× |
| Qwen 3 (BPE) | 6.99 GB/s | 25.4 MB/s | 275× |
| Llama 3.3 (BPE) | 6.08 GB/s | 74.0 MB/s | 82× |
| Llama 3/3.1/3.2 (BPE) | 5.85 GB/s | 62.1 MB/s | 94× |
| Kimi K2 (BPE) | 5.50 GB/s | 78.1 MB/s | 70× |
| DeepSeek V3/R1/V4 (BPE) | 4.21 GB/s | 51.6 MB/s | 82× |
| Mistral 7B (SentencePiece) | 1.47 GB/s | 91.6 MB/s | 16× |
The worst-case speedup is 16x on SentencePiece-based tokenizers like Mistral 7B — still an order of magnitude. The best cases are BPE tokenizers where GigaToken hits nearly 300x. The 1000x claim in the project tagline is based on the fastest BPE tokenizers on the most favorable hardware, and it is not marketing: on an Apple M4 Max, GPT-2 tokenization ran at 1,353x the speed of HuggingFace in a CLI benchmark.
But the raw numbers undersell the real impact. If you are tokenizing Common Crawl — roughly 130 trillion tokens — GigaToken on a dual-socket AMD EPYC server does it in 6.5 hours. The same job on HuggingFace’s tokenizers would take weeks.
How it actually works
The immediate reaction to “1000x faster” is skepticism, and for good reason. HuggingFace’s tokenizers library is already written in Rust with multithreading. Most “rewrite it in Rust” projects see 2-5x improvements if they are lucky. GigaToken is not just a rewrite. Rød targeted the actual bottlenecks that the existing implementations accepted as inherent.
Pretokenization is the killer. Before a BPE tokenizer can apply merge rules, it has to split text into pretokens — word-like units separated by whitespace and punctuation. This step uses regex. In HuggingFace’s implementation, the regex engine becomes the bottleneck at scale. GigaToken replaces regex-based pretokenization with hand-tuned SIMD (Single Instruction Multiple Data) routines that process 16, 32, or 64 bytes at a time depending on the CPU instruction set — AVX-512 on modern x86, AVX2 on slightly older chips, NEON on Apple Silicon. The result is pretokenization that runs at memory bandwidth speed rather than regex engine speed.
Caching with long-tail awareness. Tokenization has a hidden property: the distribution of pretokens is extremely long-tailed. A handful of words like “the” and “and” appear millions of times. Most words appear once. A naive cache that stores every pretoken-to-token mapping would balloon to gigabytes and become slower than recomputing. GigaToken uses a multi-tier cache hierarchy: an L1 cache in CPU cache for hot pretokens, an L2 cache in RAM for warm ones, and a fallback to recomputation for the long tail. The design draws directly from CPU cache architecture, and the performance profiles similarly.
Python overhead elimination. Even when the Rust code is fast, crossing the Python-Rust boundary costs microseconds per call. For batch tokenization of millions of short texts, that boundary crossing dominates runtime. GigaToken moves the iteration loop into Rust for batch operations — the entire batch is passed across the boundary once, processed entirely in Rust, and returned. This sounds obvious but HuggingFace’s batch API iterates over individual texts on the Python side, calling into Rust once per text.
Automatic parallelization. HuggingFace’s tokenizers support multithreading, but the user has to split data manually and manage the parallelism. GigaToken does this automatically: it finds natural document boundaries in the input, distributes chunks across threads, and merges results. On a 144-core EPYC server, this means the entire CPU is saturated without the user writing a line of parallel code.
These four optimizations compound. Pretokenization gets 50-100x faster. Caching eliminates redundant work for repeated patterns. Python overhead drops to near zero for batch workloads. Auto-parallelization uses all available cores. The product of these improvements is not a single 1000x speedup from one clever trick — it is a 10x here, a 5x there, a 3x there, multiplied across the pipeline.
What this changes in practice
The most immediate impact is on data preprocessing pipelines. Training a large language model involves tokenizing terabytes of text. This step has traditionally been a multi-day preprocessing job that you run once per dataset and try not to think about. With GigaToken, the same job finishes during a coffee break. That is not hyperbole — Common Crawl in 6.5 hours means you can iterate on your data filtering strategy, retokenize with different vocabularies, or experiment with tokenizer design without scheduling cluster time for preprocessing.
The second-order effect is on inference serving. Tokenization happens on every request. When latency budgets are measured in milliseconds, spending 5ms on tokenization when inference takes 50ms is a 10% overhead that nobody thinks about because “that is just what tokenization costs.” GigaToken reduces that overhead to near zero. For high-throughput serving with thousands of concurrent users, this adds up to real cost savings in compute and reduced tail latency.
The third effect is on local development. Running tokenization benchmarks on a laptop used to be a joke — “I will tokenize 100MB and extrapolate.” GigaToken on an M4 Max processes the entire OpenWebText training set (12GB) in under two seconds. You can iterate on tokenizer design on a laptop and get meaningful throughput numbers without a cluster. That lowers the barrier to entry for tokenizer research, which has been bottlenecked by the cost of running experiments.
The catch
No benchmark is perfect, and GigaToken’s are fair but worth examining closely.
Not all tokenizers are equal. The 1000x number applies to well-optimized BPE tokenizers like GPT-2 on specific hardware. SentencePiece-based tokenizers (used by Mistral, Gemma, and some older models) see 13-18x speedups — still significant but not transformative. If your pipeline uses mostly SentencePiece tokenizers, the benefit is real but smaller.
Python iteration overhead matters less for single-text workloads. If you are tokenizing one prompt at a time in an inference server, the absolute latency improvement might be 3ms → 0.5ms. That is a 6x speedup but invisible to the end user. The 1000x benefits show up in batch workloads — preprocessing, dataset creation, offline analysis.
The project is one person. Marcel Rød built GigaToken as a personal project. The README acknowledges rough edges: Windows support is minimal, SentencePiece optimization is lower priority, file sinks are not yet implemented, and the Python bindings use ABI3 which adds some overhead compared to version-specific CPython APIs. These are not dealbreakers but they mean GigaToken is currently a “use it and report issues” tool rather than a fully polished library.
Validation matters more than speed. The project ships with a validation mode that checks byte-for-byte output against HuggingFace’s tokenizers, and the README explicitly encourages users to validate on their own data. “Most likely not!” is the response when asked if mismatches are expected — the honesty is refreshing, but it also signals that edge cases exist. If your pipeline cannot tolerate even one mismatched token, validate before switching.
Who should switch today
If you run batch tokenization pipelines that process gigabytes or terabytes of text, switch. The time savings are too large to ignore, and the validation tools make it easy to verify correctness on your specific data.
If you run high-throughput inference serving with thousands of concurrent requests, switch. The reduced tokenization latency compounds across requests and directly reduces your compute bill.
If you are a researcher iterating on tokenizer design, vocabulary construction, or data preprocessing strategies, switch. The ability to run experiments on a laptop instead of a cluster changes what experiments are practical.
If you are using SentencePiece-based tokenizers exclusively, the case is weaker. 16x is nice but may not justify a dependency change. Wait for SentencePiece optimization to land (Rød has flagged it as a future priority), then switch.
If you are on Windows and cannot use WSL, wait. The Windows support is not yet mature enough for production use.
The bigger picture
GigaToken is the kind of project that makes you wonder what else we are leaving on the table. Tokenization has been “fast enough” for years. Nobody questioned it because the assumption was that HuggingFace’s tokenizers — multithreaded Rust with years of optimization — represented something close to the performance ceiling. They did not.
The same pattern has played out before: BLAS libraries got 10x faster when someone actually benchmarked the bottlenecks. JSON parsing got 5x faster with simdjson. Regular expressions got orders of magnitude faster with Intel’s Hyperscan. GigaToken joins this lineage: a foundational operation that everyone assumed was optimized, which turned out to have orders of magnitude of unclaimed performance sitting in the gap between “nobody is complaining” and “somebody actually measured.”
The lesson is not “Rust is fast” — HuggingFace’s tokenizers were already Rust. The lesson is that assumptions about performance bottlenecks survive only as long as nobody bothers to measure them. Marcel Rød measured, and the result is a tool that makes one of the most boring steps in ML suddenly interesting.
GigaToken is available on GitHub under the MIT license with 3,500 stars. The project includes a design document and a pretokenizer optimization log — they are a masterclass in how to profile, identify bottlenecks, and systematically eliminate them, the kind of engineering documentation most projects skip because “the code is the documentation.”