Provably Near-Optimal PQ in the Extended Zador Model
Organizations: Pinecone · UPenn & Pinecone
Abstract
This paper investigates Product Quantization (PQ) Optimization with Gaussian data. It offers three key contributions (i) a proof that SVD is the optimal preconditioning rotation for PQ; (ii) a new Extended Zador (EZ) estimator of the -means quantization cost that is accurate in low bit rates and low dimensions; and (iii) a novel segmentation algorithm based on 1-d bin packing of global bit allocations. The result is a simple algorithm (EZPQ) with strong approximation guarantees. It matches OPQ's empirical accuracy while providing a per-instance distortion lower bound certificate under the Gaussian EZ cost model. On typical real embedding spectra, EZPQ with 2 bits per coordinate is often certifiably within 1% of the optimum in this model. It also consistently achieves a lower reconstruction error than all random-rotation-based algorithms such as EDEN, E-RaBitQ, and TurboQuant.
Figures & tables
| Packer | Rule |
|---|---|
| lpt_fixed | OPQ-style allocation (ambient OPQ cap ): place each item in order into the least full unsealed bin ( ), sealing bins at items. |
| lpt | Longest processing time ( Graham, 1969 ; Chandra and Wong, 1975 ) : place item large-to-small into the least full bin with no size cap. |
| online_greedy | Greedy algorithm: seed the bins with , then place each subsequent item into the bin yielding the smallest marginal increase in , under the online bit target . |
| in_order | Contiguous threshold cut: sweep , taking at least one item per bin and adding to the current contiguous bin while . Binary search for the lowest possible . |
| prefix_cut | Equal-bit contiguous cut: sweep and place the -th cut ( ) at the index with cumulative bit sum closest to (ensuring item per bin). |
| contiguous_dp | Contiguous DP: dynamic programming over to find the minimum contiguous partition into bins in time. |
| b/dim | b/dim | ||||
| Packer | Mean | Max | Mean | Max | |
| lpt_fixed | 0.51 | 4.34 | 17.0 | 32.6 | 0.0815 |
| lpt | 0.28 | 2.52 | 9.62 | 19.6 | 0.0647 |
| online_greedy | 0.30 | 2.52 | 9.14 | 17.5 | 0.0650 |
| in_order | 7.55 | 29.5 | 43.6 | 75.8 | 0.2968 |
| prefix_cut | 7.84 | 33.5 | 113 | 283 | 0.2357 |
| Method | Rotation | Segments |
|---|---|---|
| EZPQ | PCA | LB bits packed by lpt ; zero-bit coordinates pruned. |
| OPQ-P | PCA | Equal widths ; eigenvalues allocated to balance the product of variances per segment ( Ge et al., 2014 ) . |
| PCA-PQ | PCA | Equal widths , contiguous in eigenvalue order. |
| PQ | None | Equal widths , contiguous in the original coordinates ( Jégou et al., 2011 ) . |
| Random rotation | Haar-random | Equal widths , contiguous. |
| Uniform diagonal | - | Equal widths at (expected spectrum of random rotation). |
| Dataset | VIBE name | Base vectors | |
|---|---|---|---|
| Llama | llama-128-ip | 128 | 256,921 |
| Yahoo | yahoo-minilm-384-normalized | 384 | 677,305 |
| ImageNet | imagenet-clip-512-normalized | 512 | 1,281,167 |
| COCO | coco-nomic-768-normalized | 768 | 282,360 |
| CCNews | ccnews-nomic-768-normalized | 768 | 495,328 |
| ArXiv | arxiv-nomic-768-normalized | 768 | 1,344,643 |
| Dataset | EZPQ | OPQ-P | EZPQ | OPQ-P | EZPQ | OPQ-P | EZPQ | OPQ-P | |
|---|---|---|---|---|---|---|---|---|---|
| Llama | 128 | 0.00 | 0.01 | 0.03 | 0.07 | 0.45 | 0.50 | 0.47 | 0.47 |
| Yahoo | 384 | 0.00 | 0.00 | 0.03 | 0.03 | 0.66 | 0.65 | 2.79 | 2.79 |
| ImageNet | 512 | 0.00 | 0.01 | 0.01 | 0.05 | 0.16 | 0.20 | 0.87 | 0.77 |
| COCO | 768 | 0.00 | 0.01 | 0.00 | 0.03 | 0.21 | 0.29 | 2.77 | 2.94 |
| CCNews | 768 | 0.00 | 0.01 | 0.07 | 0.07 | 0.20 | 0.22 | 1.08 | 1.08 |
| Mean excess over (%) | ||||
| Method | ||||
| EZPQ | 0.00 | 0.04 | 0.32 | 1.61 |
| EZPQ + lpt_ls | 0.00 | 0.00 | 0.00 | 1.48 |
| OPQ-P | 0.01 | 0.06 | 0.37 | 1.64 |
| PCA-PQ | 138 | 202 | 251 | 255 |
| PQ | 122 | 185 | 235 | 243 |
| Method | Llama | Yahoo | ImageNet | COCO | CCNews | ArXiv | HotpotQA | LAION | Landmark | MS MARCO | |
| EZPQ | 29.2 | 359 | 137 | 37.9 | 99.2 | 88.4 | 258 | 197 | 38.8 | 211 | |
| OPQ-P | 29.2 | 360 | 138 | 38.0 | 99.5 | 88.8 | 258 | 198 | 39.1 | 212 | |
| OPQ | 28.8 | 360 | 135 | 37.2 | 100 | 89.4 | 259 | 194 | 38.5 | 215 | |
| PQ | 43.2 | 527 | 214 | 92.3 | 238 | 219 | 357 | 261 | 99.6 | 451 | |
| Best other | 82.4 | 696 | 364 | 154 | 322 | 313 | 477 | 416 | 166 | 586 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Condition | Explanation | Spline coefficient constraints |
|---|---|---|
| is continuous and differentiable | and | |
| Shannon bound: higher bit allocation never increases distortion, and a codebook of cells carries at most bits, so isotropic coordinates sharing it cannot gain more than bits each. In particular : a coordinate without bits costs its full variance. | , | |
| Monotonicity and bounded slope. More bits always help, but an extra bit cannot cut the distortion by more than the factor that it achieves in the high-rate limit. The upper bound is an assumption: it holds at but fails for very small codebooks (e.g., ). | ||
| Convexity lower bound: bits are used least efficiently at low rate, where a coordinate is barely resolved, and rises toward the high-rate value . Upper bound (equivalently, is strictly convex): each extra bit reduces the distortion less than the previous one. This makes ( 8 ) a convex program whose optimum on an isotropic segment is the uniform allocation. | ||
| Isotropic agreement: on an isotropic segment, EZ allocates and reduces to ZG , so it should reproduce the measured -means cost on (Figure 1 ). At this is exact: the segment is the optimal scalar (Lloyd-Max) quantizer with levels. | at |
| 0 | 0.000000 | 0.000000 | 0.724877 | 0.302039 | 17 | 0.500000 | 16 | 0.394766 | 0.837669 | 0.094908 | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 0.031250 | 256 | 0.022800 | 0.734315 | 0.301187 | 18 | 0.577350 | 0.459844 | 0.845010 | 0.046303 | |
| 2 | 0.044194 | 0.032330 | 0.738214 | 0.299635 | 19 | 0.666667 | 12 | 0.535501 | 0.849146 | 0.013762 | |
| 3 | 0.062500 | 128 | 0.045894 | 0.743699 | 0.297110 | 20 | 0.730297 | 0.589561 | 0.850022 | 0.001488 | |
| 4 | 0.072169 | 0.053099 | 0.746572 | 0.294042 | 21 | 0.800000 | 10 | 0.648813 | 0.850125 | 0.003950 | |
| 5 | 0.083333 | 96 | 0.061452 | 0.749855 | 0.290261 | 22 | 0.894427 | 0.729106 | 0.850498 | 0.016052 |
| Method | Llama | Yahoo | ImageNet | COCO | CCNews | ArXiv | HotpotQA | LAION | Landmark | MS MARCO | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| EZPQ | 0.200 | 0.454 | 0.354 | 0.326 | 0.632 | 0.537 | 0.443 | 0.276 | 0.418 | 0.681 | |
| OPQ-P | 0.204 | 0.448 | 0.346 | 0.332 | 0.625 | 0.536 | 0.443 | 0.277 | 0.418 | 0.679 | |
| OPQ | 0.188 | 0.461 | 0.360 | 0.325 | 0.625 | 0.543 | 0.451 | 0.289 | 0.421 | 0.681 | |
| PQ | 0.136 | 0.442 | 0.245 | 0.150 | 0.493 | 0.376 | 0.402 | 0.233 | 0.259 | 0.644 | |
| Best other | 0.128 | 0.459 | 0.322 | 0.162 | 0.508 | 0.410 | 0.364 | 0.230 | 0.303 | 0.670 |
| Method | Llama | Yahoo | ImageNet | COCO | CCNews | ArXiv | HotpotQA | LAION | Landmark | MS MARCO | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| EZPQ | 0.599 | 4.06 | 8.53 | 3.86 | 4.50 | 12.9 | 38.0 | 6.10 | 8.29 | 105 | |
| OPQ-P | 0.735 | 4.32 | 9.00 | 4.02 | 5.05 | 13.5 | 43.2 | 7.05 | 9.47 | 136 | |
| OPQ | 0.656 | 4.42 | 9.64 | 4.22 | 5.29 | 15.6 | 52.5 | 7.58 | 10.3 | 145 | |
| PQ | 0.625 | 3.78 | 8.00 | 3.56 | 4.36 | 11.3 | 39.3 | 6.27 | 8.57 | 104 | |
| EZPQ | 0.995 | 7.94 | 15.8 | 7.24 | 8.23 | 24.6 | 72.3 | 11.5 | 16.8 | 196 |
| Method | Llama | Yahoo | ImageNet | COCO | CCNews | ArXiv | HotpotQA | LAION | Landmark | MS MARCO | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| EZPQ | 52.9 | 188 | 256 | 375 | 398 | 413 | 539 | 289 | 393 | 1037 | |
| OPQ-P | 68.1 | 253 | 418 | 647 | 661 | 667 | 862 | 412 | 639 | 2264 | |
| OPQ | 75.7 | 323 | 532 | 924 | 925 | 1066 | 1139 | 584 | 1005 | 3379 | |
| PQ | 54.5 | 159 | 208 | 306 | 319 | 308 | 408 | 214 | 315 | 686 | |
| EZPQ | 87.1 | 304 | 460 | 681 | 661 | 714 | 862 | 491 | 711 | 1638 |