Glossary
Binary quantisation
A compression method that stores each embedding dimension as a single bit, shrinking vectors 32-fold and turning similarity search into fast Hamming distance comparisons.
Binary quantisation compresses an embedding by keeping only the sign of each value: every dimension becomes a 1 if the number is positive and a 0 if it is zero or negative. A 1,024-dimensional float32 vector, which takes 4,096 bytes, becomes 128 bytes, a 32-fold reduction. Similarity is then measured with Hamming distance, the count of bits that differ between two codes, which a processor computes in a couple of instructions. The result is an index that is very small and very fast, with a real loss of ranking precision that most systems recover by rescoring a shortlist with fuller vectors.
How binary quantisation works
Start with an embedding, a list of floating-point numbers produced by an embedding model. Binary quantisation applies a threshold to each number independently. The usual threshold is zero, so the operation is a sign function. Some implementations subtract the mean of each dimension first, so that the threshold sits in the middle of that dimension’s distribution rather than at an arbitrary point. That small step can matter: if a dimension is positive for 90 percent of the corpus, a zero threshold makes its bit almost constant and therefore useless for telling documents apart.
The bits are packed into machine words. A 1,024-bit code fits in sixteen 64-bit integers. To compare a query code with a document code, the engine XORs the two words, which leaves a 1 wherever the bits differ, and counts the 1s with a population count instruction. Sixteen XORs and sixteen popcounts replace 1,024 floating-point multiplications. On modern CPUs that is one of the cheapest similarity measures available, and it is why binary indexes can scan tens of millions of vectors per second on a single core.
Hamming distance on sign bits approximates the angle between the original vectors. Two vectors pointing in similar directions share most of their signs; vectors at right angles share about half. That is why binary codes behave like a coarse version of cosine similarity, and why they suit models trained with a cosine or dot product similarity objective.
What it saves
The memory arithmetic is the main attraction.
Vector format (1,024 dimensions) | Bytes per vector | 10 million vectors |
|---|---|---|
Float32 | 4,096 | about 41 GB |
Int8 scalar quantisation | 1,024 | about 10 GB |
Binary quantisation | 128 | about 1.3 GB |
An index that needed a large memory-optimised server at full precision fits in the RAM of a laptop once binarised. For a vector database running many tenants, or for edge devices with tight memory, that changes what is feasible. Combined with Matryoshka embeddings truncated to 512 dimensions, the same 10 million vectors take around 640 MB.
Speed improves for the same reason. Search cost is dominated by reading vectors and comparing them, and both get cheaper when each vector is 128 bytes instead of 4 KB. More of the index fits in CPU cache, and memory bandwidth stops being the bottleneck.
What it costs
Throwing away everything except the sign loses a lot of information. Two documents that are both strongly and weakly related to a query can end up with identical codes, and the fine distinctions that decide which of ten good candidates is best are mostly gone. Measured as recall at k, a binary index used on its own typically returns noticeably fewer of the true nearest neighbours than a full-precision one.
How much it loses depends heavily on the model. Three properties help. First, dimension count: with 1,024 or more dimensions there are enough bits for the codes to stay distinctive, while 384-dimensional models lose far more. Second, a balanced distribution, with values spread evenly around zero in each dimension, so each bit carries close to one full bit of information. Third, training: some embedding providers train or fine-tune models specifically so their outputs survive binarisation, and publish recall figures for binary use. The best embedding models roundup notes which providers document this.
The losses also grow with corpus size. In a large collection many documents already sit at nearly the same distance from a query, the effect described as semantic collapse. Binary codes compress those small differences to nothing, so near-ties become exact ties and the ranking among them is arbitrary.
Rescoring: how binary quantisation is used in practice
Because of those losses, binary quantisation is almost always used as the first stage of a two-stage search. The binary index finds a generous shortlist cheaply, and a more precise score orders it.
The usual pipeline looks like this. The query is embedded and binarised. The engine scans the binary index and keeps the best few hundred candidates by Hamming distance, an oversampling factor of perhaps 4 to 10 times the number of results needed. It then fetches higher-precision vectors for those candidates, either float32 from disk or int8 from memory, and recomputes their similarity to the full-precision query. The top results from that second pass are returned, optionally followed by a reranking model or a cross-encoder for the final order.
A useful refinement is asymmetric scoring. Instead of binarising the query, the engine keeps it at full precision and computes the dot product between the float query and each binary document code. That costs a little more than pure Hamming distance but recovers a meaningful share of the lost accuracy, because only one side of the comparison has been compressed.
With rescoring, recall can come close to the full-precision baseline. The binary stage only has to make sure the right documents are somewhere in the shortlist, which is a much easier job than ranking them correctly. The important limit is that rescoring cannot recover a document the binary stage missed entirely, so the oversampling factor should be tuned against real queries, with precision and recall measured end to end.
Binary quantisation compared with other methods
Binary quantisation is one point on a range of compression choices covered in vector quantisation. Int8 scalar quantisation keeps far more information at a 4-fold saving and often needs no rescoring at all. Product quantisation learns codebooks from the data and reaches similar or higher compression than binary codes with better accuracy, at the cost of a training step and slower lookups. Dimensionality reduction removes dimensions instead of bits, and combines well with any of these.
Binary codes win where raw speed and minimal memory matter most and where a rescoring stage is acceptable. They are simple to implement, need no training, update instantly when new vectors arrive and work with any index structure. Graph indexes such as HNSW can be built over binary codes, and so can inverted file layouts like an IVF index. Libraries such as FAISS include binary index types, and several vector databases, among them Qdrant and Weaviate, offer binary quantisation as an index option. If you are weighing those engines, Exabase vs Qdrant and Exabase vs Weaviate cover the differences.
It is worth separating binary quantisation from sparse vectors, which also contain many zeros. A sparse vector is a long vector with most values exactly zero, used in learned keyword retrieval. A binary code is a dense vector where every position holds one bit. They solve different problems and are indexed differently.
A worked example
Consider a media company with 40 million image captions and transcript segments, embedded with a 1,024-dimensional model. At float32 the vectors alone need about 164 GB. The team binarises them, bringing the index to about 5 GB, which fits in memory on a single node with room for an HNSW graph. They keep int8 copies of the vectors, another 41 GB, on local SSD.
At query time the binary index returns 400 candidates in a few milliseconds. The int8 vectors for those 400 are read from SSD and rescored against the float query, and the top 20 go to the application. On their evaluation set, recall at 20 is 0.97 of the float32 baseline, and median latency is lower than the old full-precision setup because the first stage is so cheap. When they tried the same scheme with a 384-dimensional model, recall fell well below acceptable levels even with 1,000 candidates, so they kept the larger model. Binary quantisation made the bigger model affordable.
Where Exabase fits
Exabase does not ask you to pick a vector format. Content stored as Resources in a Base is extracted and indexed automatically, and Deep Search combines semantic and keyword matching to return the specific paragraph, page, timestamp or video scene that matches a query. There are no embedding models, bit widths or oversampling factors to configure. Instead, each query takes a precision value between 0 and 1: set it low to cast a wide net for research, or high to get only the closest matches for a factual question. That is the same recall-versus-relevance trade-off that binary quantisation and rescoring manage inside a vector engine, exposed as one parameter.
Exabase is the retrieval substrate rather than a configurable vector engine. Teams that want to choose quantisation schemes and tune index memory themselves will run a dedicated engine; the best vector databases roundup compares them. Teams whose goal is accurate answers over documents and media, without an embedding pipeline to maintain, can start with the getting started guide and the search endpoint reference. The RAG accuracy page covers why passage-level retrieval affects answer quality more than index compression, and asset search shows the same search applied to images, audio and video.
Frequently asked questions
What is binary quantization?
Binary quantisation stores each dimension of an embedding as a single bit, 1 for positive values and 0 otherwise. It shrinks float32 vectors 32-fold and lets search use fast Hamming distance instead of floating-point maths.
How much accuracy does binary quantization lose?
Used alone, it loses a noticeable share of recall, and the loss is larger for models with fewer dimensions. With oversampling and rescoring against higher-precision vectors, recall usually comes close to the full-precision baseline.
What is Hamming distance?
Hamming distance is the number of positions at which two binary codes differ. For sign-binarised embeddings it approximates the angle between the original vectors, so smaller distances mean more similar content.
Which embedding models work well with binary quantization?
Models with high dimension counts (around 1,024 or more) and values balanced around zero hold up best. Some providers train models specifically for binary use and publish recall figures for it.
Is binary quantization better than product quantization?
Neither is better in every case. Binary quantisation is simpler, needs no training and is faster to compare, while product quantisation usually keeps more accuracy at similar memory but needs codebooks fitted to the data.
Should I binarise the query too?
Not necessarily. Keeping the query at full precision and scoring it against binary document codes, known as asymmetric scoring, recovers accuracy at a small extra cost.
Does Exabase use binary quantization?
Exabase does not expose vector formats. Stored content is indexed automatically and Deep Search handles retrieval, with a precision parameter to trade recall against relevance per query.
Related pages: Vector quantisation, Product quantisation, Matryoshka embeddings, Embedding dimensions, Approximate nearest neighbour, Vector search, Best vector databases, Exabase vs Qdrant, RAG accuracy