Compass: Encrypted Semantic Search with High Accuracy

Jinhao Zhu, Liana Patel, Matei Zaharia, Raluca Ada Popa

Abstract

Compass is a novel encrypted semantic search system that achieves state-of-the-art accuracy and sub-second latency by co-designing graph-based search with Oblivious RAM (ORAM). It protects data, queries, and access patterns from malicious servers, bridging the gap between security and performance in cloud storage search.

Introduction

As end-to-end encryption becomes standard for cloud storage services like iCloud and WhatsApp, a major functionality gap has emerged: how can users search over data that the server cannot see? Existing solutions generally fall into two categories. "Leaky" systems are fast but reveal access patterns—which nodes are visited and how often—leaving them vulnerable to leakage-abuse attacks that can reconstruct original data. Conversely, highly secure systems often rely on trusted hardware or are restricted to simple keyword-based "lexical" search. Modern semantic search uses high-dimensional embeddings to understand query intent, but performing this over encrypted data has historically been too slow or inaccurate for real-world use.

System Architecture

Compass bridges this gap by building a semantic search engine on top of Hierarchical Navigable Small World (HNSW) graphs and securing it with Ring ORAM. The system is designed to operate in a client-server model where the server is considered untrusted.

Compass System Overview

As shown in the architecture, the client handles the embedding model and maintains a search index, communicating with the untrusted storage on the server through an ORAM controller. This setup ensures that the server never learns the content of the data or the nature of the queries.

Methodology

To make the combination of graph search and ORAM performant, Compass introduces three core "white-box" co-design techniques:

  1. Directional Neighbor Filtering (DNF): Instead of fetching all neighbors of a node, the client uses "Quantized Hints" (highly compressed embeddings stored locally) to identify which neighbors are in the direction of the query, significantly reducing bandwidth.
  2. Speculative Neighbor Prefetch (SNP): Recognizing that network round trips are the primary bottleneck in ORAM, SNP predicts which nodes the search algorithm will likely visit next and fetches them in a single batch.
  3. Graph-Traversal Tailored ORAM: The authors modified the underlying Ring ORAM protocol to support "multi-hop lazy eviction," delaying internal cleanup until the end of a search to lower user-perceived latency.
HNSW Graph Search Mechanism

The search process utilizes the HNSW graph structure, where the algorithm traverses multiple layers—from entry nodes to visited nodes—to find the best match for the query node, as illustrated in the hierarchical diagram above.

Key Results and Insights

The authors evaluated Compass on four diverse benchmarks: MS MARCO (8.8 million text passages), TripClick (1.5 million health logs), SIFT1M (1 million image vectors), and LAION (100,000 image-text pairs).

  • Accuracy: Compass matches the accuracy of state-of-the-art plaintext semantic search (measured by MRR@10), outperforming existing secure lexical baselines.
  • Performance: It achieves user-perceived latencies between 0.57 and 1.28 seconds across all datasets, even on slow cross-region networks.
  • Efficiency: The system is orders of magnitude faster than prior encrypted search baselines like HE-Cluster and Inv-ORAM. A naive implementation of graph-based search over ORAM is 920x slower than Compass, highlighting the necessity of the co-design approach.

Limitations and Future Work

While Compass represents a significant leap forward, some limitations remain. The "Quantized Hints" require approximately 500 MB of RAM for large datasets like MS MARCO, which may be a constraint for older mobile devices. Additionally, while Compass is optimized for personal search (e.g., searching one's own Dropbox), scaling to global, multi-user web search remains an open challenge. Future work may also focus on "operation hiding" to prevent the server from distinguishing between different types of operations, such as searching versus inserting new documents.

Summary updated

BibTeX
@inproceedings{zhu2025compass,
  author = {Jinhao Zhu and Liana Patel and Matei Zaharia and Raluca Ada Popa},
  title = {{Compass: Encrypted Semantic Search with High Accuracy}},
  booktitle = {OSDI},
  year = {2025},
}
Figure