Hugging Face engineers make BERT tokenization 50x faster by skipping ASCII
art_zucker · x · 2026-10-15
Hugging Face engineer Simon Brandeis details how the team made BERT-like model tokenization up to 5.7x faster on top of the tokenizers library overhaul — roughly 50x faster than v0.23 in total (changes still in PR stage).
Context
- The team has been reviving the 🤗 tokenizers library targeting higher encoding throughput and a smaller footprint, heading toward a v1.0.0 release.
- BPE tokenizers (used by most LLMs) are already up to 30x faster than v0.23; WordPiece (BERT-style) only got 8.6x, which the author set out to fix.
Why BERT matters
BERT-like encoders power embeddings, search, RAG, rerankers, and classifiers. The three most-downloaded models on the Hub (all-MiniLM-L6-v2 at 218M monthly downloads, ms-marco-MiniLM-L6-v2 at 79M, bge-small-en-v1.5 at 59M) all use BERT's normalizer; across the top 10,000 models, WordPiece accounts for 627M monthly downloads.
Key technique
As the title hints, skipping ASCII-related processing in BERT's normalizer was the key to the extra 5.7x speedup, alongside other engineering optimizations.
Related event: Hugging Face tokenizers v1.0 push: BERT tokenizer gets ~50x faster(7 posts)→
More from Infra
- Nearly a third of WordPress sites run PHP with no security fixes; half by January 1 — JeremyCMorgan · 2026-12-02
- Data center water panic traced to botched numbers: key figure off by 1,000x — ATTlKA · 2026-12-02
- NVIDIA and SpaceX unveil Kyber Galaxy, a space-based AI supercomputer with 72 Rubin GPUs — elonmusk · 2026-12-02
- Export controls may widen US-China AI gap by only 2-3 months, argues analyst — kevinnbass · 2026-12-02
- Amazon Ergo enters most attractive quadrant at $1.64 per Intelligence Index task — ArtificialAnlys · 2026-12-02
- Amazon Ergo takes open-weights crown: 38 on AA Index, 1.1T params (55B active) — ArtificialAnlys · 2026-12-02