Tokenizers

Fast, production-grade tokenizer implementations for NLP and LLMs, written in Rust

Library
Cargo
v0.23.2
11,018stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity80
Maintenance88
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture87
Code Quality88
Innovation85
Learning Curve78

Tokenizers is Hugging Face’s Rust implementation of today’s most widely used text tokenization algorithms — BPE, WordPiece, Unigram, and byte-level variants — built for training new vocabularies and encoding text at very high throughput. The core library is written entirely in Rust for speed and memory efficiency, with official bindings for Python, Node.js, and (community-maintained) Ruby, so the same fast tokenizer implementation can be trained and used consistently across a project’s Rust services and Python/JS model pipelines.

It underlies tokenization for the Hugging Face transformers ecosystem and countless independent NLP/LLM projects, handling not just encoding but the surrounding pipeline: normalization, pre-tokenization, truncation/padding, special-token insertion, and alignment tracking back to the original text so token-to-character offsets are always recoverable.

What You Get

  • Rust implementations of BPE, WordPiece, Unigram, and byte-level BPE tokenizer algorithms
  • Vocabulary training from raw text corpora, not just inference on pretrained vocab files
  • Official Python and Node.js bindings (plus a community Ruby binding) sharing the same Rust core
  • Composable pipeline stages: normalizers, pre-tokenizers, models, and post-processors that can be mixed and matched
  • Offset/alignment tracking so every output token maps back to its exact position in the original string
  • Built-in truncation, padding, and special-token handling for feeding models directly

Common Use Cases

  • Tokenizing training and inference text for transformer-based language models at high throughput
  • Training a custom BPE/WordPiece/Unigram vocabulary for a domain-specific or non-English corpus
  • Sharing one tokenizer implementation across a Python training pipeline and a Rust/Node.js production inference service
  • Recovering exact character offsets for named-entity recognition or span-extraction tasks that need token-to-text alignment

Under The Hood

Architecture The crate’s Rust source under tokenizers/src/ is organized around a Tokenizer struct defined in tokenizer/mod.rs (nearly 1,900 lines) that orchestrates a pipeline of normalizers/, pre_tokenizers/, models/ (the actual BPE/WordPiece/Unigram/WordLevel algorithms), and processors/ (post-processing such as adding special tokens), each implemented as a trait so stages are swappable; decoders/ mirrors this for turning token ids back into text. lib.rs re-exports the public surface and wires the crate together, while the bindings/python and bindings/node directories wrap this same core via PyO3/napi so all language bindings share one battle-tested implementation rather than reimplementing tokenization logic per language. Tech Stack Pure Rust (edition 2018) at the core with no heavyweight runtime dependencies, using PyO3 for the Python binding and napi-rs/N-API for the Node.js binding; the crate is published to crates.io as tokenizers and to PyPI as the tokenizers package (via the Python binding), keeping one source of truth. Code Quality Testing is extensive and multi-layered: tests/ includes training.rs, serialization.rs, offsets.rs, unigram.rs, added_tokens.rs, and a documentation.rs test that verifies README examples actually compile and run, plus a common/ shared-fixture module; CI runs a dedicated Rust workflow (badge referenced in the README) on every push. API Design The public API centers on a small number of composable builder types (Tokenizer::new, .with_normalizer, .with_pre_tokenizer, .encode/.encode_batch, .train) that read as a clear declarative pipeline, and the crate ships runnable examples/ (encode_batch.rs, serialization.rs) alongside the documentation tests, keeping the learning curve low despite the algorithmic complexity underneath.

Used by 15 apps in this directory

Python
100%
Apache 2.0

Agno

Devops · AI Development · Automation

42,074

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python100%
Updated yesterday
C
59%
Apache 2.0

Colibri

AI Development · Developer Tools

26,959

A pure-C, zero-dependency inference engine that runs GLM-5.2's 744-billion-parameter mixture-of-experts model on consumer hardware with roughly 25GB of RAM by streaming experts from disk like a JIT compiler stages hot code.

View details
83
Repo Health
86
Technical
77
Dependency
Built with
C59%
Python28%
Updated yesterday
Python
100%
GPL 3.0

ComfyUI

AI Design Tools · AI Development

131,801

The most powerful node-based AI workflow engine for creating images, video, 3D models, and audio with full control over every generation step.

View details
92
Repo Health
81
Technical
75
Dependency
Built with
Python100%
Updated today
Python
67%
Apache 2.0

GPT Researcher

Productivity · AI Assistants

29,319

The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.

View details
90
Repo Health
91
Technical
63
Dependency
Built with
Python67%
TypeScript20%
Updated 1 weeks ago
Python
81%
Apache 2.0

headroom

AI Development · Developer Tools

69,144

Compress everything your AI agent reads — tool outputs, logs, RAG chunks, and files — before it reaches the LLM, achieving 60–95% fewer tokens with the same answers.

View details
84
Repo Health
86
Technical
72
Dependency
Built with
Python81%
Rust13%
Updated yesterday
TypeScript
91%
Apache 2.0

Helicone

Monitoring · AI Development · Analytics

6,133

An open-source AI gateway and LLM observability platform that routes requests to 100+ models while logging cost, latency, and full traces for every call.

View details
69
Repo Health
81
Technical
65
Dependency
Built with
TypeScript91%
Updated 1 weeks ago
TypeScript
65%
Apache 2.0

Laminar

AI Development · Monitoring

3,230

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
69
Dependency
Built with
TypeScript65%
Rust33%
Updated yesterday
Rust
40%
Apache 2.0

LanceDB

Databases · AI Development

11,366

Open-source, embedded vector database built on the Lance columnar format for fast multimodal search across billions of vectors, backed by Y Combinator (W23).

View details
90
Repo Health
86
Technical
72
Dependency
Built with
Rust40%
HTML26%
Python26%
Updated yesterday
Python
84%
MIT

LiteLLM

AI Development · Developer Tools

58,169

Open source AI gateway and Python SDK that gives you one OpenAI-compatible interface to call 100+ LLM providers, with built-in routing, cost tracking, guardrails, and virtual keys.

View details
92
Repo Health
81
Technical
69
Dependency
Built with
Python84%
TypeScript13%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search