Skip to main content Switch to mobile version xenocodec 0.4.0 XENO lossless compression for AI weights: BF16 at ~75%, bit-exact, 100 GB/s-class SIMD decode
pip install xenocodec==0.4.0 Copy PIP instructions
PyPI distribution: xenocodec (pip install xenocodec, then import xeno_py).
Python bindings for the XENO BF16 codec (core/xeno_cross.h), plus a small compressed tensor container and a vector index.
import numpy as np, xeno_py w = np.random.randn(16384 * 4).astype(np.float32) # any float32 tensor xeno_py.save("w.xn16", w) # BF16 + XENO, bit-exact back = xeno_py.load("w.xn16") # float32 (BF16 projection) What it is, honestly:
compress_bf16 / decompress_bf16 are lossless on the BF16 payload: the roundtrip is memcmp == 0 on uint16 BF16 values.
save / load convert float32 to BF16 first (round-to-nearest-even), so a float32 tensor comes back as its BF16 projection, not bit-identical float32. That projection is the only loss, and it is the same bijection the C core uses.
Each 16384-weight block picks the smallest of three encodings: v7 (fixed 4-bit exponent codes), v7e (the 16-symbol code stream range-coded with a per-block model) or raw. Incompressible input can no longer expand.
Measured here (2 MiB, best of 3), gaussian weights: 66.17% vs zlib -9 79.46% / lzma 71.76%, close to the 65.38% BF16 Shannon bound (Codex v2.0, section 4.1). v7 alone is 75.13%. Uniform random BF16: 100.05% (v7 alone: 216.21%). proof.png bytes: 100.05% (v7: 186.09%).
Trade-off, measured: the entropy-coded block decodes at ~0.47 GB/s here versus ~3.8 GB/s for v7, because v7e uses a scalar range coder. compress_bf16_v7 / decompress_bf16_v7 keep the fast fixed format when speed matters more.
VectorDB keeps normalized vectors compressed on disk and materializes them for the search pass. The GEMV-on-compressed path is not wired here yet.
The package loads a prebuilt xeno_core.dll shipped inside xeno_py/ on Windows. On Linux it compiles the bundled header-only xeno_cross.h with gcc on first import (AVX2 + OpenMP required), caching the .so next to the package or in the system temp dir. In the repo it also falls back to core/.
Install from the repo: pip install ./xeno_py (needs numpy for the tensor API).
Benchmark (bit-exactness is asserted, ratio is compared to zlib -9 and lzma):
python xeno_py/benchmarks/bench.py Key dates
Released: Dec 5, 2026
Author: Romain Abdel-Aal
Programming Language Python :: 3
Topic System :: Archiving :: Compression
Release files for xenocodec 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
Release files / xenocodec-0.4.0-py3-none-any.whl
Security for xenocodec 0.4.0
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 5, 2026 1 release file No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











