Skip to content

SHAQ: Privacy-preserving retrieval in vector databases using shadow queriesShadow Queries for Private Retrieval in Vector Databases

arXiv· arXiv:2609.04767· Xinguo Feng, Zhongkui Ma, Zihan Wang, Chuan Yan, Guowei Yang, Alsharif Abuadbba, Guangdong Bai·Indexed by this site · 2026-10-12· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

SHAQ replaces document embeddings with shadow query embeddings; the authors state that under vec2text, ROUGE-1 averages 0.2710 and is at least 0.2104.

Threat modelThird-party cloud vector databases store precomputed document embeddings for dense retrieval. The attacker is honest-but-curious, can read stored embeddings via insider threat or data leakage, and can call the embedding model in a black-box manner to obtain embeddings for arbitrary text. The goal is to recover the original documents corresponding to the observed embeddings. The paper states that this setting is consistent with vec2text's EIA research.

Questions
Document embeddings in a cloud vector database can be restored to the original text by EIA. The authors believe the noise can only be very small, and secret scaling would be canceled out by vector normalization; it is necessary to cut off the direct correspondence between embeddings and the original text while preserving retrieval.
Methods
SHAQ uses a generative model to synthesize shadow queries covering different semantic aspects for each document, then randomly shuffles the query embeddings and replaces the document embeddings in the library; during retrieval, it maps back to the original documents.
Experiments and results
Attacking GTR-T5 embeddings of 10 BEIR datasets with vec2text. The authors state that in the standard setting, ROUGE-1 averages 0.2710 with a minimum of 0.2104, and in the adaptive setting averages 0.3376 with a minimum of 0.2083. In Table III, SHAQ's NDCG change includes −0.0747.
Limitations and future work
The paper does not specifically discuss limitations. Coverage is 10 datasets from BEIR, vec2text and 32-token truncation, plus untruncated utility on SciFact and DPR utility. The paper does not report the number of repetitions and does no human evaluation; downstream generation is written as outside the evaluation scope.
Experimental setupGTR-T5 encoder、DPR · BEIR、SciFact et al. · NDCG@10、MAP@10 et al.
Evaluated models
GTR-T5 encoderDPR
Benchmarks
BEIRSciFactNatural QuestionsMS MARCONFCorpusHotpotQAFiQAArguAnaQuora Question PairsFEVERCLIMATE-FEVER
Metrics
NDCG@10MAP@10Recall@10Precision@10AccuracyBLEUROUGE-1ROUGE-2ROUGE-LMETEOR
AI summaryTo address the vulnerability of vector database embeddings to embedding inversion attacks (EIA), SHAQ uses a generative language model to generate multi-perspective shadow queries for each document, which are encoded and stored in place of the original document embeddings, decomposing semantics and decoupling from the original text. On multiple IR datasets, its recovery rate is as low as 0.2104, protecting up to 19.50% more tokens than baseline defenses, with MAP@10 up to 0.7967 and utility improvement up to 5.53%.

To address the vulnerability of vector database embeddings to embedding inversion attacks (EIA), SHAQ uses a generative language model to generate multi-perspective shadow queries for each document, which are encoded and stored in place of the original document embeddings, decomposing semantics and decoupling from the original text. On multiple IR datasets, its recovery rate is as low as 0.2104, protecting up to 19.50% more tokens than baseline defenses, with MAP@10 up to 0.7967 and utility improvement up to 5.53%.

Related events and news

0 events · 1 news mentions

