Skip to main content

xeno_py

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

Metadata

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)

Table of built distributions (wheels) for xenocodec 0.4.0
File Interpreter ABI Platform Actions
xenocodec-0.4.0-py3-none-any.whl Python 3 none any Details for xenocodec-0.4.0-py3-none-any.whl

Release files / xenocodec-0.4.0-py3-none-any.whl

Download URL xenocodec-0.4.0-py3-none-any.whl
Size 164.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68045912450fc609826b3e41f5f011b1dde07d6a3600703da711fcfa8ce03fe2
BLAKE2b-256 checksum
How to use checksums
9600c9b62317efd202c5c716b02f2c2ccbe1435aac9822b2be392db536cf036a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.4

Security for xenocodec 0.4.0

Provenance

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.

No provenance found

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

This release

0.4.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page