What is binary quantisation?
Binary quantisation is the most extreme quantisation method: it reduces each embedding dimension to one bit, usually 1 if the value is above zero and 0 otherwise, computing similarity as the Hamming distance between bit strings.
Unlike scalar quantisation, which usually stores each dimension in 8 bits at small accuracy cost, binary quantisation uses one bit, cutting memory much further but losing more information. Binary codes therefore often serve fast candidate generation, with final ranking on full or less compressed vectors.
- Topic
- Embeddings, document processing and RAG
- Also known as
- Binary embeddings
How binary quantisation works
- Each dimension is compared with a threshold (often zero) and turned into one bit.
- Bits are packed and stored; keeping 1 bit instead of a 32-bit value cuts vector data to a thirty-second.
- Queries are binarised too and Hamming distance computed with fast bit operations.
- The nearest candidates are rescored with full vectors to recover accuracy.
In more detail
Dependence on dimensionality and mean-centring
Binary quantisation depends strongly on embedding dimensionality and calibration: high-dimensional models (1024 to 3072+ dims) tolerate 1-bit compression far better than compact 384-dim vectors, because errors average out across more bits. Subtracting the corpus mean per dimension or applying orthogonal rotation (such as in ITQ or RaBitQ) prevents biased bit distributions.
Oversampling factor and asymmetric binary search
Recovering near-full recall requires an oversampling factor during candidate generation: if the user needs top-10 documents, the Hamming index retrieves several times as many candidates for rescoring with full or int8 vectors on disk. Alternatively, asymmetric quantisation keeps the query in FP32/int8 while documents remain 1-bit.
Hardware POPCNT acceleration and vector database support
Recent vector databases (such as Qdrant, Milvus, Weaviate, Elasticsearch BBQ and pgvector) support binary quantisation natively alongside Matryoshka embeddings and hardware SIMD instructions (e.g., AVX-512 POPCNT), which can make Hamming scans over very large collections fast on standard CPUs.
Commonly confused terms
| Term | How it differs |
|---|---|
| Product quantisation | Product quantisation (PQ) splits a vector into subvectors and replaces each subvector with a codebook centroid ID, preserving distance structure better at similar memory budgets, whereas binary quantisation binarises each individual coordinate independently. |
| Model weight quantisation (1-bit LLMs) | Weight quantisation (e.g., 1-bit LLMs like BitNet) compresses neural network parameters to reduce inference compute and VRAM, whereas binary quantisation here compresses dense retrieval embeddings for compact vector indexing and Hamming search. |
Why binary quantisation matters for on-premises AI
Binary quantisation is one of the cheapest ways to hold very large indexes in memory. Its theoretical basis is a classic paper showing sign bits against random hyperplanes suffice to estimate the angle between vectors. A paper adding learned binary codes to a dense passage retriever reports cutting passage index memory from 65 GB to 2 GB with no accuracy loss on two standard open-domain QA benchmarks, generating candidates with binary codes and reranking with continuous vectors.
A cybersecurity firm keeps embeddings of its threat report archive in memory as binary codes, generating candidates by Hamming distance and rescoring the best with full vectors from disk.
Common questions
Does binary quantisation work with every embedding model?
No. Some models are trained to tolerate it while others lose a lot; measure with validation queries.
How is accuracy loss reduced?
Generate candidates with binary codes, then rescore the best with full vectors.
Related terms
Sources
- Charikar, Similarity estimation techniques from rounding algorithms, STOC, 2002
- Yamada, Asai and Hajishirzi, Efficient Passage Retrieval with Hashing for Open-domain Question Answering, 2021
In the glossary: Glossary, A to C