lilcom
Lossy-compression utility for sequence data in NumPy
What it is and what it does
lilcom is a lossy compression utility that encodes NumPy floating-point arrays into compact byte strings, trading accuracy for storage efficiency. It uses a regression-based algorithm that models each element relative to its neighbors, then quantizes and compresses the residuals. The core implementation is in C++, and the compression ratio is controlled by a tick_power parameter that sets the quantization step size; the default tick_power of -8 yields a maximum error of 1/512 per element. It is intended for machine learning workflows where storing large volumes of training data or model weights benefits from reduced disk footprint and memory usage.
The package requires numpy as its only runtime dependency and supports Python 3.6 and later. Installation via pip uses prebuilt wheels for modern Python versions (3.10–3.14) on common platforms, but building from source requires a C++ compiler. The repository is maintained but aging, with no recent feature development; it remains suitable for stable, production use in contexts where the compression trade-offs are acceptable.
Use it for:
- Store large training datasets on disk with reduced footprint while maintaining acceptable numerical precision for model training.
- Compress neural network model weights for efficient distribution and deployment in bandwidth-constrained environments.
- Archive historical experimental results and intermediate model checkpoints with controlled accuracy loss.
- Reduce memory usage when loading large arrays into RAM during batch processing or inference pipelines.
- Serialize floating-point data for transmission over networks where bandwidth is a bottleneck.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Lossily compresses floating-point NumPy arrays into byte strings with user-specified accuracy, designed for storing training data and models in machine learning workflows.
Yes, if you need lossy compression of NumPy arrays in machine learning contexts and can accept the accuracy trade-offs. The package is stable, has no known vulnerabilities, and carries a permissive MIT license. Install friction is moderate due to C++ compilation, but prebuilt wheels are available for modern Python versions. The aging maintenance status is not a blocker for stable use, but expect no active feature development.
Install
lilcom on PyPI
pip
pip install lilcomuv
uv add lilcompoetry
poetry add lilcomInstalling lilcom
Before you install
Medium install friction due to C++ compilation requirement. Package is aging (211 days since last release) but repository remains active with recent commits; maintenance status suggests limited ongoing development.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
import numpy as np
import lilcom
a = np.random.randn(300, 500)
a_compressed = lilcom.compress(a)
a_decompressed = lilcom.decompress(a_compressed)
Requires a C++ compiler (e.g., g++ or clang) to build from source; prebuilt wheels available for Python 3.10–3.14 on macOS, Linux, and Windows.
Verify before relying
- Typical compression ratio or file size reduction achieved in practice across different array types and sizes.
- Performance characteristics (compression/decompression speed) relative to alternative compression methods.
- Whether the tick_power parameter and resulting accuracy trade-offs are well-documented for different use cases.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | aging — 211 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 706,753/month — #5,270 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: lilcom-1.8.2-cp310-cp310-macosx_10_9_universal2.whl; lilcom-1.8.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lilcom-1.8.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lilcom-1.8.2-cp310-cp310-win_amd64.whl; lilcom-1.8.2-cp311-cp311-macosx_10_9_universal2.whl; lilcom-1.8.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lilcom-1.8.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lilcom-1.8.2-cp311-cp311-win_amd64.whl; lilcom-1.8.2-cp312-cp312-macosx_10_13_universal2.whl; lilcom-1.8.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lilcom-1.8.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lilcom-1.8.2-cp312-cp312-win_amd64.whl; lilcom-1.8.2-cp313-cp313-macosx_10_13_universal2.whl; lilcom-1.8.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lilcom-1.8.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lilcom-1.8.2-cp313-cp313-win_amd64.whl; lilcom-1.8.2-cp314-cp314-macosx_10_15_universal2.whl; lilcom-1.8.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; lilcom-1.8.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; lilcom-1.8.2-cp314-cp314-win_amd64.whl
Keywords: compression, numpy
Tags
More Compression packages
Provides Python bindings to the Brotli…
permissive · top 1,000 on PyPI
backports.zstdProvides Zstandard compression support for…
permissive · top 1,000 on PyPI
zopfliZopfli is a Python binding for Google's Zopfli…
permissive · top 1,000 on PyPI
python-snappyPython binding for Google's Snappy compression…
permissive · top 5,000 on PyPI
pyzipperpyzipper replaces Python's standard zipfile…
permissive · top 5,000 on PyPI
pyzstdProvides Python bindings to the Zstandard…
permissive · top 5,000 on PyPI
ml-dtypesml_dtypes provides NumPy-compatible data types…
permissive · top 1,000 on PyPI
python-neo-lzfProvides fast compression and decompression of…
permissive · top 15,000 on PyPI
pcodecPcodec compresses and decompresses numerical…
unclear · top 15,000 on PyPI
pylibjpeg-openjpegDecodes and encodes JPEG 2000 images to and…
permissive · top 15,000 on PyPI
pylercpylerc encodes and decodes raster image data…
permissive · top 15,000 on PyPI
pylibjpeg-libjpegDecodes JPEG and JPEG-LS images to NumPy…
copyleft · top 15,000 on PyPI
descript-audio-codecCompresses audio into discrete codes at 8 kbps…
permissive · top 15,000 on PyPI
lzstringCompresses and decompresses text using the…
permissive · top 15,000 on PyPI
encodecEnCodec is a neural audio codec that compresses…
noncommercial · top 15,000 on PyPI
tifffileRead and write TIFF files and TIFF-like formats…
permissive · top 1,000 on PyPI