pi-quant: Prime Intellect Fast Quantization Library
Overview
Fast, multithreaded CPU quantization kernels with various rounding modes, outperforming PyTorch’s built-in quantization routines by more than 2 times on all tested hardware. The kernels are optimized with SIMD intrinsics for different CPU architectures, including AMD64 (SSE4.2, AVX2, AVX512F) and ARM64 (Neon). The most optimal kernel is selected at runtime using runtime CPU detection.
What is Quantization?
Quantization is the process of mapping continuous values into a finite, discrete set of values. In machine learning and signal processing, it is commonly used to reduce the precision of numerical data, lowering memory usage and improving computational efficiency while maintaining acceptable accuracy.
Features
✅ Parallel De/Quantization: Efficiently quantizes and de-quantizes data using multiple threads.
✅ Rich Datatype Support: Provides f32, f64 ↔ (u)int8/16/32/64.
✅ Modern Python API: Use the library from Python with PyTorch, numpy or standalone.
✅ Architecture-Specific Optimizations: The kernels are optimized with SIMD intrinsics for different CPU architectures, including AMD64 (SSE4.2, AVX2, AVX512F) and ARM64 (Neon).
✅ Thread Pool: Reuses threads for minimal overhead.
✅ Flexible Rounding Modes: Supports both nearest and stochastic rounding modes.
✅ C99 API: Provides a C99 API for C projects or foreign language bindings (see quant.h).
✅ Store Operators: Supports multiple store modes (SET, ADD) during dequantization — useful for ring-reduction operations.
✅ Quantization Parameters: Efficient SIMD-parallel computation of quantization scale and zero point from input data.
Benchmarks
Benchmark
The benchmarks were run on a variety of hardware. We benchmark against PyTorch’s torch.quantize_per_tensor and **torch.ao.quantization.fx._decomposed.quantize_per_tensor**. Each benchmark quantized float32 to uint8 across 1000 runs. The number of elements and other details can be seen in the benchmark code.
Benchmark 1 (AMD EPYC 9654, 360 vCPUs)
1000 runs with numel 27264000
CPU: AMD EPYC 9654 96-Core Processor, Runtime: AVX512-F
Memory: 1485 GB
Linux: 6.8.0-57-generic
Torch FX Quant refers to torch.ao.quantization.fx._decomposed.quantize_per_tensor,
Torch Builtin Quant to **torch.quantize_per_tensor** and Fast Quant to pi-quant’s piquant.quantize_torch.
Benchmark 2 (AMD EPYC 7742, 128 vCPUs)
1000 runs with numel 27264000
CPU: AMD EPYC 7742 64-Core Processor, Runtime: AVX2
Memory: 528 GB
Linux: 6.8.0-1023-nvidia
Benchmark 3 (Apple M3 Pro)
1000 runs with numel 27264000
CPU: Apple M3 Pro, Runtime: Neon
Memory: 18 GB
OSX: 15.4 (24E248)
Metadata
Release files for pypiquant 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 8.2 MB
Release files / pypiquant-4.1.0-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
e0f7d5ae8c81f782f2d24a47b142cb841f4a4064f8262d084e984c2b770637f5
|
|
BLAKE2b-256 checksum How to use checksums |
eb8a98ac37d049cece02668f89e7a0ceab74b2d0eda36424bbeffd2cc7f67a3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
39661ab80a8b5b09f74f9a13ae1238b53a6b783ecc149199df7717771f762a89
|
|
BLAKE2b-256 checksum How to use checksums |
07489a007d4d788e97309080fef59e702c599e13562522f9e851761753d615f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
e1fa33354fb816cfb4ad680f8173d50d163cbc8c89009a9e439e96a8fb7e7477
|
|
BLAKE2b-256 checksum How to use checksums |
94874f4464bae9b4cfa53d004bf60b9ccb06f81d68cf52f2a9266f2ed99ee4f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
16f6d458b3cc5ee89b6ba85cb0d25872a17631acdd62f6a342d47bebfadb7487
|
|
BLAKE2b-256 checksum How to use checksums |
5dec0949f37e627106779aa7e1349f01bf5045bf9530f690342d224abc9f8da0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp311-cp311-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
6618c2c5ac33e43492f8683d30f7b7b3b01b4cc488ffb5a7e80f6c6df98dbc11
|
|
BLAKE2b-256 checksum How to use checksums |
e75901a4f447caa93709c535dfaed27bcbc521ac016b47f4e1997b8bc87d8fdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
27f3e25f3d51e6ad5ccf46facffccbcf66f1b402a49c1cb5d278c65b4c066528
|
|
BLAKE2b-256 checksum How to use checksums |
a916e543dc5a83f3afd45df7faa98862fa9a1714e89c55b5a2815670461d551a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp310-cp310-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp310-cp310-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
c73999588f226686afa420a350db0dfc04ca71a0f17ec7c276f5c0afa0013495
|
|
BLAKE2b-256 checksum How to use checksums |
bb05dd5daaeb5cddee760858644db1f2780ece4d57631932a8a646671f45be77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a8a2737e61385fa0918cd89eb9cf5214fe2f5db25dd435a6a51c0615f726c957
|
|
BLAKE2b-256 checksum How to use checksums |
3a847dc5e38fc8c12af13003fcf11f3882c442dca7c5a448c0452253ed7cbb48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp39-cp39-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp39-cp39-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
51dcf144998851fe5f0a7b0e0cf22a7e26f37f2b68bc4b4ea28a2b7fcb96fb2a
|
|
BLAKE2b-256 checksum How to use checksums |
f1135cc43af65d26d64818a0befbc5985980e7e69ff90b75d98c2ab250c67947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
29682045decf2cd7bbd4815f38a170af9a0e8f7345e9768120ba63d8ca1cba03
|
|
BLAKE2b-256 checksum How to use checksums |
f94ddd0247fe35fd2ae60cf78b720ca74c6079d1f54c02ae5535b0ab1b19fd5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp38-cp38-musllinux_1_2_x86_64.whl
| Download URL | pypiquant-4.1.0-cp38-cp38-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
1375c225414910da4c540039ea473f4f4daff7da268a1fe51598e2e0ba9bd207
|
|
BLAKE2b-256 checksum How to use checksums |
7f29cc556c15e435296ae1f1ddf5d8154b7c0d01a69054c7e83056b526cb7b60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / pypiquant-4.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypiquant-4.1.0-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 173.3 kB |
| Tags | CPython 3.8 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
09b9fc21c0ff905f9265cfeaf54e35a09419eb3b3ec519be1d1d92c60f72f561
|
|
BLAKE2b-256 checksum How to use checksums |
71b52a861415dc86dd1524a00a654a4af85b40b6aa5c88ca395bf4c221575d88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Security for pypiquant 4.1.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.