zip2zip++: Towards Inference-Time Token Compression with Minimal Quality Loss

Saibo Geng, Andrea Gentilini, Xinxian Ma, Nathan Ranchin, Yunzhen Yao, Robert WestarXiv 2026

TL;DR

zip2zip++ is an advanced framework for inference-time token compression that allows Large Language Models (LLMs) to process text using up to 40% fewer tokens with minimal quality loss. By identifying and fixing fundamental architectural mismatches in how dynamic vocabularies interact with embeddings and positional encodings, the authors halve the performance gap between compressed and uncompressed models, particularly in mathematical reasoning.

What Problem Does This Paper Address?

Modern LLMs rely on fixed vocabularies (like BPE) that are often suboptimal for specific domains, repetitive data, or structured text (like code and math), leading to "over-segmentation." This wastes compute, increases latency, and shrinks the effective context window.

Dynamic vocabularies, which merge tokens on-the-fly using algorithms like Lempel-Ziv-Welch (LZW), offer a solution by representing the same text in fewer tokens. However, previous attempts (like the original zip2zip) suffered a significant "quality tax"—a sharp drop in reasoning ability and increased perplexity. This paper investigates why this happens and provides a recipe to fix it without retraining the entire base model.

Methods

The authors introduce four key improvements to the zip2zip pipeline:

  1. Decoupled Input/Output Embeddings: They discovered that LZW's prefix-closed nature creates a conflict. Output embeddings naturally want to cluster by shared prefixes, while input embeddings perform better when they represent the entire token span equally. zip2zip++ unties these layers to allow for these incompatible geometries.
  2. Residual Hyper-encoder with Identity Initialization: To create embeddings for new "hypertokens" (merged sequences), they use a small transformer called a hyper-encoder. They found that random initialization caused a massive "scale mismatch" shock during training. By using a residual connection and zero-initializing the encoder, hypertokens start as their first constituent token, leading to much smoother optimization.

    Identity initialization removes the early loss shock and improves final accuracy.
  3. Size-Aware RoPE: Standard Rotary Positional Embeddings (RoPE) treat every token as one step. Merging tokens shifts the positions of all subsequent text, distorting the model's sense of distance. zip2zip++ assigns positions based on the actual span of base tokens covered (e.g., using the "end" position of the span), preserving relative distances.

  4. Fault-Tolerant LZW (FT-LZW) & Digit Protection: Standard LZW is brittle; if a probabilistic LLM "under-merges," the dictionary gets out of sync. FT-LZW uses a guarded merge loop to recover from such errors. Crucially, it also "protects" digits from being merged, as merging numbers was found to be the single largest source of reasoning degradation.
  5. Multi-View Perplexity: Because one string can be segmented in many valid ways under a dynamic vocabulary, standard evaluation metrics are often too harsh. They propose a metric that sums probability over all valid segmentations using a novel tree-attention mechanism.

Datasets

The researchers evaluated their methods across four model scales: Phi-3.5-mini (3.8B), Phi-3-medium (14B), and Llama-3.2 (1B and 3B).

  • Training: Models were fine-tuned on a 1B-token instruction mixture (chat, math, code, and web text).
  • Evaluation: Perplexity was measured on WikiText-2, The Pile, mC4, and dC4. Reasoning and downstream tasks were tested using GSM8K, MATH-500, HumanEval, IFEval, and RULER (for long context).

Key Insights and Ideas

  • The Prefix-Aligned Conflict: Figure 1 illustrates how LZW forces output embeddings into a "chain" where tokens sharing a prefix compete at the same position. This "prefix-aligned geometry" is essential for the output side but detrimental for the input side, which needs a more "balanced" representation of the whole token span.

    LZW induces prefix-aligned output codes, creating a conflict for shared embeddings.
  • Digits are Fragile: The most surprising finding was that simply preventing the LZW codec from merging digits recovered the majority of the lost mathematical reasoning performance.

  • Scale Mismatch is a Silent Killer: Randomly initialized hyper-encoders produced vectors with norms ~54x larger than base tokens. This "out-of-distribution" shock is what caused the massive quality drops in earlier work.

Key Results

  • Halving the Quality Gap: zip2zip++ closes roughly half the quality gap between the original zip2zip and uncompressed baselines.
  • Reasoning Boost: On Phi-3.5-mini, GSM8K accuracy jumped from 0.36 (zip2zip) to 0.68 (zip2zip++), coming close to the 0.75 uncompressed baseline while still saving 20% of tokens during generation.
  • Perplexity Gains: The model showed lower perplexity across all tested corpora compared to the original zip2zip recipe.
  • Long Context Recovery: At 3.8B scale, it raised 4K context accuracy from 46.6% to 70.7% (vs. 86.4% uncompressed).

Limitations and Future Work

While zip2zip++ makes huge strides, a performance gap still remains. Specifically:

  • Task-Specific Gaps: Improvements were less pronounced in code generation (HumanEval) and instruction following (IFEval), where compression still costs 25-26 points in accuracy.
  • Overhead: The hyper-encoders and the LZW codec add computational overhead per step, though the authors argue this is offset by the reduction in total autoregressive steps.
  • Future Directions: The authors suggest that longer pre-training on compressed text and exploring why code generation is so sensitive to compression are promising next steps.

Summary updated

BibTeX
@misc{geng2026zip,
  author = {Saibo Geng and Andrea Gentilini and Xinxian Ma and Nathan Ranchin and Yunzhen Yao and Robert West},
  title = {{zip2zip++: Towards Inference-Time Token Compression with Minimal Quality Loss}},
  year = {2026},
  eprint = {2610.13605},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.13605},
}
Figure