Near-optimal vector quantization. Zero training. Instant indexing.
Five guarantees that make BitPolar unique among quantization libraries.
No training, no calibration, no data access needed. Works on any distribution out of the box.
Four integers define the entire quantization. Same input always produces the same output.
E[estimate] = exact inner product. Mathematical guarantee, not just empirical observation.
Within 2.7x of the Shannon information-theoretic limit. As good as it gets without training.
600x faster than Product Quantization. Encode millions of vectors per second.
Real performance numbers on production hardware.
| Bits | Cosine Similarity | Quality |
|---|---|---|
| 6-bit | 0.993 | Excellent |
| 4-bit | 0.921 | Very Good |
| 3-bit | 0.814 | Good |
| Dimension | Mean Bias | Std Dev |
|---|---|---|
| 64 | -0.0003 | 0.0142 |
| 128 | +0.0001 | 0.0098 |
| 256 | -0.0002 | 0.0071 |
| 512 | +0.0000 | 0.0050 |
| Operation | Latency | Throughput |
|---|---|---|
| Encode | 25 µs | 40K vec/s |
| Decode | 1.2 µs | 833K vec/s |
| IP Estimate | 0.8 µs | 1.25M/s |
| Batch 1K IP | 0.6 ms | 1.67M/s |
Drop BitPolar into your existing stack. Works everywhere.
Up and running in under a minute.
# cargo add bitpolar use bitpolar::{Encoder, Config}; let cfg = Config::new(128, 6); // 128-d, 6-bit let enc = Encoder::new(&cfg); let code = enc.encode(&vector); // compress let ip = code.inner_product(&query); // estimate <v,q> assert!((ip - exact).abs() < 0.01); // unbiased!
# pip install bitpolar import bitpolar import numpy as np enc = bitpolar.Encoder(dim=128, bits=6) code = enc.encode(vector) # compress ip = code.inner_product(query) # estimate assert abs(ip - exact) < 0.01 # unbiased!
// npm install bitpolar import { Encoder } from 'bitpolar'; const enc = new Encoder({ dim: 128, bits: 6 }); const code = enc.encode(vector); // compress const ip = code.innerProduct(query); // estimate console.log(Math.abs(ip - exact)); // ~0.001
A four-stage pipeline grounded in information theory.
Raw float32 embedding
Isotropic normalization
Norm + direction split
Johnson-Lindenstrauss
Near-optimal packing
One library, every platform.