Skip to content
Tech News
← Back to articles

GigaToken: ~1000x faster Language model tokenization

read original more articles
Why This Matters

Gigatoken revolutionizes language model tokenization by offering approximately 1000 times faster performance than existing solutions like HuggingFace's tokenizers, enabling rapid processing of large text datasets. Its compatibility with popular tokenizers and support for multithreaded Rust implementation make it a significant advancement for both researchers and industry practitioners seeking efficiency gains in NLP workflows.

Key Takeaways

Gigatoken

~1000x faster than HuggingFace's tokenizers, drop-in replacement. Tokenize your text data at GB/s! Note that both HF tokenizers and tiktoken are already running multithreaded Rust!

What is Gigatoken?

Gigatoken is the fastest tokenizer for language modeling. It supports a wide range of CPU hardware, and nearly all commonly used tokenizers. See the Benchmarks section for detailed throughput numbers across tokenizers and CPUs.

Installation

pip install gigatoken

Usage

Gigatoken can be used with its own API, or in compatibility mode with HuggingFace Tokenizers or Tiktoken.

Compatibility Mode (Easiest)

import gigatoken as gt # Minimum change from existing HuggingFace tokenizers usage (compatibility mode) hf_tokenizer = ... tokenizer = gt . Tokenizer ( hf_tokenizer ). as_hf () # tokenizer can be used in the same contexts as hf_tokenizer tokens = tokenizer . encode_batch ([ "This is a test string" , "And here is another" ]) # OR with tiktoken tiktokenizer = ... tokenizer = gt . Tokenizer ( tiktokenizer ). as_tiktoken () # Now works like existing tiktoken tokenizers tokens = tokenizer . encode_batch ([ "This is a test string" , "And here is another" ])

... continue reading