*A real playground.py session: a held-out function comes back byte-identical from 42 continuous vectors, then answers a question straight from the same vectors (CPU run, waits trimmed).*
Write-up: readcc.net/posts/exactlatents
exactlatents compresses Python functions into continuous latent vectors that a fine-tuned decoder reads in place of source tokens, then reconstructs never-seen code byte-identically. The encoder, learned projector, and Qwen3-1.7B decoder expose a compact continuous interface while keeping exact source recovery as the primary metric.
577/600 code-exact and 527/600 byte-exact on 600 post-cutoff out-of-distribution functions, using about 3.7× fewer decoder context slots.
The released weights are hosted on Hugging Face. From the repository root:
uv sync
hf download labguy/exactlatents-qwen3-1.7b --local-dir weights/
uv run playground.pyThe download supplies weights/model.safetensors and weights/projector_ema.safetensors.
| Evaluation | Released checkpoint | Comparison | Evidence |
|---|---|---|---|
| OOD-600, post-cutoff Python functions | 527/600 byte-exact; 577/600 code-exact at 3.73× fewer decoder context slots | Same-set fine-tuned text-copy: 565/600 byte-exact; 584/600 code-exact | Results · OOD receipts · control receipts |
| Canary development set | 30/36 byte-exact; 35/36 code-exact | Model-selection set, not the headline OOD evaluation | Results · canary receipts |
| Fully OOD function QA | 39.0% with latents | 39.6% with full text; statistically indistinguishable | Results · QA receipts |
| General-task retention spot-check | 19/24 | Stock Qwen3-1.7B: 24/24 | Results · retention receipts |
The reduction ratios above count decoder context slots and corresponding KV-cache entries, not stored bits. A 2,048-dimensional bf16 latent vector is roughly a 500× bit expansion over a token ID, so this is not a claim of bit-level compression. The QA result is statistical parity, not an improvement over text. All reported measurements use a single seed, one language (Python), and one base model (Qwen3-1.7B).
compressor/— model, latent projection, generation, and exactness APIstrain/— training entry points and configurationeval/— reconstruction, QA, controls, and analysis entry pointsdataset/— corpus construction and evaluation-set toolingdocs/— method, training, and result documentationreceipts/— published JSONL evidence grouped by evaluationdata/— shipped evaluation inputsweights/— downloaded checkpoint and projector weights
Please cite both this repository and the Qwen3 base model:
@software{exactlatents2026,
author = {{LabGuy94}},
title = {exactlatents: Exact Python Reconstruction from Continuous Latents},
year = {2026},
url = {https://github.com/LabGuy94/exactlatents}
}
@misc{qwen3_technical_report,
author = {{Qwen Team}},
title = {Qwen3 Technical Report},
year = {2025},
eprint = {2505.09388},
archivePrefix = {arXiv},
url = {https://huggingface.co/Qwen/Qwen3-1.7B}
}Trained on 8xH100 with the gracious support of givemeanode.
Apache License 2.0. See LICENSE.
