Drop-in replacement for tiktoken. Zig + hand-written assembly. ARM64, Metal GPU, WASM, AVX, CUDA, RISC-V. One library, every platform. tiktokenをそのまま置き換えるだけ。中身はZigと手書きアセンブリ。 ARM64、Metal GPU、WASM、AVX、CUDA、RISC-V。たった1つのライブラリで全プラットフォームに対応。
Every message you send to ChatGPT, Claude, or Gemini must be converted into numbers before the AI can read it. That conversion is called tokenization. It happens on every single API call, billions of times a day, across the entire industry. ChatGPTやClaude、Geminiにメッセージを送るたび、文章はまずAIが理解できる「数値」に変換されます。これがトークナイゼーション。すべてのAIリクエストの入口であり、1日に数百億回、世界中で実行されている処理です。
The world processes over 50 trillion tokens per day. OpenAI alone handles 6 billion tokens per minute. Google processes 1.3 quadrillion tokens per month. Every single one goes through a tokenizer. 世界全体で1日あたり50兆トークン以上が処理されています。OpenAIだけで毎分60億トークン、Googleに至っては月間1.3京トークン。この膨大な処理のすべてが、トークナイザーを通っています。
50T+ tokens/day globally 全世界で1日50兆トークン以上AI inference is a $106B market. 6.75x faster tokenization means ~62 million CPU-hours freed per year globally. On GPU instances where tokenization blocks the pipeline, that translates to $50-200M in recoverable infrastructure cost. AI推論は約16兆円規模の市場です。トークナイゼーションが6.75倍速くなるだけで、年間約6,200万CPU時間が不要に。GPUパイプラインのボトルネック解消分を含めると、年間75億〜300億円規模のインフラコスト削減につながります。
~62M CPU-hours saved/year 年間約6,200万CPU時間を削減AI data centers consume 415 TWh per year globally, and 80-90% of that is inference. Faster tokenization at full adoption could save millions of tonnes of CO2 per year. Performance is sustainability. 世界のAIデータセンターは年間415TWhの電力を消費し、その8〜9割が推論処理です。トークナイゼーションの高速化を全面的に導入すれば、年間数百万トン規模のCO2削減が見込めます。速さは、そのまま環境への貢献です。
415 TWh/year in AI inference AI推論だけで年間415TWh消費Think of it this way: tokenization is the toll booth on the highway to AI. Every request stops there. Making the toll booth 6.75x faster means the entire highway moves faster. For every person using AI, for every API call, for every company building on top of LLMs. たとえるなら。トークナイゼーションは、AIにつながる高速道路の料金所です。どんなリクエストも、必ずここを通る。この料金所を6.75倍速くすれば、道路全体の流れが変わります。AIを使うすべての人、すべての企業、すべてのサービスの体験が変わるのです。
Measured on 100KB encode, Apple M4 Max 100KBエンコード、Apple M4 Maxで計測
Linear-time backtracking BPE, not tiktoken's O(n²) greedy approach. 線形時間のバックトラッキングBPE。tiktokenのO(n²)貪欲法とは根本的に違います。
One codebase, native acceleration everywhere. ひとつのコードベースから、すべてのプラットフォームでネイティブ高速化。
Same API as tiktoken. Change one import line and get instant speedup. Byte-perfect output guaranteed. tiktokenとまったく同じAPI。import文を1行書き換えるだけで、即座に高速化。出力はバイト単位で完全一致を保証します。
Same Zig core compiles to wasm32. Runs in any browser, edge function, or serverless worker. 同じZigコアがそのままwasm32にコンパイル。ブラウザでもエッジでもサーバーレスでも動きます。
166x faster startup than js-tiktoken js-tiktokenより166倍高速な起動
Zero-overhead core. comptime-generated merge tables. Hand-written NEON/AVX hot loops for the last 5% of perf. オーバーヘッドゼロの設計。マージテーブルはコンパイル時に生成。残り5%の性能を絞り出すためにNEON/AVXのホットループは手書き。
Native bindings for every major language and runtime. 主要な言語とランタイムすべてにネイティブバインディングを提供。
Train your own tokenizer vocabularies. Beats rustbpe and minbpe on benchmarked workloads. 自前のトークナイザー語彙をトレーニング可能。ベンチマークではrustbpeもminbpeも上回ります。
Production-grade compute shaders for Apple Silicon. On-device BPE merge loop with active compaction. Apple Silicon向けの本番品質コンピュートシェーダー。アクティブコンパクション付きのオンデバイスBPEマージを実現。
Every number measured with Hyperfine. No hand-waving. No "approximately". すべての数値はHyperfineで実測。推測なし。曖昧な表現なし。
| Workload ワークロード | turbotoken | tiktoken | Speedup 高速化 |
|---|---|---|---|
| Encode 100KB エンコード 100KB | 43.4 ms | 215.9 ms | ~5.0x |
| Encode 1MB エンコード 1MB | 72.4 ms | - | - |
| Cold Startup コールドスタート | 64.4 ms | - | - |
| Count 100KB カウント 100KB | 44.5 ms | - | - |
| Browser Startup ブラウザ起動 | 8.5 ms | 1414 ms | ~166x |
| JS Native Encode 1MB JSネイティブエンコード 1MB | 9.83 ms | - | 101.75 MiB/s |
| GPU Long-lane 1MB GPU ロングレーン 1MB | 1.72x throughput boost 1.72倍スループット向上 | Metal | |
| Training 100KB トレーニング 100KB | 45.7 ms | 764.6 ms minbpe | ~16.7x |
All benchmarks: Apple M4 Max (16-core, 40 GPU), macOS Sequoia, Hyperfine v1.19+ 全ベンチマーク: Apple M4 Max(16コア、GPU 40基)、macOS Sequoia、Hyperfine v1.19+
Identical to tiktoken API tiktoken APIとまったく同じ
Browser + Node + Bun + Deno ブラウザ + Node + Bun + Deno
Also by the same author 同じ作者による別のプロジェクト
AssemblyClaw Pure assembly claw machine game 純粋アセンブリ言語で書かれたクレーンゲーム