News that mentions this paper

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Cloud vector database document embeddings can be reconstructed by EIA; SHAQ replaces them with shadow query embeddings to break the direct mapping.

    Document embeddings in cloud vector databases can be reconstructed by embedding inversion attack (EIA), and existing defenses struggle to preserve both retrieval utility and privacy.

    • Scenario: Systems like RAG use dense retrievers and cloud vector databases (the paper cites Pinecone, Milvus) to access external knowledge at inference time. The authors believe embeddings still leak the original text, and an adversary who obtains the embeddings in the database can use EIA to recover private documents.
    • Existing shortcomings: Embedding noise can only add very small perturbations, otherwise utility is hard to maintain; secret scaling uses a user-only scalar to multiply query and document embeddings, but the authors state that vector normalization cancels it out, making it ineffective in practice. Both directly modify document embeddings, limited by the semantic coupling between embeddings and text.
    • Core observation: The authors believe EIA relies on the strong coupling between embeddings and the underlying text, and the resulting invertible mapping.
    • This paper proposes: The authors propose SHAQ (shadow query generation): generate shadow queries covering different semantic facets for each document, replace the document embeddings in the database with their embeddings, performing semantic decomposition and embedding decoupling.
    • Threat model:
      • Victim system: Document embeddings precomputed and stored for dense retrieval in a third-party hosted cloud vector database.
      • Adversary: honest-but-curious, can obtain these embeddings via insider threat or data breach.
      • Knowledge: Black-box access to the embedding model used, i.e., obtain embeddings for any text. The paper states this setting is consistent with vec2text research.
      • Goal: Reconstruct the original documents corresponding to the observed document embeddings. The main evaluation assumes the adversary does not know SHAQ.
  2. What related research exists?

    Related work is divided into EIA, defenses that directly modify embeddings, and utility-oriented query generation.

    In Section V and the introduction, the paper divides related work into attacks, defenses that directly modify embeddings, and query/document generation.

    • Embedding inversion
      • Song and Raghunathan (2020): Points out that exhaustive vocabulary search is infeasible, and uses gradient descent to update dummy token embeddings to approximate the target embedding. The authors state that this method still requires backpropagation through the embedding model, which is computationally expensive; it is not included in the evaluation because it does not target document-level recovery from vector databases.
      • Li et al. (2023) GEIA: Trains GPT-2 to predict the original text from the target embedding. The authors state that it targets sentence-level, posing less threat to large-scale corpora; it is not included in the evaluation.
      • Morris et al. (2023) vec2text: Trains a T5-based model to decode text from target embeddings, focusing on vector databases and document-level embeddings. The authors state that this is the main risk to mitigate in this paper, and use it as the attack baseline, calling it state-of-the-art.
    • Defenses that directly modify embeddings
      • Morris et al. (2023) embedding noise: Injects random noise into embeddings. The authors state that only very small noise can be used, otherwise it is difficult to balance utility and privacy.
      • Zhuang et al. (2024) secret scaling: Multiplies query and document embeddings by a scalar known only to the user. The authors state that vector normalization can bypass it, making it ineffective in practice. The authors classify both methods as directly modifying document embeddings and state that they are limited by semantic coupling.
    • Query or document generation
      • Nogueira et al. (2019) doc2query, and docTTTTTquery: Generate pseudo-queries from documents and append them back to the document to improve retrieval; the latter uses a pretrained T5.
      • Wang et al. (2023) query2doc: Uses a pretrained LLM to expand document corpora based on queries to improve training generalization. The authors state that these works focus on IR utility, while SHAQ's generation pipeline targets document privacy.
    • Baselines and benchmarks
      • Baseline methods: No defense, embedding noise (σ=0.01 in experiments), secret scaling (the authors treat it as equivalent to no defense, and it is not listed separately in the results tables). The attack baseline is vec2text.
      • Benchmarks/datasets: 10 datasets retained from BEIR (Table I): SciFact, Natural Questions, MS MARCO, NFCorpus, HotpotQA, FiQA, ArguAna, Quora Question Pairs, FEVER, CLIMATE-FEVER.

    The authors position SHAQ as: instead of modifying document embeddings, it replaces them with shadow query embeddings, using semantic decomposition and embedding decoupling to mitigate EIA in vector databases, and distinguishes it from query generation works that only improve retrieval utility. The last sentence of Section V also mentions related work on vision models and model validation, without detailed comparison.

  3. How does the paper address this problem?

    SHAQ first generates diverse shadow queries, then replaces document embeddings with their embeddings and randomly shuffles the index.

    SHAQ operates in two steps: generation and indexing. A generative language model splits each document into multiple shadow queries, and then the embeddings of these queries replace the document embeddings in the vector database. Figure 1 gives an overview.

    Problem setting and formalization

    • The embedding model ϕ(·) maps queries and documents into the same vector space. The paper writes top-k retrieval as DK=argtop-kd∈ Dsim(ϕ(q),ϕ(d)), i.e., taking the top k documents by cosine similarity or dot product.
    • The defense does not modify the online query encoding. Shadow queries are generated offline once before retrieval. Retrieval succeeds when a user query is semantically close to one of the shadow queries, which is then mapped back to the original document.
    • The vectors in the database no longer encode the entire document, but only one of its semantic facets, so that the text directly recovered by EIA is no longer the original document.

    Shadow query generation

    • Algorithm 1: For each document, a prompt is constructed, the generative model f produces ng candidates; K-Means divides them into nk clusters, and one is randomly selected from each cluster. The prompt guides different retrieval perspectives; Appendix A gives the full prompt, and Appendix B gives generation examples.
    • The authors state that this step draws on doc2query, but here shadow query embeddings replace document embeddings rather than appending pseudo-queries back to the document.
    • In experiments, f is QwQ-32B (8-bit quantization). Appendix F sets ng to 10 due to computational resources; after searching nk∈{1, 5, 10} on SciFact, the authors state that nk=10 gives the best utility-privacy balance, and nk=10 is used throughout the paper.

    Embedding indexing and scattering

    • Algorithm 2: Each shadow query is encoded by ϕ into e, the mapping S records e to document ID, e is written to the vector database V; after all are written, RandomShuffle is applied. At retrieval, the hit shadow query is mapped back to the document via S.
    • The authors state that pooling multiple shadow query embeddings of the same document into one vector reduces utility due to semantic interference, so they do not pool but keep multiple embeddings and randomly shuffle them. Shuffling is to increase the difficulty for adaptive attacks to locate all shadow queries of the same document in order (Section IV-F).

    Retrieval, parameters, and evaluation

    • In main experiments, ϕ is GTR-T5 encoder, outputting normalized embeddings, with cosine similarity; similarity comparison uses FAISS. The top-k has k=10.
    • Utility metrics are NDCG, MAP, Recall, Precision, Accuracy. Defense effectiveness compares the recovered text with the original document, with metrics BLEU, ROUGE, METEOR; lower indicates less recovery.
    • For a fair comparison with embedding noise, the authors search the noise standard deviation on SciFact and select σ=0.01, which gives utility close to nk=10. Downstream question answering and text generation are written as outside the scope of this evaluation.
  4. What experiments did the paper conduct?

    On 10 BEIR datasets, the authors state that SHAQ's ROUGE-1 recovery rate averages 0.2710 and is at least 0.2104.

    Experimental Setup

    • Embedding model: GTR-T5 encoder for the main experiments. Appendix I additionally uses DPR (dot-product similarity) and reports only SciFact retrieval utility. The main experiments truncate documents to 32 tokens to align with vec2text's training length, avoiding the defense being favored because longer texts are harder to reconstruct.
    • Attack model: vec2text, based on T5, takes embeddings as input and generates text; the authors focus on an attack model trained on GTR-T5 embeddings. The paper states its training pairs come from NQ or MS MARCO training sets, without specifying which one was used for the reported results. The OpenAI text-embeddings-ada-002 setting was excluded due to cost. Song et al. and GEIA were not included in the evaluation.
    • Data: Development or test splits of 10 datasets from BEIR, with 100 queries randomly sampled from each; all relevant documents are included, and BM25 top-100 results supplement irrelevant documents. Sampled document counts range from 3,242 to 9,968 (Table I). Datasets with non-binary relevance, too many relevant documents per query, or non-standard IR setups were excluded (Appendix E, Table V).
    • Baselines: No defense; embedding noise with σ=0.01; secret scaling is treated by the authors as no defense and is not listed separately in the table. Same random seed. The paper does not report the number of repetitions, nor the number of vec2text iterations or queries.
    • Evaluation: Utility at k=10. Privacy without an LLM judge. Defense evaluation samples 100 embeddings per condition: no defense and noise sample document embeddings; SHAQ samples 100 shadow query embeddings belonging to different documents. Reconstruction results are always compared against the original documents, not against shadow query texts. The standard evaluation assumes the attacker does not know about SHAQ.
    • Generation model: QwQ-32B, 8-bit. Number of shadow query candidates ng=10, with nk=10 kept per document.

    Main Results

    The table below lists only 8 datasets. Δ is the change relative to no defense. Based on Table III and Table IV; GTR-T5; documents truncated to 32 tokens; k=10. NQ and CLIMATE-FEVER are omitted: no-defense R-1 is 0.9664 and 0.9582, SHAQ's ΔR-1 is −0.6514 and −0.6881, and ΔNDCG is +0.0091 and −0.0058.

    Swipe horizontally to read the table

    DatasetNo-defense R-1Noise ΔR-1SHAQ ΔR-1No-defense NDCGSHAQ ΔNDCG
    ArguAna0.9317−0.5264−0.72130.4118−0.0747
    Quora0.6854−0.3127−0.41760.9146−0.0622
    HotpotQA0.9794−0.5842−0.67670.5590−0.0141
    FiQA0.8542−0.4619−0.63710.2610−0.0153
    MS MARCO0.9081−0.5103−0.63910.4437−0.0302
    SciFact0.9354−0.5723−0.65830.2428+0.0382
    FEVER0.9622−0.5536−0.63640.6407−0.0026
    NFCorpus0.9375−0.5722−0.68220.2113−0.0024
    • The authors state that with no defense, R-1 ranges from 0.6854 to 0.9794, and original text can be substantially reconstructed; adding noise reduces reconstruction, but a considerable amount of content can still be recovered. The authors state that SHAQ achieves the lowest reconstruction scores across all metrics and datasets, with the best improvements over noise being −0.0548 (BLEU), −0.1949 (R-1), −0.0718 (R-2), −0.1004 (R-L), and −0.1689 (METEOR); Section IV-D does not name the corresponding datasets.
    • The introduction states that under standard attacks, the average ROUGE-1 recovery rate is 0.2710 and the minimum is 0.2104; relative to existing defenses, the average number of recovered tokens is 12.43% lower, and the maximum is 19.50% lower. The abstract instead states that up to 19.50% more tokens are defended. These aggregate numbers are not listed per dataset in the tables.
    • For utility, the authors state that both defenses are close to no defense. Section IV-C gives SHAQ's changes relative to no defense: NDCG from −0.0747 to +0.0382, MAP from −0.0778 to +0.0390, Recall from −0.1100 to +0.0640, Precision from −0.0110 to +0.0110, and Accuracy from −0.1100 to +0.0600. In Table III, the largest NDCG drop is ArguAna's −0.0747, and the largest MAP drop is Quora's −0.0778. The authors state SHAQ's highest NDCG is 0.8524 (introduction) and highest MAP@10 is 0.7967, with the highest utility improvement over baseline defenses being 5.53% (abstract), none of which name the dataset. Section IV-C reverses the Precision and Recall ranges for embedding noise; Table III is authoritative.

    Semantic Decomposition and Embedding Decoupling

    • Table II uses concatenated shadow queries versus single shadow queries to examine whether semantics are preserved and whether lexical overlap is decoupled. Cosine similarity between concatenated embeddings and document embeddings is 0.9162 for HotpotQA and 0.7841 for Quora; Document Coverage ranges from 0.4846 for FiQA to 0.7980 for Quora.
    • Average cosine similarity between single shadow queries and document embeddings is 0.8310 for Quora and 0.7496 for FiQA. The lowest lexical overlap is ArguAna's BLEU of 0.0023 and R-1 of 0.1949; Quora's BLEU is 0.0527 and R-1 is 0.3341, the highest lexical overlap row in that table.
    • The authors state that high concatenation similarity and token coverage indicate the set preserves document semantics; low lexical overlap for single queries means reconstructing one shadow query does not reveal the full text.

    Adaptive Attacks

    • Appendix J: the attacker knows the defense mechanism and nk, can use the same LLM that generates shadow queries, and knows the embeddings in the library are shadow queries. The strategy is to find the other nk−1 embeddings with the highest cosine similarity to an observed embedding, reconstruct each with vec2text, and then use that LLM to try to piece together the original document. Appendix J provides the full prompt.
    • Table IX SHAQ results: BLEU 0.0151–0.1446, R-1 0.2083–0.4517, R-2 0.0511–0.2192, R-L 0.1665–0.3530, METEOR 0.1822–0.3807. The lowest R-1 is Quora at 0.2083, and the highest is HotpotQA at 0.4517.
    • The authors state that the adaptive attack improves attack effectiveness, but overall recovery remains low, attributing this to shadow queries of the same document covering different aspects, semantics not always being similar, and random shuffling during indexing. The introduction states that in this setting, ROUGE-1 averages 0.3376 with a minimum of 0.2083.

    Other Ablations and Analyses

    • Untruncated SciFact (Table VII): no-defense NDCG goes from 0.2428 when truncated to 0.5916; SHAQ's ΔNDCG relative to no defense is +0.0578. The authors state that relative to its truncated version, SHAQ's NDCG is +0.3684, MAP +0.3556, Recall +0.3934, Precision +0.0430, and Accuracy +0.4000. The attack model cannot handle variable-length inputs, so defense effectiveness was not evaluated.
    • DPR replacing GTR-T5 (Table VIII, SciFact): no-defense NDCG 0.0897, MAP 0.0702, Recall 0.1483; SHAQ's ΔNDCG is +0.0441 and ΔMAP is +0.0478. The authors consider all three to be lower than GTR-T5, mainly because DPR has weaker semantic embedding capability, but the three remain close to each other.
    • nk search (Table VI, SciFact subsample): NDCG for nk=1/5/10 is 0.1740/0.2338/0.2810, and R-1 is 0.2744/0.2865/0.2771. With noise σ=0.01, NDCG is 0.2297 and R-1 is 0.3631; with σ=0.02, NDCG is 0.2062 and R-1 is 0.2198. The main text states the σ search set is {0.001, 0.01, 0.2}, while Table VI lists 0, 0.001, 0.01, 0.02.
    • The authors state that pooling shadow query embeddings of the same document into a single vector reduces utility, without providing numbers for the pooling setting.
  5. What are some points that can be further explored?

    The paper does not specifically discuss limitations; the Conclusion only restates contributions.

    Limitations and future directions noted by the authors

    The paper does not specifically discuss limitations. The Conclusion in Section VI only restates the contributions and the authors' positioning of the paradigm; the appendix does not frame undone items as limitations or future work.

    Experimental coverage

    • The main experiments use the GTR-T5 encoder as the embedding model; Appendix I and Table VIII additionally report DPR's retrieval effectiveness on SciFact.
    • Attack evaluation uses vec2text. Song et al. (2020) and GEIA are excluded by the authors, with the reason that they do not target document-level recovery from vector databases. The attack setting for OpenAI text-embeddings-ada-002 is excluded due to usage cost.
    • Data consists of 10 datasets from BEIR, each with 100 sampled queries, using the development or test split; main experiments truncate documents to 32 tokens. Appendix H and Table VII compare retrieval effectiveness on untruncated documents only on SciFact.
    • Defense baselines are embedding noise (σ=0.01) and secret scaling, which is treated as no defense. The standard attack samples 100 embeddings per condition; adaptive attacks are in Appendix J and Table IX. The search for nk and σ is done on a SciFact subsample, and ng is set to 10 in Appendix F.
    • The paper does not report the number of experimental repetitions, whether vec2text uses NQ or MS MARCO training pairs, the number of attack iterations or queries, or agreement between reviewers and humans; both privacy and utility use automatic metrics, with no human evaluation. Downstream question answering and generation are written in Section IV-A2 as outside the scope of this evaluation.
  6. Summarize the main content of the paper

    SHAQ replaces document embeddings with shadow query embeddings; the authors state it reduces vec2text document recovery while maintaining retrieval.

    SHAQ is a defense against EIA in cloud vector databases: it does not directly modify document embeddings, but replaces them with shadow query embeddings.

    • Problem: Dense retrieval and RAG place precomputed document embeddings in third-party vector databases. An honest-but-curious adversary can call the embedding model in a black-box manner and use EIA to recover the original text. The authors believe that noise can only be very small, and secret scaling is neutralized by vector normalization.
    • Method: QwQ-32B generates ng=10 candidates for each document, and K-Means retains nk=10 shadow queries; GTR-T5 encodes them, then they are randomly shuffled and written to the database, with an embedding-to-document-ID mapping for top-10 retrieval. The standard evaluation assumes the attacker does not know about the replacement.
    • Privacy: Under the setting of 10 BEIR datasets, documents truncated to 32 tokens, and vec2text, the authors state that ROUGE-1 recovery rate averages 0.2710 and is at least 0.2104. In Table IV, no-defense R-1 is 0.6854–0.9794; the authors state that SHAQ's reconstruction scores are lower than embedding noise, with the best improvement over it being −0.1949 on R-1. The introduction states that compared to existing defenses, recovered tokens are on average 12.43% fewer and at most 19.50% fewer.
    • Utility and adaptivity: The authors state that retrieval is comparable to no defense, with NDCG up to 0.8524; in Table III, SHAQ's NDCG changes range from −0.0747 to +0.0382, with ArguAna at −0.0747. When the defense is known, Table IX shows R-1 of 0.2083–0.4517; the introduction states an average of 0.3376 and a minimum of 0.2083.
    • Authors' conclusion: The authors believe that shifting from directly perturbing embeddings to semantic decomposition and embedding decoupling can reduce document reconstruction risk while maintaining retrieval; and state that the pipeline can be integrated into existing dense retrievers, with retrieval utility still close to the corresponding no-defense setting on untruncated documents and DPR.

Related papers

Read originalarxiv.org