Billion-Scale Nearest-Neighbor Search under Fully Homomorphic Encryption on a Single GPU, Balancing Leakage and Cost
This paper presents a GPU-accelerated system for billion-scale nearest-neighbor search under fully homomorphic encryption that achieves practical latency by combining rank reduction and hierarchical routing, while quantifying and mitigating the associated geometric leakage through seeded padding.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a library containing billions of photos, and you want to find the one that looks most like a picture in your pocket. Normally, a computer would scan every single photo to find the match, but what if you cannot show the computer your picture because it is private? What if the library is owned by a stranger you do not trust? This is the problem researchers set out to solve. They wanted a way for a computer to search through a massive, secret database without ever seeing the actual question being asked. To do this, they use a method called fully homomorphic encryption, which is like putting your question inside a locked, transparent box. The computer can perform calculations on the box without opening it, returning a result that is still locked. Only you, holding the key, can open the final box to see the answer. For years, this idea was too slow to be useful for huge collections of data, as the math required to keep the box locked was incredibly heavy.
A team of researchers has now built a system that makes this possible for a billion items, running on a single graphics card. They managed to find the most similar images in a database of 1.39 billion entries without the server ever seeing the query. The system works by using two main tricks to speed things up. First, it simplifies the images. Instead of comparing every tiny detail of a photo, the system reduces the description of each image to a shorter, simpler version before the search begins. This makes the math much lighter. Second, it does not look at every single photo. Instead, it uses a hierarchy, like a map that first points to a general neighborhood, then a specific street, and finally a few houses. The computer only checks the photos in those selected areas, skipping the rest. This allows the system to find the right answer quickly, even though the data is locked in a box.
The results show that this approach works remarkably well. On a dataset of 1.39 billion images, the system found the correct match in the top ten results 90 percent of the time. When the researchers allowed for near-duplicates—since the internet is full of slightly different copies of the same photo—the success rate jumped to 95 percent. The entire process took about six seconds per search on a single graphics card. This is a warm, deployable speed, meaning it is fast enough for real-world use once the database is prepared in advance. The researchers also tested the system on a different billion-item collection of 96-dimensional vectors, achieving a 90 percent success rate in just 2.3 seconds. These numbers prove that searching billions of encrypted items on a single machine is no longer just a theoretical dream.
However, the researchers were careful to measure what this speed costs in terms of privacy. While the server never sees the question or the answer, it does see which groups of data the computer asks to look at. This pattern of access can reveal clues about the database itself. By watching which groups are requested together, an observer could reconstruct about 72 percent of the map showing how the data is organized. They could also guess that two different searches were looking for similar things if they requested the same groups. To fix this, the researchers tried a method where the computer asks for extra, fake groups of data along with the real ones to hide the true pattern. If the fake groups change every time, a clever attacker can still figure out the truth by comparing many searches. But if the fake groups are fixed and always the same, the attacker cannot strip them away. This "seeded" padding reduces the information leak by about 35 times, dropping the recovery of the database map from 72 percent down to just 2 percent.
The team also explored other ways to make the search faster, such as a technique called product quantization, which breaks data into small codes. They found that under encryption, this method did not work well. It either failed to beat the standard encrypted search or leaked too much information about the data structure. They decided not to use it, sticking instead to the simpler method of reducing the size of the data descriptions and using the hierarchical map. This choice highlights a key finding: sometimes, a straightforward approach is better than a complex one when privacy is the priority.
The system operates by having the user send an encrypted question to the server. The server, which holds the encrypted database, performs the math on the locked data. It first checks a few thousand broad categories, then narrows down to a few thousand more specific groups, and finally scores the actual images in those groups. At every step, the server returns encrypted scores. The user decrypts the scores, decides which groups to look at next, and sends a new request. The server never sees the user's decision or the final answer. This back-and-forth continues until the top ten matches are found. The researchers measured the time it takes to load the data and perform the scoring, excluding the time it takes for the user to decrypt the final result or for the data to travel over the network. They found that the time is dominated by loading the encrypted data into the computer's memory, not by the math itself.
In their analysis of the privacy risks, the researchers showed that the leak is a property of how the search is routed, not the specific data being searched. Whether the database contained faces or general images, the pattern of access revealed the same amount of structural information. They demonstrated that without protection, an observer could recover the grouping of the data almost perfectly. With the fixed-group padding, this recovery dropped significantly, though it did not disappear entirely. The trade-off is clear: to hide the access pattern, the system must fetch more data than strictly necessary, which increases the time it takes to complete a search. The researchers showed that this cost can be managed, but it requires a balance between how much privacy is needed and how fast the system must run.
This work represents a significant step forward in making private search practical at a massive scale. It proves that you can search a billion items without revealing your intent, provided you are willing to accept a few seconds of delay and a carefully managed privacy cost. The system does not rely on magic or unproven theories; it uses established math and clever engineering to solve a real problem. The researchers have provided a complete guide on how to build and run this system, including the exact settings for speed and accuracy. They have also shown where the limits lie, particularly regarding the information that leaks through the search pattern. By being transparent about what is hidden and what is revealed, they offer a realistic path forward for secure data search in an era where privacy is increasingly valuable.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.