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은 세 가지 주요 구성 요소로 이루어져 있습니다: (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.