Read-only mirror of https://github.com/epfl-dlab/zip2zip-compression — EPFL Data Science & AI Lab (dlab). Issues & pull requests at the source.
  • Rust 59.8%
  • Python 40.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
mxx28 2cc7f67582 Sync Cargo.lock version with Cargo.toml (0.3.3 -> 0.3.4)
The version bump in cc44ea8 only updated Cargo.toml, leaving
Cargo.lock out of sync.
2026-07-10 16:47:36 +02:00
.cargo add the continuous_batch_encode method and a config file to build the library on mac 2025-07-05 10:46:21 +02:00
.github/workflows Remove Python 3.14 from workflow matrices because missing pyo3 support 2025-11-14 18:06:12 +01:00
docs bump to v0.3.3 2025-07-13 12:26:58 +02:00
example fix and pass test_with_corpus.py 2025-06-18 14:41:50 +02:00
src fix the serialization issue with the disabled_ids set 2025-10-21 15:53:43 +02:00
tests remove pytorch for release 2025-07-13 12:21:50 +02:00
.gitignore Initial commit 2025-06-15 12:37:00 +02:00
.pre-commit-config.yaml add installation instruction in README 2025-06-15 14:29:13 +02:00
Cargo.lock Sync Cargo.lock version with Cargo.toml (0.3.3 -> 0.3.4) 2026-07-10 16:47:36 +02:00
Cargo.toml Bump version from 0.3.3 to 0.3.4 2025-11-14 18:32:02 +01:00
LICENSE Initial commit 2025-06-15 12:37:00 +02:00
pyproject.toml nits 2025-07-13 10:55:15 +02:00
README.md few comments 2025-07-12 23:00:31 +02:00
zip2zip_compression.pyi remove logging 2025-07-12 23:13:04 +02:00

zip2zip-compression

zip2zip: Inference-Time Adaptive Vocabularies for Language Models via Token Compression
Saibo Geng, Nathan Ranchin, Yunzhen Yao, Maxime Peyrard, Chris Wendler, Michael Gastpar, Robert West
Paper: https://arxiv.org/abs/2506.01084

About

This package provides a high-performance LZW compression library with Python bindings. It is designed to be used as part of the zip2zip project, where it provides efficient, high-performance compression capabilities.

We developed a new variant of the Lempel-Ziv-Welch (LZW) compression algorithm that doesn't need perfectly encoded input to decode. This allows the algorithm to decode (or decompress) generated sequences from a Large Language Model (LLM) without the need to store the entire compression codebook.

Installation

From PyPI

pip install zip2zip-compression

From source (Rust required)

Make sure you have the Rust toolchain installed.

pip install maturin
maturin build --release

Documentation

See the docs folder for more information:

Example Usage

You can find usage examples in the example folder.