A drop-in tokenizer replacement claims 1,000x the speed of HuggingFace's on the same chips

GigaToken tokenizes an 11.9GB dataset at 24.5 gigabytes per second on a 144-core server — roughly 989 times HuggingFace's tokenizer on identical hardware. One reader asked the obvious question: whose workload is actually bottlenecked by tokenization?

In brief

GigaToken is an open-source drop-in replacement for HuggingFace's tokenizer library, claiming up to ~1,268x the throughput on the same benchmark — SIMD-optimized regex pretokenization plus aggressive caching, not a new algorithm.

Benchmarked across three chip families — AMD EPYC server, Apple M4 Max, and a Ryzen desktop — the speedup held everywhere, from 106x on the smallest chip to 1,268x on Apple silicon.

The most-upvoted reply cut against the hype gently: tokenization is typically under 0.1% of total inference time — so who is this actually for?

The numbers, before the caveat

GigaToken GitHub repository
GigaToken GitHub repository

GigaToken bills itself as "~1000x faster than HuggingFace's tokenizers, drop-in replacement" — tokenization being the step that converts raw text into the integer sequences a language model actually consumes, a process every training run and every inference call has to pass through. The benchmark numbers, run on an 11.9GB dataset with the GPT-2 tokenizer, back up the headline: 24.53 GB/s on a 144-core AMD EPYC server (roughly 989x HuggingFace's throughput on the same hardware), 8.79 GB/s on an Apple M4 Max (about 1,268x), and 6.27 GB/s on a 16-core Ryzen 9800X3D desktop (about 106x) — the speedup scales with core count but holds up even on consumer hardware.

GigaToken throughput benchmark chart across CPUs
GigaToken throughput benchmark chart across CPUs

The technique isn't a new tokenization algorithm — it's SIMD vectorization applied to the regex-based pretokenization step that general-purpose tokenizer libraries usually leave to a generic regex engine, combined with aggressive caching of pretoken mappings to skip redundant lookups, and a deliberate minimization of Python-to-native boundary crossings and thread communication overhead. It supports most common BPE-based tokenizers — Llama, Qwen, GPT-2, Phi, DeepSeek, GLM — though notably skips WordPiece entirely and leaves SentencePiece-based tokenizers with more modest gains, since those architectures don't map as cleanly onto the same optimization approach.

"Tokenization is typically less than 0.1% of total inference time"

The thread's most-upvoted reply, from a commenter with a maximal karma-weight standing, landed a genuinely useful qualifier on the headline number: "This is awesome, but tokenization is typically <0.1% of total inference time." For a single chat completion running through a deployed model, tokenization overhead is essentially invisible — the GPU-bound forward pass dominates by orders of magnitude, and shaving milliseconds off tokenization won't move the needle on a chatbot's response latency.

But the same reply immediately narrowed the real audience: "Presumably there's a host of applications that just need to tokenize, though, and this would be great for." That's the actual use case — not inference serving, but the training-data pipeline stage, where billions of tokens get processed once, offline, before training ever begins, and where tokenization genuinely can dominate wall-clock time on large corpora. A 1,000x speedup on preprocessing an 11.9GB dataset is the difference between a pipeline step measured in minutes versus one measured in a day, particularly for smaller labs or independent researchers who don't have unlimited compute to throw at data prep.

A second commenter probed the specificity of the optimization: "Did you just way over-optimize for a specific CPU and tokenizer?" The project's own answer, quoted in the same reply, was the opposite: "No, I way over-optimized for every combination of these! The results are very consistent across CPU/tokenizer combinations" — a claim the three-chip-family benchmark spread lends some support to, even if independent verification across the fuller matrix of tokenizer types is still pending outside the project's own numbers.

Get breakdowns like this every day

The top Hacker News stories, unpacked — by email, Telegram, or RSS.

Next story · 15 of 18 Read more
🚀Tech

A Postgres guide told startups to normalize their schema first. HN said monitoring should come before that

Hatchet's Postgres survival guide walks startups from schema design through connection pooling to partitioning. The thread's sharpest critique came from someone who'd lived through the failure mode the guide skips: nobody notices transaction ID wraparound coming until the pager goes off on Boxing Day.

★ 368 · 💬 181 · hatchet.run · 4 min