One bit per number, and a confidence score.
In similarity search, each item (an image, a passage of text, a customer record) becomes a list of numbers, and "similar" means "close" in that list. Finding the closest ones means comparing the query against many items. To avoid doing the full calculation on all of them, systems keep a summary of each item and use the summary to rule out whatever is already clearly far away.
The most widely used summary today is called RaBitQ (2024). It rotates the list of numbers at random and keeps, from each number, only its sign: positive or negative, 1 bit. Alongside, it keeps a score of how closely this summary points in the same direction as the original item. It is like writing down only the rough heading of each house instead of its address, plus how far off that heading might be.
With the summary, the system estimates the distance to the query. Since the estimate can be wrong, it only rules out an item if, even after subtracting a margin, the item is still far away. Everything depends on the size of that margin.
A margin that holds "with high probability".
The original paper proves that the estimate's error stays within a margin with high probability, over the random draw of the rotation. For the margin, the authors pick a number, 1.9, and everyone copied it. We read the code of 13 systems that use this shortcut: the official library, Faiss (Meta), Milvus, LanceDB, VectorChord, VSAG, pg_vectorsearch and others. All of them use a fixed statistical margin (1.9, or 2.5 in one case) or not even that, they just fetch extra items and check them. Three of them state in their own code that the margin is not a guarantee.
We measured the "almost". In 5 million comparisons on the SIFT dataset, 2.74% fall outside the margin. Most of the time this changes nothing, because the item really was far away. But across 1 million images, with 500 searches for the 10 most similar, 12 searches came back missing a neighbor, with no warning at all.
For recommending a movie, this does not matter. For checking a name against a sanctions list, finding every similar document in a lawsuit or proving that an image is not in a database, a wrong and silent "not found" is exactly the defect you cannot have.
The heading cannot be further off than the score says.
The summary's confidence score is, in fact, an angle: how far the recorded heading deviates from the item's true heading. And angles obey a simple rule, the same one as for triangles, only on a sphere: the angle between the query and the item cannot differ from the angle between the query and the summary by more than the summary's own deviation.
That gives a margin that does not depend on luck, on a random draw or on the kind of data. It holds for every pair of query and item. With it, SIEVE, our search index, rules out items using the summary without ever ruling out a true neighbor. We tested it on 20 million pairs: zero exceptions.
It is not new mathematics, and we say so. The angle rule was written down for similarity search in 2021 (Schubert), the idea of comparing against a summary without missing anyone has appeared in information theory since 2013 (Ingber and colleagues), and our margin is hidden in a lemma of the RaBitQ paper itself, which preferred the statistical version. What we did not find anywhere, not even in the 13 codebases we read, is someone using this margin to rule out items with a guarantee, with the 32-bit arithmetic proven, and measuring what it costs.
1.36× on ordinary data, 2.5× on hard data.
The guaranteed margin is wider, so it rules out less and leaves more full calculations to do. We compared the two in the same engine, with the same data and the same searches.
On SIFT (1 million images, 128 numbers each), the statistical margin is 1.36× faster than the guaranteed one: 16.5 versus 22.5 milliseconds per search. That is the entire price of missing no one. And the guarantee still speeds SIEVE up: without the 1-bit summary, the same search takes 29.9 ms; with it, 22.5 ms, 1.33× faster, for 32 extra bytes per image.
On GIST (960 numbers per image, a dataset known for being hard), the picture changes: the statistical margin is 2.5× faster (13.7 versus 34.7 ms, with 100 thousand images). With many numbers, it gets very tight and the guaranteed one only a little: at the ideal threshold, the statistical margin rules out 99.6% of the items, the guaranteed one 59.8%.
With a summary of 4 bits per number instead of 1, the guaranteed margin rules out 99.8%, almost as much as the statistical one, and the search drops to 26.6 ms. The price falls to 2.0×, and no further: full calculations are already of the same order (551 versus 262 per search); what remains is reading 4 bits per number instead of 1. And it is not just GIST: we measured 1 bit against 4 bits on nine datasets, from 64 to 960 numbers per item, including real text embeddings (GloVe, NYTimes, OpenAI, InstructorXL). The 4-bit summary was never slower: from 1.03× on SIFT to 3.03× on the OpenAI embeddings. The gain does not follow the size of the item; it follows how much the 1-bit summary let through. So SIEVE now uses 4 bits always, at a cost of about 19% more memory.
Then we changed the reading. Instead of looking up, for every number of every item, a table that lives in memory, SIEVE now adds up 32 items at once with a table that fits inside a processor register (the technique is called FastScan, and vector databases already use it). What is new is that the rounding error of that table goes into the margin: the guarantee does not change, and the 16-bit version rules out exactly what the full computation does. On GIST, the guaranteed search drops from 26.0 to 12.9 ms with 100 thousand images and from 48 to 22 ms with 200 thousand. With the same reading on both sides, the guarantee now costs 1.7×, and the guaranteed search with the new reading is faster than the statistical one with the old reading (12.9 versus 13.2 ms; 22 versus 24). What remains of the price is the full calculations: 551 versus 262 per search.
And it is not enough to raise the statistical margin's slack until it never fails. At maximum slack it also becomes a guarantee, but a different, much looser one: it leaves 2.9× more items for the full calculation on SIFT and 1.7× on GIST. You can see this in the specimen by dragging the slack all the way to the end.
| Measurement | Statistical margin (1.9) | Guaranteed margin | In practice |
|---|---|---|---|
| SIFT, 1 million, 500 searches | 16.5 ms · 488/500 complete | 22.5 ms · 500/500 | the guarantee costs 1.36× |
| GIST, 100 thousand, 200 searches | 13.7 ms · 198/200 complete | 34.7 ms · 200/200 | the guarantee costs 2.5× |
| GIST, 100 thousand, guaranteed with 4 bits | 13.7 ms · 198/200 complete | 26.6 ms · 200/200 | the guarantee costs 2.0× |
| GIST, 100 thousand, both with in-register reading | 7.4 ms · 198/200 | 12.9 ms · 200/200 | the guarantee costs 1.7×; beats the statistical one from before (13.7 ms) |
| GIST, 200 thousand, both with in-register reading | 12.3 ms · 199/200 | 21.8 ms · 200/200 | 1.8×; without the new reading, 24.1 and 48.1 ms |
| Full calculations per search, GIST 100 thousand | 262 | 42,219 (1 bit) · 551 (4 bits) | with 1 bit, this is where the price comes from |
| Comparisons outside the margin, SIFT | 2.74% of 5 million | 0 of 20 million | the statistical margin errs rarely, but it errs |
| Versus having no summary, SIFT 1 million | — | 29.9 → 22.5 ms (1.33×) | the guarantee is already SIEVE's default |
| Versus having no summary, GIST 100 → 200 thousand | — | 1 bit 1.30× → 1.39× · 4 bits 1.70× → 1.89× | the gain grows with size |
| Same, 4 bits with in-register reading | — | 3.5× → 4.2× | the reading doubles the gain; costs memory |
Mac with an M2 chip and 8 GB, Go with experimental SIMD. One index per process, alternating runs, median of 6, every row. Correction (Oct 15, 2026): the first version of this text said 1.14× and 4.7×. Those numbers came from a run with the indexes competing for the same memory; redone with each index isolated, the result was 1.36× and 2.5×. The thesis does not change; the size of the price does. We have not yet measured on Intel/AMD servers.
What we decided.
The guarantee is the default
In SIEVE, the 4-bit summary with the guaranteed margin is on whenever the index uses drawers and the items have 64 numbers or more. Anyone short on memory can go back to 1 bit; anyone who wants to can turn it off. The in-register reading is optional, because it more than doubles the memory of the summary.
The statistical margin is never the default
It exists in the code to measure the difference, not to be used by accident. Whoever chooses "almost always" has to choose it on purpose.
The price comes with the guarantee
We publish 1.36× and 2.5× with equal prominence — and correct in public when the first measurement came out wrong. A guarantee without a stated price is advertising.
Do not call new what is not
The angle rule has an author and a date. Our part is to use it, prove the arithmetic and measure.
When a wrong "not found" is expensive.
Pay for the guarantee
- Sanctions and compliance: checking names and companies against official lists, with proof that nothing slipped through.
- Forensics, lawsuits and patents: finding all the similar documents, not almost all.
- Deduplication and prohibited content: where a forgotten look-alike is the case that matters.
- Asserting absence: "there is nothing similar in the database" only holds with a guarantee.
Use the statistical shortcut
- Recommendations and product search: one incomplete search in roughly every 40 does not change the experience.
- Search that feeds an AI assistant: there the bigger error comes from elsewhere (how the text was split and represented), not from the index.
- Hard data and a tight deadline: on GIST, 2× is a lot; if nobody is going to ask about the missing neighbor, do not pay for it.
A version of each item 32 times smaller, which keeps only the sign of each number after a random rotation. It is used to rule items out without the full calculation. With 4 bits per number, the summary is 8 times smaller than the item and also records which of 16 steps the number fell into.
How much is subtracted from the estimate before ruling an item out. Too wide, and it rules out little; too narrow, and it rules out a true neighbor.
A margin that holds for every pair of query and item, by geometry. Not "almost always", nor "with high probability".
Where this could be wrong.
A single machine
Everything was measured on a Mac with 8 GB. GIST with 500 thousand images ran using the disk as memory, and with 1 million it did not fit. It still needs to be measured on an Intel/AMD server.
The cutoff at 64 numbers
The guarantee switches on by itself from 64 numbers per item. We measured 1 versus 4 bits from 64 up, but summary versus no summary only from 128. Below 64, we measured nothing.
Hard data
On GIST, even with the in-register reading, the guarantee costs 1.7×: what remains is the full calculations (551 versus 262 per search), and the reading does not fix that. The new reading more than doubles the memory of the summary (104 → 214 MB with 200 thousand images) and only has its fast version on ARM processors; on Intel/AMD it runs a non-SIMD version we did not measure. On items with 128 numbers (SIFT) it changes almost nothing (1.11× at best). The 1-versus-4-bit measurements used 100 thousand items; the new-reading ones used 100 and 200 thousand (GIST) and 1 million (SIFT), two rounds each, on a single computer, and one GIST round with 200 thousand came out dirty (another program running alongside) and was discarded.
Literature search
We read 13 codebases and the papers citing RaBitQ that we could find (169 on Semantic Scholar). Someone may already use the guaranteed margin and we did not find them. If you know of one, we want to hear about it.
Does this apply to your case?
Tell us in two lines what you need to decide or measure. The first conversation is to see whether measurement solves your case, and if it does not, we say so.
← Research notebook · stickybit.com.br
- Gao and Long, RaBitQ: Quantizing High-Dimensional Vectors with a Theoretical Error Bound for Approximate Nearest Neighbor Search, SIGMOD 2024. The 1.9 margin and the "with high probability" guarantee; our margin comes from Lemma 3.1 with the worst case of Lemma B.3.
- Schubert, A Triangle Inequality for Cosine Similarity, SISAP 2021. The angle rule used here.
- Ingber, Courtade and Weissman, Compression for Quadratic Similarity Queries, IEEE Transactions on Information Theory. Summary, angle and no false negatives.
- Song and colleagues, TRIM, 2025. A summary (of another kind) used as a reference point, with the error stored item by item.
- Code read on Oct 14, 2026: RaBitQ-Library (official), Faiss, Milvus/Knowhere, LanceDB, VectorChord, VSAG, zvec, ivfq, pg_vectorsearch, Elasticsearch, Weaviate and Qdrant.
- Data: the public SIFT1M and GIST1M datasets (TEXMEX corpus, Jégou, Douze and Schmid, INRIA). The specimen uses the first 3,000 images and the first 200 searches of SIFT1M.
- Our pages: SIEVE, certified similarity search · Faster, different bits (the 32-bit arithmetic).