Reproduction code and artifacts for the embedding probes used to study the learned geometry of zip2zip LZW hyper-tokens.
The repository covers the two experiments reported in the paper:
- Substitution probe: replace the first or last constituent of a hyper-token and measure how much its embedding changes.
- Sequence probe: compare embeddings of all contiguous sub-spans of a short sequence.
The paper-facing analyses use the raw final embeddings produced by the trained input and output hyper-encoders. The BPE experiment is a control measured directly on the pretrained input and output embedding tables.
For a span of length
Here,
On Phi-3.5-mini, the output hyper-encoder is strongly prefix-aligned
(
The sequence probe uses the four-token span It is a dog. Output embeddings
form blocks for spans that share a prefix, whereas input embeddings vary more
smoothly with constituent overlap.
| Experiment | Model / condition | Committed data | Rendered output |
|---|---|---|---|
| Substitution probe | Phi LZW hyper-tokens | data/substitution_phi.csv |
figures/substitution_phi_hyper_tokens.{pdf,png} |
| BPE base-table control | Phi-3.5-mini | data/substitution_phi.csv |
figures/substitution_phi_base_table_control.{pdf,png} |
| Substitution probe | Llama-3.2-3B, tied and untied | data/substitution_llama3B_*.csv |
figures/substitution_llama.{pdf,png} |
| Sequence probe | Phi LZW hyper-tokens | data/sequence_phi.csv |
figures/sequence_phi.{pdf,png} |
Install the dependencies, then point both probes at a model repository's
self-contained hf revision:
python -m pip install -r requirements.txt
python probe.py \
--repo-id epfl-dlab/zip2zip-pp-Llama-3.2-1B-Instruct \
--revision hf \
--name llama1b
python probe_base.py \
--repo-id epfl-dlab/zip2zip-pp-Llama-3.2-1B-Instruct \
--revision hf \
--name llama1bThe same commands work for the 3B, 4B, and 14B releases; only --repo-id
and --name change. The loader derives the encoder architecture and
vocabulary boundary from zip2zip_config.json. It downloads the encoder
weights and only the decoder shard(s) that contain the input/output embedding
tables, not the raw training checkpoint or full decoder in memory.
See docs/checkpoints.md for all four repository names and docs/reproduction.md for complete commands.
The committed CSV files are sufficient to render every paper figure; model weights are not needed for this step.
python -m pip install -r requirements.txt
python plot_phi_substitution.py
python plot_llama_substitution.py
python plot_sequence_probe.pySee docs/reproduction.md for end-to-end measurement commands and docs/checkpoints.md for public and legacy checkpoint formats.
enc_lib.py standalone hyper-encoder forward pass
probe.py LZW hyper-token measurements
probe_base.py BPE base-table control
prepare_paper_data.py export paper-facing CSV data
plot_phi_substitution.py render the Phi substitution plots
plot_llama_substitution.py render the Llama substitution plot
plot_sequence_probe.py render the sequence-probe heatmaps
data/ committed, paper-facing measurements
figures/ committed PDF and PNG outputs
results/ full measurement JSON for paper checkpoints
docs/ methods and reproduction instructions
weights/ local extracted checkpoints; ignored by Git
The measurement scripts retain auxiliary diagnostic fields in their JSON and generated reports for provenance and backwards compatibility. These fields are not used by the paper figures. Generated reports are ignored by Git.
The implementation is CPU-compatible and does not require the training codebase. End-to-end measurement requires enough RAM for the two embedding tables and access to the model repository and WikiText-2.