zip2zip: トークン圧縮による言語モデルの推論時適応語彙
zip2zip: Inference-Time Adaptive Vocabularies for Language Models via Token Compression
June 1, 2025
著者: Saibo Geng, Nathan Ranchin, Yunzhen yao, Maxime Peyrard, Chris Wendler, Michael Gastpar, Robert West
cs.AI
要旨
トークン化効率は、大規模言語モデル(LLM)の性能とコストにおいて重要な役割を果たすが、ほとんどのモデルは汎用コーパス向けに最適化された静的なトークナイザーに依存している。これらのトークナイザーの固定された語彙は、ドメイン固有または言語固有の入力に適応できないことが多く、結果としてトークン列が長くなり、計算コストが高くなる。本論文では、zip2zipというフレームワークを紹介する。このフレームワークは、推論時にLLMが動的にトークン語彙を調整できるようにし、生成されるトークン数を減らすことで推論を高速化する。zip2zipは、以下の3つの主要なコンポーネントで構成される:(1)Lempel-Ziv-Welch(LZW)圧縮に基づくトークナイザー。これは、トークンを再利用可能な「ハイパートークン」に逐次圧縮する。(2)新しく形成されたハイパートークンの埋め込みを実行時に計算する埋め込み層。(3)ハイパートークン化された圧縮シーケンス上で動作するようにモデルを訓練する因果的言語モデリングの変種。既存のLLMは、パラメータ効率的なファインチューニングにより10 GPU時間でzip2zip化できることを示す。結果として得られるzip2zip LLMは、推論時にハイパートークンを効果的に使用することを学習し、入力および出力シーケンスの長さを20~60%削減し、推論遅延を大幅に改善する。
English
Tokenization efficiency plays a critical role in the performance and cost of
large language models (LLMs), yet most models rely on static tokenizers
optimized for general-purpose corpora. These tokenizers' fixed vocabularies
often fail to adapt to domain- or language-specific inputs, leading to longer
token sequences and higher computational costs. We introduce zip2zip, a
framework that enables LLMs to dynamically adjust token vocabulary at inference
time, allowing for fewer generated tokens and thus faster inference. zip2zip
consists of three key components: (1) a tokenizer based on Lempel-Ziv-Welch
(LZW) compression that incrementally compresses tokens into reusable
"hypertokens" on the fly; (2) an embedding layer that computes embeddings for
newly formed hypertokens at runtime; and (3) a causal language modeling variant
that trains the model to operate on hypertokenized, compressed sequences. We
show that an existing LLM can be zip2zip-fied in 10 GPU-hours via
parameter-efficient finetuning. The resulting zip2zip LLMs effectively learn to
use hypertokens at inference time, reducing input and output sequence length by
20-60\%, with significant improvements in inference latency.