Downloads · 30 days
0
epfl-dlab/zip2zip-Phi-3.5-mini-instruct-v0.1
zip2zip-Phi-3.5-mini-instruct-v0.1 is a text generation model from epfl-dlab. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
[](https://www.python.org/) [](https://arxiv.org/abs/2506.01084) [](https://huggingface.co/collections/epfl-dlab/zip2zip-models-6852ec90f3dacc02aa6a0dca)
Downloads · 30 days
0
Access
Public
Updated Nov 10, 2025
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.safetensors1 GB · 100%
From the Hugging Face model README
Zip2Zip brings inference-time adaptive tokenization to large language models (LLMs) using online LZW token compression.
Instead of relying on a fixed vocabulary, Zip2Zip dynamically merges frequently co-occurring token sequences into hypertokens during inference.
This allows the model to adapt its vocabulary to each context, reducing the number of tokens needed and thus speeding up generation.
microsoft/Phi-3.5-mini-instructThis model was uptrained from microsoft/Phi-3.5-mini-instruct using parameter-efficient finetuning (LoRA) for ~10 GPU-hours.
During uptraining, the model learned to operate on LZW-compressed sequences while preserving semantic reconstruction via an auxiliary autoencoding loss.
This allows it to generate and interpret hypertokens seamlessly during inference.
pip install zip2zip
Same API as Hugging Face
import torch
from zip2zip import Zip2ZipModel, Zip2ZipTokenizer
pretrained_model_url = "epfl-dlab/zip2zip-Phi-3.5-mini-instruct-v0.1"
device = "cuda" if torch.cuda.is_available() else "cpu"
tokenizer = Zip2ZipTokenizer.from_pretrained(pretrained_model_url)
model = Zip2ZipModel.from_pretrained(pretrained_model_url, device_map=device)
inputs = tokenizer("Write a MultiHeadAttention layer in PyTorch", return_tensors="pt").to(device)
outputs = model.generate(**inputs)
print(tokenizer.color_decode(outputs))
Quantized inference
model = Zip2ZipModel.from_pretrained(pretrained_model_url, device_map="auto", load_in_8bit=True)
@misc{geng2025zip2zipinferencetimeadaptivetokenization,
title={zip2zip: Inference-Time Adaptive Tokenization via Online Compression},
author={Saibo Geng and Nathan Ranchin and Yunzhen yao and Maxime Peyrard and Chris Wendler and Michael Gastpar and Robert West},
year={2025},
eprint={2506.01084},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2506.01084},
}