<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: zahraarmantech</title>
    <description>The latest articles on DEV Community by zahraarmantech (@zahraarmantech).</description>
    <link>https://dev.to/zahraarmantech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3953243%2F40e4e158-c70e-4bc9-9429-dd20dc7ac465.png</url>
      <title>DEV Community: zahraarmantech</title>
      <link>https://dev.to/zahraarmantech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zahraarmantech"/>
    <language>en</language>
    <item>
      <title>What happens when you hide embeddings but keep search working?</title>
      <dc:creator>zahraarmantech</dc:creator>
      <pubDate>Tue, 26 May 2026 21:16:03 +0000</pubDate>
      <link>https://dev.to/zahraarmantech/what-happens-when-you-hide-embeddings-but-keep-search-working-3mi2</link>
      <guid>https://dev.to/zahraarmantech/what-happens-when-you-hide-embeddings-but-keep-search-working-3mi2</guid>
      <description>&lt;p&gt;What happens when you hide embeddings but keep search working?&lt;/p&gt;

&lt;p&gt;I spent the last few months building a system that does something counterintuitive: it takes semantic search embeddings, makes them completely unreadable, and somehow search still works at 98% quality.&lt;/p&gt;

&lt;p&gt;Here’s what that looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem nobody talks about
&lt;/h2&gt;

&lt;p&gt;Every company using semantic search has a dirty secret: their vector database is a map of their entire document collection’s meaning.&lt;/p&gt;

&lt;p&gt;Embeddings cluster by topic. If someone gets access to your vector database — a breach, an insider, a subpoena — they don’t need to read a single document. They can cluster the embeddings and immediately see: these 500 documents are about cancer patients, these 200 are about ongoing litigation, these 100 are salary records.&lt;/p&gt;

&lt;p&gt;No decryption needed. The structure IS the leak.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyudig8znc3ytw1590vpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyudig8znc3ytw1590vpn.png" alt="Raw embeddings leak topic structure" width="800" height="345"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look at the left side. Same-color dots represent same-topic documents. They cluster together — an attacker immediately sees the structure. The right side is the same 50 documents after ZATRON processing. Random noise. No clusters. No structure.&lt;/p&gt;

&lt;p&gt;But here’s the thing: search returns the exact same results on both sides.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;ZATRON (Zero-Access Transformed Retrieval Over Noise) transforms embeddings into modular barcodes. The process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Project the embedding onto 200 independent channels (PCA)&lt;/li&gt;
&lt;li&gt;Quantize each channel to an integer (0–49)&lt;/li&gt;
&lt;li&gt;Mask each value with a cryptographic salt unique to each document&lt;/li&gt;
&lt;li&gt;Store only the modular residues (remainder after dividing by prime numbers)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The key insight: modular arithmetic preserves distance relationships but destroys the original values. Two similar documents produce similar modular distances. But the individual barcodes look like random numbers.&lt;/p&gt;

&lt;p&gt;Without the key, you can’t unmask them. With the key, you can compare them. You never reconstruct the original embedding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Does it actually work?
&lt;/h2&gt;

&lt;p&gt;I tested on real data, not toy examples.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MSMARCO passage retrieval — 626,906 real documents:&lt;/strong&gt;&lt;br&gt;
The system preserves 98.2% of cosine search quality. Out of 500 queries, the encrypted system returns nearly identical rankings to unencrypted cosine search.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Three different embedding models:&lt;/strong&gt;&lt;br&gt;
MiniLM: 98.2%. MPNet: 99.2%. BGE: 86.6% (this model’s embedding distribution is less quantization-friendly — I report this honestly).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Five languages:&lt;/strong&gt;&lt;br&gt;
Arabic, Spanish, Korean, Chinese, English — all above 88%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Comparison with existing methods:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Quality&lt;/th&gt;
&lt;th&gt;Encrypted?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Binary quantization&lt;/td&gt;
&lt;td&gt;96.9%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scalar int8&lt;/td&gt;
&lt;td&gt;98.8%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Product quantization&lt;/td&gt;
&lt;td&gt;97.9%&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ZATRON&lt;/td&gt;
&lt;td&gt;99.6%&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Higher quality than every quantization method — and the only one that’s encrypted.&lt;/p&gt;
&lt;h2&gt;
  
  
  Can an attacker break it?
&lt;/h2&gt;

&lt;p&gt;I ran eight independent attack vectors. All passed.&lt;/p&gt;

&lt;p&gt;But the most convincing evidence is visual:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5d7dtc8le11bxuvxtrhk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5d7dtc8le11bxuvxtrhk.png" alt="Attack analysis" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Left: raw embedding distances perfectly predict true document similarity (ρ = 1.00). An attacker with database access knows exactly which documents are related.&lt;/p&gt;

&lt;p&gt;Right: ZATRON barcode distances show zero correlation with true similarity (ρ = 0.09). The attacker gets nothing.&lt;/p&gt;
&lt;h2&gt;
  
  
  What about FHE?
&lt;/h2&gt;

&lt;p&gt;Fully homomorphic encryption (CKKS) can do encrypted search too. But on the same hardware (Google Colab, T4 GPU), CKKS takes 38.9ms per comparison. ZATRON takes 5ms. That’s 8x faster, using only integer arithmetic, no GPU needed.&lt;/p&gt;

&lt;p&gt;Both are computationally secure — CKKS under Ring-LWE, ZATRON under PRF (HMAC-SHA256). Different assumptions, both standard.&lt;/p&gt;
&lt;h2&gt;
  
  
  What this is NOT
&lt;/h2&gt;

&lt;p&gt;I want to be precise about what ZATRON is and isn’t:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It is NOT classical encryption like AES. You can’t “decrypt” a barcode back to an embedding.&lt;/li&gt;
&lt;li&gt;It IS a randomized privacy-preserving encoding. Barcodes are computationally indistinguishable from random without the key.&lt;/li&gt;
&lt;li&gt;A key holder who computes many pairwise distances CAN partially recover embedding geometry (ρ = 0.63, mitigated to 0.35 with log transform). This is inherent to any distance-preserving scheme, including FHE.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I state these limitations explicitly because overselling helps nobody.&lt;/p&gt;
&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Live demo (no install needed):&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://huggingface.co/spaces/zahraarman/ZATRON" rel="noopener noreferrer"&gt;https://huggingface.co/spaces/zahraarman/ZATRON&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code and paper:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/zahraarmantech/ZATRON" rel="noopener noreferrer"&gt;https://github.com/zahraarmantech/ZATRON&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run locally:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install sentence-transformers scikit-learn matplotlib
python demo.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Who needs this?
&lt;/h2&gt;

&lt;p&gt;Any organization that searches sensitive documents: hospitals (patient records), law firms (case files), financial institutions (client data), defense (classified documents).&lt;/p&gt;

&lt;p&gt;The EU AI Act and GDPR are making embedding privacy a compliance issue, not just a nice-to-have.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next
&lt;/h2&gt;

&lt;p&gt;The system works. The patent is filed. I’m looking for technical feedback, especially from people building vector search infrastructure.&lt;/p&gt;

&lt;p&gt;If you work on vector databases, privacy-preserving ML, or searchable encryption — I’d genuinely appreciate your thoughts. What did I miss? What would break it? What would make it useful?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Zahra Arman — Independent Researcher, Plano TX&lt;/em&gt;&lt;br&gt;
&lt;em&gt;US Provisional Patent Pending&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>privacy</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
