8 November 2026

AI and agents, every day. Straight to it.

Hugging Face publishes tokenizers v1 preview with reworked encoding

The text-to-token library changes scratch memory, caching and parallel execution while targeting compatible output; published measurements cover Rust.

encode_batch is the documented route to encoding across CPU cores in the tokenizers v1 release candidate. Hugging Face’s write-up, dated September 21, 2026, describes an implementation overhaul intended to preserve existing token IDs.

Temporary memory is reused, and each thread caches previously encoded text fragments. Recognized splitting patterns take a bitstream path instead of passing through a regular-expression engine. Unrecognized patterns retain the regex implementation. The optimization therefore depends on the tokenizer’s pattern, not simply on installing a newer build.

The published batch example is:

let encodings = tokenizer.encode_batch(documents, false)?;

Source example and measurement method.

For a migration check, compare output IDs against the current version and use distinct documents drawn from the application’s workload. Repeatedly encoding one document gives the cache a different advantage from processing a stream of new material. The authors explicitly distinguish those conditions.

There is another boundary to keep in view: the reported measurements cover Rust. Python bindings use the underlying implementation but introduce per-call overhead excluded from those results. Faster encoding alone does not establish an equivalent improvement across an application’s entire processing path.

Lucas Ferraz

Code & open source.

Read articles by Lucas FerrazEditorial policy

Report an error

Use 10–1,000 characters; a reply email shares this space.

Next in your reading list