Pure Python implementation of the ALP (Adaptive Lossless floating-Point) compression algorithm.
Based on: Afroozeh & Boncz, "ALP: Adaptive Lossless floating-Point Compression", ACM SIGMOD 2024. (paper · pdf)
Python port of the QTSurfer/alp-java reference implementation. Bit-exact byte-level compatibility with alp-java — files written by either implementation can be read by the other.
Bit-exact aligned with alp-java — encode + decode round-trip verified against fixtures emitted by the Java reference. See the PyPI badge above for the latest version.
pip install alp-codecimport numpy as np
from alp import encode, decode
values = np.array([65007.28, 65007.31, 65007.30, 65007.32], dtype=np.float64)
# Encode to bytes
blob = encode(values)
# Decode back to a NumPy float64 array
recovered = decode(blob)
assert np.array_equal(values, recovered)ALP applies semantic compression to decimal floating-point arrays. For a typical financial price column at 2 decimal places it reaches 3-4 bits per value — about an order of magnitude better than Gorilla XOR or block-compressed PLAIN encodings.
The algorithm picks an (e, f) pair per block such that value × 10^e × 2^-f is exactly representable as a small int64, encodes the integers via Frame-Of-Reference + bit-packing, and stores any non-conforming values as outliers with a position list.
| Language | Repo | Status |
|---|---|---|
| Java | QTSurfer/alp-java | Reference |
| Python | QTSurfer/alp-py | This repo |
Copyright 2026 Wualabs LTD. Apache License 2.0 — see LICENSE.